A fully typed Python client for the Forgejo API — async-first, with a complete sync mirror.
uv add forgejo-pythonor with pip:
pip install forgejo-pythonThe distribution is forgejo-python; the import name is pyfj:
from pyfj import Forgejo
with Forgejo("https://codeberg.org", token="...") as client:
repo = client.repos.get("forgejo", "forgejo")
for issue in client.repos.issues.list("forgejo", "forgejo", state="open"):
print(f"#{issue.number} {issue.title}")- Complete: every operation in the Forgejo 16 API is callable, generated from a vendored spec.
- Typed: pydantic v2 models for every schema, annotations everywhere,
py.typed. - Dual:
Forgejo(sync) andAsyncForgejo(async) over httpx2, identical surfaces. - Ergonomic: resource namespaces (
client.repos.issues.create(...)), keyword arguments, lazyPaginated[T]lists, typed exceptions. - Reproducible: the generated surface is committed and CI fails on drift from the spec.
- Tested against a real forge: unit tests plus integration tests against a Forgejo container.
The documentation site lives at https://erdemhalil.github.io/forgejo-python/: getting started, guides, the generated API reference, and the engineering docs. It is versioned — stable tracks releases, dev tracks main.
In-repo references:
- Architecture — public surface, runtime behaviour, policies
- Code generation — how the spec becomes the surface
- Contributing — setup, checks, and PR expectations
MIT