fastapi/fastapi
Tooling
A tour of the tools and scripts that surround the framework code.
Build system
- PDM backend.
pyproject.toml [build-system]usespdm-backend. The version is read fromfastapi/__init__.py(see[tool.pdm.version]). - uv lockfile.
uv.lockis committed (1 MB). Eitheruv syncorpdm install -G:allproduces a working dev environment. fastapi-slimdistribution. Thefastapi-slim/directory hosts an alternatepyproject.tomlthat builds the same code under a different package name with different default extras. CI builds both;.github/workflows/test-redistribute.ymlexercises them.
Lint and format
scripts/lint.sh:
mypy fastapi
ty check fastapi
ruff check fastapi tests docs_src scripts
ruff format fastapi tests --checkscripts/format.sh:
ruff check fastapi tests docs_src scripts --fix
ruff format fastapi tests docs_src scriptsscripts/lint.sh formats only fastapi and tests, while format.sh extends formatting to docs_src and scripts. Lint configuration lives in pyproject.toml under tool.ruff.* and tool.mypy.*.
prek (a Rust-based pre-commit-compatible runner) is in the dev dependency group; CI runs pre-commit.yml to validate hooks.
Testing helpers
| Script | Purpose |
|---|---|
scripts/test.sh |
Run pytest with PYTHONPATH=./docs_src and -n auto --dist loadgroup. |
scripts/test-cov.sh |
Run tests under coverage; print combined report. |
scripts/test-cov-html.sh |
Same, but emit an HTML report. |
scripts/coverage.sh |
Run coverage combine + coverage report. |
Documentation tooling
scripts/docs.py is a Typer CLI for everything documentation-related:
| Sub-command | What it does |
|---|---|
live |
Run MkDocs serve. Optional language argument (live es). |
build-all |
Build every language under docs/. |
preview |
Serve a previously built site. |
serve |
Alternate dev server. |
verify-config |
Validate per-language mkdocs.yml. |
update-languages |
Refresh per-language config files from English. |
verify-non-translated |
Check that English-only files exist as expected. |
It plays well with MkDocs Material insiders when present and falls back to the OSS build otherwise. Hooks live in scripts/mkdocs_hooks.py.
Translation tooling
| Script | Purpose |
|---|---|
scripts/translate.py |
LLM-driven translation pipeline using pydantic-ai. Provides commands to translate individual pages or batches and to record progress in tracking issues. |
scripts/notify_translations.py |
Posts comments on tracking GitHub issues when a page changes in English. Triggered by .github/workflows/notify-translations.yml. |
scripts/translation_fixer.py |
Bulk-edit fixer for translation discrepancies. |
scripts/people.py |
Refreshes the contributors / experts / translators pages from GitHub data. |
scripts/sponsors.py |
Refreshes the sponsors section in README.md and the docs site. |
scripts/topic_repos.py |
Maintains the list of community repos tagged with the fastapi topic. |
scripts/contributors.py |
Powers the contributors workflow alongside people.py. |
scripts/deploy_docs_status.py |
Posts the docs preview deployment status to the PR. |
scripts/label_approved.py |
Labels PRs that have approving reviews. |
scripts/add_latest_release_date.py |
Stamps the release-notes header with a date. |
These scripts are wired into workflows under .github/workflows/:
people.yml,contributors.yml,sponsors.yml,topic-repos.ymlrebuild auto-generated content.translate.yml,notify-translations.ymlkeep translations in sync.latest-changes.ymlregenerates release notes from merged PRs.label-approved.yml,labeler.ymlautomate triage.
Tests for the scripts
scripts/tests/ contains pytest tests for the larger automation scripts (notably scripts/docs.py). scripts/test.sh runs them as part of the regular suite (pytest tests scripts/tests/).
Playwright
tests/ does not currently use Playwright, but playwright >= 1.57.0 is in the dev group and scripts/playwright/ contains scripted browser interactions used to maintain the docs site (e.g., automated screenshots).
CI
See Development workflow / CI surface. The most important workflow for changes to the framework itself is test.yml; the most important for docs is build-docs.yml and deploy-docs.yml; the most important for the slim distribution is test-redistribute.yml.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.
Previous
Patterns and conventions
Next
Systems