A starter project using Python, FastAPI and uv.
A project starter for personal usage containing the following:
- Python 3.15.*
- FastAPI web framework
- Structured logging using
structlog - Dependency management using
uv - Toolchain management using
mise - Containerisation using a Dockerfile
- Testing with
pytestand optionally with coverage withpytest-cov - Linting/formatting using
Ruff - Type checking using
ty .gitignore
mise manages the pinned toolchain (Python 3.15.2, uv 0.13.7).
macOS / Linux
curl https://mise.run | shWindows
winget install jdx.miseActivate mise in your shell so the pinned versions take precedence over any system installs (Homebrew, etc.). In ~/.zshrc:
eval "$(mise activate zsh)"Then, in the repo:
mise trust # one-time, confirms you trust this repo's mise.toml
mise install # downloads and pins Python and uv
mise run install # installs dependencies into .venv| Command | Description |
|---|---|
mise run install |
Install dependencies into .venv |
mise run dev |
FastAPI dev server on 127.0.0.1:8000 |
mise run serve |
Production server on 0.0.0.0:8000 |
mise run test |
Run tests with coverage |
mise run fmt |
Format code via ruff format |
mise run lint |
Lint code via ruff check |
mise run typecheck |
Type check via ty check |
mise run vuln |
Audit deps for known vulnerabilities |
mise run deps |
Update and sync dependencies |
The following podman commands are direct replacements of the Docker CLI. You can see that their syntax is identical:
podman image build -t fastapi-uv-starter .Run our FastAPI application and map our local port 8000 to 8000 on the running container:
podman container run -d --name fastapi-uv-starter -p 8000:8000 --network bridge fastapi-uv-starterpodman psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
78586e5b4683 localhost/fastapi-uv-starter:latest fastapi run app/... 13 minutes ago Up 5 minutes ago 0.0.0.0:8000->8000/tcp nifty_roentgenOur FastAPI server now runs on port 8000 on our local machine. We can test it with:
curl -i http://localhost:8000/healthcheckOutput:
HTTP/1.1 200 OK
server: uvicorn
content-length: 0