fastapi/fastapi
Configuration
pyproject.toml
The repository's single source of project configuration. Notable sections:
| Section | Purpose |
|---|---|
[project] |
Package metadata. requires-python = ">=3.10". Runtime dependencies: starlette>=0.46.0, pydantic>=2.9.0, typing-extensions>=4.8.0, typing-inspection>=0.4.2, annotated-doc>=0.0.2. |
[project.optional-dependencies] |
Three opt-in groups installed as pip install fastapi[standard] etc.: standard, standard-no-fastapi-cloud-cli, all. |
[project.scripts] |
Single entry: fastapi = fastapi.cli:main. |
[dependency-groups] |
Dev-time groups (PEP 735): dev, tests, docs, docs-tests, github-actions, translations. |
[tool.pdm] |
Build version source: fastapi/__init__.py. |
[tool.mypy] |
strict = true; uses pydantic.mypy plugin. Per-module overrides relax docs_src and tests. |
[tool.pytest] |
minversion = "9.0"; addopts = ["--strict-config", "--strict-markers", "--ignore=docs_src"]; filterwarnings = ["error"]; timeout = "20". |
[tool.coverage.run] |
parallel = true, source = ["docs_src", "tests", "fastapi"]. Excludes benchmarks and a few intentionally untested tutorials. |
[tool.ruff.lint] |
select = ["E","W","F","I","B","C4","UP"]. Per-file ignores call out tutorial examples that intentionally show "wrong" code. |
[tool.ruff.lint.isort] |
known-third-party = ["fastapi", "pydantic", "starlette"]. |
[tool.inline-snapshot] |
Currently empty — defaults are applied per pytest invocation. |
FastAPI(...) runtime configuration
The FastAPI constructor accepts roughly forty parameters. The headline ones:
| Parameter | Default | What it does |
|---|---|---|
title, version, summary, description, terms_of_service, contact, license_info |
"FastAPI", "0.1.0", … |
OpenAPI info metadata. |
openapi_url |
"/openapi.json" |
Path of the schema route. None to disable. |
docs_url |
"/docs" |
Swagger UI path. None to disable. |
redoc_url |
"/redoc" |
ReDoc path. None to disable. |
swagger_ui_oauth2_redirect_url |
"/docs/oauth2-redirect" |
OAuth2 redirect bridge. |
swagger_ui_init_oauth |
None |
Dict passed to Swagger UI's initOAuth(...). |
swagger_ui_parameters |
None |
Extra Swagger UI config merged onto the defaults. |
default_response_class |
JSONResponse |
Class used to wrap returned values. |
dependencies |
None |
List of dependencies applied to every route. |
responses |
None |
Dict of OpenAPI response shapes applied to every route. |
redirect_slashes |
True |
Inherit from Starlette. |
generate_unique_id_function |
generate_unique_id (fastapi/utils.py) |
OpenAPI operation-ID generator. |
lifespan |
None |
Async context manager replacing on_startup/on_shutdown. |
webhooks |
None |
Routes describing outbound webhooks (OpenAPI only). |
separate_input_output_schemas |
True |
Toggle separate request/response schemas. |
terms_of_service, contact, license_info, openapi_tags |
None |
OpenAPI metadata. |
For the full list with documentation, read the docstrings in fastapi/applications.py — every parameter is annotated with Annotated[T, Doc("""...""")].
CI environment
.github/workflows/test.yml and the doc-build workflows expect:
UV_SYSTEM_PYTHONset to enableuv syncagainst the system Python on CI runners.GITHUB_TOKENfor bot-driven workflows (people.yml,sponsors.yml,latest-changes.yml, etc.).
There are no other repository-level configuration files (no .env, no separate config). The MkDocs setup lives under docs/<lang>/mkdocs.yml, generated by scripts/docs.py.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.
Previous
Reference
Next
Data models