Contributing¶
Thanks for helping. This page covers the setup, the checks every change has to pass, and how changes are reviewed and released.
Setup¶
You need uv and just, and Docker for the tests of the Redis store, which run against real Redis and Valkey servers.
To run the checks on every commit, install the git hooks with prek install
or pre-commit install.
Checks¶
| Command | What it does |
|---|---|
just fmt |
Formats the code and applies safe lint fixes |
just lint |
Lints without changing files |
just types |
Type-checks with pyright and mypy, both in strict mode |
just services |
Starts the Redis and Valkey servers the tests use |
just test |
Runs the tests; extra arguments go to pytest |
just cov |
Runs the tests under the 100% branch coverage gate |
just docs |
Builds the documentation in strict mode |
just build |
Builds the sdist and wheel and checks them |
just check |
Runs everything CI gates on |
Standards¶
- Tests come first. Write the failing test, watch it fail, then make it pass.
- Coverage stays at 100%, counting branches.
- Types are part of the API. A change to a public signature needs a case in
tests/typing/. - Public names have docstrings in Google style; they become the API reference.
- No new runtime dependencies without an issue agreeing to it first. Starlette is the only required one. Anything else is an optional extra, imported only by the module that needs it.
- No fakes for Redis. The Redis store is tested against the servers that
just servicesstarts. Tests use their own key prefix and never flush a database. - No global state. Configuration lives on instances you create and pass in.
- asyncio, not anyio. Timeouts, locks and tasks come from the standard library.
- The docs only show code that a test runs. A Python block on a docs page
holds nothing but an include from
examples/ortests/. To show something new, add it to an example, mark the section, and test it intests/examples/. - The README's examples run.
tests/test_docs.pyexecutes each one, and the quickstart isexamples/quickstart.pycopied exactly.
Commits and releases¶
Commit messages and pull request titles follow
Conventional Commits, for example
feat: add token bucket algorithm or fix: honour retry-after on fallback.
Releases and the changelog are generated from them, so there is no changelog
file to edit by hand.
Security¶
Please do not open a public issue for a vulnerability. See the security policy.