Example repository: a Python service with uv, CI and an image
- Python 50.2%
- Dockerfile 49.8%
| .forgejo | ||
| src/app | ||
| tests | ||
| .dockerignore | ||
| .editorconfig | ||
| .gitignore | ||
| .python-version | ||
| Dockerfile | ||
| pyproject.toml | ||
| README.md | ||
| renovate.json | ||
| uv.lock | ||
$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 |