Registry / web-framework / fastopenapi

fastopenapi

JSON →
library0.7.0pypypi✓ verified 90d ago

FastOpenAPI is a library for generating and integrating OpenAPI schemas using Pydantic v2 with multiple async web frameworks (AioHttp, Falcon, Flask, Quart, Sanic, Starlette, Tornado). The latest stable release is v0.7.0, with v1.0.0rc1 available as a release candidate. The project is actively maintained with frequent releases.

pip install fastopenapi
INSTALL
IMPORT
SIG · FASTOPENAPI
F
fastopenapi
web-frameworkpythonv0.7.0
Install
3.1s avg
Import
403ms
Disk
28MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.7.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 3.95s
py 3.11
✓ —
✓ 3.1s
py 3.12
✓ —
✓ 2.7s
py 3.13
✓ —
✓ 2.8s
py 3.9
✕ build_error
✕ build_error
28MB installed
● package 28MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

StarletteRouter
✓ from fastopenapi.routers import StarletteRouter
✗ from fastopenapi import StarletteRouter
Since v0.3.0 routers are under fastopenapi.routers
FlaskRouter
✓ from fastopenapi.routers import FlaskRouter
✗ from fastopenapi import FlaskRouter
Same for all routers

Minimal FastOpenAPI app with Starlette and Pydantic v2.

from fastopenapi.routers import StarletteRouter from pydantic import BaseModel from starlette.applications import Starlette from starlette.responses import JSONResponse import uvicorn app = Starlette() router = StarletteRouter(app) class HelloResponse(BaseModel): message: str @router.get("/hello/{name}", response_model=HelloResponse) def hello(name: str) -> HelloResponse: return HelloResponse(message=f"Hello, {name}!") if __name__ == "__main__": uvicorn.run(app, host="0.0.0.0", port=8000)
Debug
Known issues
breakingIn v0.6.0 the 'use_aliases' parameter was added to BaseRouter (default True). This changed behavior for models with aliases. To revert to previous behavior, set use_aliases=False.
fix
Initialize router with use_aliases=False if you need the previous behavior.
affects: 0.6.0 - 0.7.0
deprecatedThe use_aliases parameter was removed in v0.7.0. The library now always uses aliases via Pydantic.
fix
Remove use_aliases parameter; aliasing is always on.
affects: 0.7.0+
gotchaFor GET routes with Pydantic models as parameters, the library reads query parameters at runtime. In v1.0.0rc1 this was fixed but in v0.7.0 the behavior may be incorrect for certain model definitions.
fix
Upgrade to v1.0.0rc1 or use manual query parameters for GET endpoints.
affects: <=0.7.0
gotchaRouter imports changed from direct 'from fastopenapi import StarletteRouter' to 'from fastopenapi.routers import StarletteRouter' in v0.3.0. Old imports will raise ModuleNotFoundError.
fix
Use correct import path: from fastopenapi.routers import YourRouter.
affects: >=0.3.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'fastopenapi'
Package not installed, or installed without the desired framework extra.
fix
Run 'pip install fastopenapi' for base, or 'pip install fastopenapi[starlette]' for Starlette support.
ImportError: cannot import name 'StarletteRouter' from 'fastopenapi'
Using old import path 'from fastopenapi import StarletteRouter' which is incorrect since v0.3.0.
fix
Use 'from fastopenapi.routers import StarletteRouter'.
ValueError: 'use_aliases' is not a valid parameter for this router
Trying to pass use_aliases argument in v0.7.0 where it was removed.
fix
Remove the use_aliases parameter; aliasing is always enabled.
Upgrade
Version history
0.7.0latest on PyPI · released Apr 27, 2025
Audit
Dependencies
pydanticrequiredCore dependency for data validation and schema generation
starletteoptionalRequired for StarletteRouter
flaskoptionalRequired for FlaskRouter
aiohttpoptionalRequired for AioHttpRouter
falconoptionalRequired for FalconRouter
quartoptionalRequired for QuartRouter
sanicoptionalRequired for SanicRouter
tornadooptionalRequired for TornadoRouter
Agent activity
17 hits · last 30 days
node
14
Resources
fastopenapi — pip install fastopenapi · libregistry