@rulepack/python-fastapi

v0.1.3

FastAPI conventions: pydantic v2, async-first endpoints, dependency injection, OpenAPI hygiene.

Updated 6/4/20265 files | 4.0 KB
$pnpm dlx rulepack add python-fastapi

Drops CLAUDE.md / .cursor/rules/* and friends into your project.

Downloads

0

Stars

0

Views

0

python-fastapi

FastAPI conventions: pydantic v2, async-first endpoints, dependency injection, OpenAPI hygiene.

npx rulepack add python-fastapi

What it covers

  • Tooling baseline: Python 3.12+, uv/pdm for env+lock, type hints everywhere (mypy --strict), Pydantic v2 (model_dump(), not .dict())
  • Async-first endpoints: async def handlers by default, with asyncio.to_thread() (or a sync route) instead of blocking the event loop with sync I/O
  • Typed request/response contracts: Pydantic models for bodies plus response_model so the generated OpenAPI stays accurate
  • Explicit parameter and error handling: Annotated[..., Path(...)] / Annotated[..., Query(...)] over bare defaults, and HTTPException with explicit status_code + detail
  • A framework-agnostic project shape (routers/, schemas/, services/, deps.py) with dependency injection instead of mutable global state

Source

Rules align with the official FastAPI documentation: https://fastapi.tiangolo.com/

License

MIT