Example repository: a Python service with uv, CI and an image
  • Python 50.2%
  • Dockerfile 49.8%
Find a file
Sander van Thillo e433d3000b
All checks were successful
CI / lint (push) Successful in 12s
CI / test (push) Successful in 12s
CI / audit (push) Successful in 13s
CI / image (push) Successful in 1m12s
feat: example repository for python with CI
2026-11-13 21:29:51 +01:00
.forgejo feat: example repository for python with CI 2026-11-13 21:29:51 +01:00
src/app feat: example repository for python with CI 2026-11-13 21:29:51 +01:00
tests feat: example repository for python with CI 2026-11-13 21:29:51 +01:00
.dockerignore feat: example repository for python with CI 2026-11-13 21:29:51 +01:00
.editorconfig feat: example repository for python with CI 2026-11-13 21:29:51 +01:00
.gitignore feat: example repository for python with CI 2026-11-13 21:29:51 +01:00
.python-version feat: example repository for python with CI 2026-11-13 21:29:51 +01:00
Dockerfile feat: example repository for python with CI 2026-11-13 21:29:51 +01:00
pyproject.toml feat: example repository for python with CI 2026-11-13 21:29:51 +01:00
README.md feat: example repository for python with CI 2026-11-13 21:29:51 +01:00
renovate.json feat: example repository for python with CI 2026-11-13 21:29:51 +01:00
uv.lock feat: example repository for python with CI 2026-11-13 21:29:51 +01:00

$REPO_OWNER/$REPO_NAME

An HTTP service in Python with FastAPI, managed with uv.

Start

You need uv. uv installs Python 3.14 if you do not have it.

uv run uvicorn app.main:app --reload    # http://localhost:8000
curl localhost:8000/healthz
Command What it does
uv run ruff check . Lint
uv run ruff format . Format
uv run pytest Tests
uv add <package> Add a dependency to pyproject.toml and uv.lock

Pipeline

.forgejo/workflows/ci.yml is the complete pipeline. Copy it and change it as you need.

Event What happens
Pull request ruff, pytest and pip-audit in parallel, then the image is built without a push
Push to main The same, and the image is pushed as <short sha>-main-<run number>
Tag vX.Y.Z Also the image X.Y.Z

The checks run on the label default, without root. The image build needs Docker, so it runs on the label vm. The image is code.digitaledienst.overheid.nl/$REPO_OWNER/$REPO_NAME and has an SBOM. It runs as uid 1000 on port 8080. The push uses the organisation secrets REGISTRY_USER and REGISTRY_TOKEN.

Files

File Purpose
pyproject.toml The project, the dependencies, and the settings of ruff and pytest
uv.lock The exact versions of all dependencies
Dockerfile Install with uv, run with plain Python as uid 1000
renovate.json The shared Renovate presets, and the tags of the actions of forgejo/ci-components
.forgejo/template The files in which Forgejo fills in the name of a new repository