Registry / web-framework / fastapi

fastapi

JSON →
library0.141.1pypypi✓ verified 30d ago

FastAPI is a modern, fast (high-performance) web framework for building APIs with Python 3.8+ based on standard Python type hints. It leverages Starlette for the web parts and Pydantic for data validation and serialization. It features automatic OpenAPI documentation (Swagger UI, ReDoc). The current version is 0.136.0, and it maintains a frequent release cadence, often with minor updates several times a month.

pip install "fastapi[standard]" uvicorn
INSTALL
IMPORT
SIG · FASTAPI
F
fastapi
web-frameworkpythonv0.141.1
Install
7.8s avg
Import
1486ms
Disk
86MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.141.1 · 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
py 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 1.521s · 82.6MB
glibc
py 3.10–3.910 runs
installs and imports cleanly · install 7.8s · import 1.451s · 85MB
86MB installed
● package 86MB
Code
Verified usage

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

FastAPI
✓ from fastapi import FastAPI
Depends
✓ from fastapi import Depends
HTTPException
✓ from fastapi import HTTPException
status
✓ from fastapi import status
✗ from starlette import status
While `starlette.status` works, `fastapi.status` is the officially exposed and preferred import path.
Body
✓ from fastapi import Body
Query
✓ from fastapi import Query
Path
✓ from fastapi import Path
Response
✓ from fastapi import Response
✗ from starlette.responses import Response
FastAPI re-exports common Starlette components for convenience; using `fastapi.Response` is generally preferred.

This quickstart demonstrates a basic FastAPI application with two GET endpoints. It defines a root endpoint and an endpoint with a path parameter and an optional query parameter. The accompanying `uvicorn` command shows how to run the application for development.

import uvicorn from fastapi import FastAPI app = FastAPI() @app.get("/") async def read_root(): return {"Hello": "World"} @app.get("/items/{item_id}") async def read_item(item_id: int, q: str | None = None): return {"item_id": item_id, "q": q} # To run this app: # 1. Save it as main.py # 2. Run from your terminal: uvicorn main:app --reload # Then open http://127.0.0.1:8000/ or http://127.0.0.1:8000/docs
Debug
Known issues
breakingFastAPI version 0.100.0 and above officially support Pydantic V2. Upgrading FastAPI may automatically upgrade Pydantic from V1 to V2, leading to significant breaking changes in model syntax, validators, and error handling. This is a major compatibility consideration.
fix
Consult the official Pydantic V2 migration guide and FastAPI's Pydantic V2 migration notes. Downgrade Pydantic to `<2.0.0` if staying on an older FastAPI, or refactor models and code for Pydantic V2.
affects: 0.100.0 onwards (when upgrading from an older FastAPI + Pydantic V1 setup)
gotchaUsing blocking I/O operations (e.g., synchronous database calls, heavy computations) directly within `async def` FastAPI path operations can block the entire event loop, severely degrading performance and concurrency.
fix
Run blocking operations in a separate thread pool using `anyio.to_thread.run_sync()` or `loop.run_in_executor()`, or use async-native libraries (e.g., `asyncpg`, `databases`). For CPU-bound tasks, consider external workers.
affects: All versions
gotchaTo run FastAPI applications, an ASGI server like Uvicorn is required. For certain features, such as parsing form data, optional dependencies like `python-multipart` are also needed. Missing these will lead to runtime errors or incomplete functionality.
fix
Install `uvicorn` and other necessary optional dependencies. For a common setup, `pip install "fastapi[standard]" uvicorn` is recommended, as `[standard]` includes `python-multipart` and others.
affects: All versions
deprecatedThe experimental `@app.vibe()` decorator, briefly introduced in v0.135.3 for 'vibe coding,' was removed just one patch version later in v0.135.4. Applications that adopted this feature during its short lifespan will fail to start on newer versions.
fix
Remove all usage of `@app.vibe()` from your application code. This feature was temporary and is no longer supported.
affects: 0.135.4 and above (for code written against 0.135.3)
Upgrade
Version history
0.141.1latest on PyPI · released Jul 29, 2026
Audit
Dependencies
pydanticrequiredCore data validation and settings management. FastAPI >= 0.100.0 requires Pydantic V2 (>=2.9.0 as of 0.135.2).
starletterequiredUnderlying ASGI framework. FastAPI >= 0.133.0 supports Starlette 1.0.0+.
uvicornrequiredASGI server to run the application (not a direct dependency but essential for execution).
python-multipartoptionalRequired for parsing form data with `Request` objects.
email-validatoroptionalRequired for validating email fields in Pydantic models.
python-joseoptionalRequired for JWT-based security.
passlib[bcrypt]optionalRequired for password hashing.
Agent activity
78 hits · last 30 days
node
72
OpenAI (training)
2
Amazon
1
Resources
fastapi — pip install fastapi · libregistry