Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

FastAPI Service Template

A minimal FastAPI baseline for KubeRocketCI. It uses uv for dependencies, pytest for tests, ruff for linting + formatting and a small non-root Docker image.

Requirements

  • Python 3.12+
  • uv
  • Docker

Project layout

.
├── app/main.py         # FastAPI application
├── tests/              # pytest tests
├── pyproject.toml      # dependencies and tool config
├── uv.lock             # locked dependency versions
├── Dockerfile
├── .gitignore
└── .dockerignore

Quick start

uv sync                                   # create .venv from uv.lock
uv run uvicorn app.main:app --reload --port 8080

Open http://localhost:8080/docs for the interactive API docs.

Endpoints

Method Path Description
GET /healthz Liveness/readiness probe, returns ok
GET /items/{id} Example endpoint, optional ?q= param

Development

uv run pytest                 # run tests
uv run ruff check .           # lint
uv run ruff format .          # format

Manage dependencies with uv, then commit pyproject.toml and uv.lock:

uv add <package>              # runtime dependency
uv add --dev <package>        # dev-only dependency
uv lock --upgrade             # bump all locked versions

Docker

docker build -t myimage .
docker run --rm -p 8080:8080 myimage
curl http://localhost:8080/healthz

The image is multi-stage and runs as a non-root user (UID 10001) on port 8080. Use /healthz for Kubernetes liveness and readiness probes.

Versioning

The version lives in pyproject.toml. Print it with:

uv version --short

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages