Registry / web-framework / fastapi-cli

fastapi-cli

JSON →
library0.0.24pypypiunverified

FastAPI CLI (Command Line Interface) is a command-line program that simplifies running and managing FastAPI applications. It provides commands to serve apps in development and production modes, manage projects, and more. It is usually installed as part of `fastapi[standard]` and receives frequent updates, typically involving dependency bumps and occasional breaking changes related to Python version support or internal dependencies.

web-frameworkdevops
Install & Compatibility
Where this runs
tested against v0.0.24 · 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
8/10 runs
8/10 runs
py 3.11
8/10 runs
8/10 runs
py 3.12
8/10 runs
8/10 runs
py 3.13
8/10 runs
8/10 runs
py 3.9
8/10 runs
8/10 runs
Code
Verified usage

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

The primary interaction is via the 'fastapi' command in the shell, e.g., 'fastapi dev'.

This is a command-line utility, not a Python library meant for direct import into Python code. You invoke it from your terminal.

Create a `main.py` file with a basic FastAPI application instance named `app`. Then, run the application using `fastapi dev main.py` for development with auto-reload. For more explicit project setup, configure the `entrypoint` in `pyproject.toml` and then simply run `fastapi dev`.

# main.py from fastapi import FastAPI app = FastAPI() @app.get("/") async def read_root(): return {"message": "Hello FastAPI CLI!"} # Terminal commands # Run in development mode (with auto-reload): # fastapi dev main.py # Or, for explicit configuration (recommended for larger projects): # 1. Add to pyproject.toml: # [tool.fastapi] # entrypoint = "main:app" # 2. Then run: # fastapi dev
fastapi --version
Debug
Known footguns
breakingDropped support for Python 3.9 in version 0.0.23, and Python 3.8 in version 0.0.19. Ensure your project's Python version meets the minimum requirement (>=3.10).
breakingDropped support for Pydantic v1 in version 0.0.17. This may cause issues if your project relies on Pydantic v1. Note that version 0.0.16 had temporarily fixed Pydantic v1 support, but it was subsequently dropped again.
deprecatedThe `fastapi-cli-slim` package was deprecated in version 0.0.21. Projects should now directly use `fastapi-cli`.
gotchaAlways use `fastapi dev` for local development and `fastapi run` for production-like environments. `fastapi dev` enables auto-reload and binds to `127.0.0.1` (localhost), while `fastapi run` disables auto-reload and binds to `0.0.0.0` (accessible externally), which is suitable for containers or behind a reverse proxy. Using `fastapi dev` in production is resource-intensive and less stable.
gotchaFor complex project structures or when other tools need to find your app, it's highly recommended to configure the `entrypoint` in your `pyproject.toml` file rather than always passing the file path to `fastapi dev` or `fastapi run`.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
24 hits · last 30 days
claudebot
5
gptbot
4
amazonbot
4
ahrefsbot
3
dotbot
2
sogoubot
1
Resources