Setup Python FastAPI
| This documentation was generated with the assistance of AI. Please report any inaccuracies. |
Scaffolds a FastAPI service with uv, or brings an existing FastAPI service up to date, and layers this catalog’s Python toolchain and a small, tested application skeleton on top.
Purpose
iru-setup-python-fastapi runs uv init --bare and uv add with pinned ranges (fastapi[standard], Pydantic 2, pydantic-settings, SQLModel or plain SQLAlchemy 2.0 async, Alembic), then writes:
-
The layered
app/package:main.py(app factory, lifespan, exception handlers),settings.py(APP_prefix,SecretStr),dependencies.py(Annotatedaliases),db.py,routers/,services/(with aProtocolport),data/adapters andmodels/. -
/healthzand/readyzprobes and one sample CRUD resource (router, service, repository) with fast tests on in-memory SQLite and a testcontainers PostgreSQL integration tier marked@pytest.mark.integration. -
Alembic with an async
env.py, a naming convention and a reviewed initial revision; optional PyJWT and pwdlib Argon2 bearer-token auth. -
Every tool config in
pyproject.toml(Ruff, mypy strict with the Pydantic plugin, pytest markers, coverage with an 80% floor and XML atbuild/coverage/coverage.xml),scripts/export_openapi.pyand Sphinx API docs sources indocs/api/. -
A multi-stage non-root uv
Dockerfile,.dockerignore,compose.yaml(postgres:18, a one-shotmigrate, the app),.env.exampleand, when Sonar is enabled,sonar-project.properties.
The generated code is the first exemplar of the iru-fastapi-code-one-task conventions, and its commands, paths and markers are the scaffold contract that the iru-python-* gate skills and iru-setup-python-github-workflows rely on. The skill announces whether it is scaffolding from scratch or updating an existing service and, per owned artifact that already exists, asks Update / Keep as is / Replace (or Stop) unless on-existing pre-answers. Replace is never offered for application source, tests or applied migrations.
Plugin
Shipped by the iru-python plugin of the ai-catalog marketplace (install with /plugin install iru-python@ai-catalog; see Plugins).
Invocation
/iru-setup-python-fastapi
When called from iru-setup-python-repository, the resolved answers arrive as args key: value lines.
Inputs
| Argument | Required | Description | Default |
|---|---|---|---|
|
No |
Distribution name (lowercase kebab-case, also the image name), snake_case package identifier (used for Compose and database names) and description. |
Repository directory name; asked |
|
No |
|
Asked (existing services: read from |
|
No |
CPython minor for |
|
|
No |
|
|
|
No |
|
|
|
No |
|
|
|
No |
Shared pipeline vocabulary. |
Asked or derived ( |
|
No |
|
Asked; |
|
No |
|
Derived: root |
|
No |
|
|
Other keys (ci-tests, pages, publish, flavor, and so on) are ignored. An existing pyproject.toml that is not a FastAPI service (Django, a library, Flask) stops the skill; a non-uv runner offers Adopt uv or Stop.
Outputs
-
pyproject.toml,uv.lockand.python-versionwith version0.1.0.dev0and all tool sections. -
The
app/package andtests/(conftest.py,fakes.py,unit/, andintegration/with PostgreSQL). -
With a database:
alembic.ini,migrations/(asyncenv.py,script.py.mako,versions/0001_create_book_table.py). -
With
auth: yes:app/security.py, auth models and router, and the auth versions of settings, dependencies and tests. -
scripts/export_openapi.py,docs/api/conf.pyanddocs/api/index.rst. -
Dockerfile,.dockerignore,compose.yaml,.env.example, andsonar-project.propertieswhen Sonar is enabled. -
A report: mode, per-component action (created / updated / replaced / kept as is / removed / skipped), resolved shape, versions and drift past the pins, each verification command and result (unverified items such as Docker-dependent steps called out), and warnings (review identity and Sonar keys, never commit
.env, run migrations once per release, one Uvicorn process per container).
No .gitignore, workflows, CHANGELOG.md, README.md or Antora files are written; the orchestrator runs the dedicated skills for those next.
Execution flow
Dependencies
Invokes
None. It runs uv, docker and curl directly and reads its own reference/ files (tooling, app, persistence, auth, Docker and Sonar templates). Step 14 runs the commands that the iru-python-* gate skills and the workflows call, without invoking those skills. The generated code follows the iru-fastapi-code-one-task conventions.
Invoked by
-
Setup Python Repository — scaffold step, flavor fastapi, via the
iru-isolated-skill-executoragent.
Source
SKILL.md on GitHub — the file this page was generated from.