Code Style¶
Automated tools¶
All style rules are enforced by CI and run with make check:
| Tool | Purpose | Config |
|---|---|---|
ruff check |
Linting (pyflakes, pycodestyle, isort, bugbear, …) | pyproject.toml [tool.ruff] |
ruff format |
Code formatting | pyproject.toml [tool.ruff.format] |
mypy --strict |
Type checking | pyproject.toml [tool.mypy] |
bandit |
Security SAST | tox security env |
Bash
make fmt # auto-format with ruff
make lint # lint without fixing
make type # mypy strict
make check # all three
Key conventions¶
- Line length: 100 characters
- Quotes: Double quotes (ruff format default)
- Docstrings: Google style (
Args:,Returns:,Raises:) - Type annotations: Full
Annotated[...]style; no bareAnyin public API - Imports:
TYPE_CHECKINGguard for types only used in annotations
Commit messages¶
Types: feat, fix, docs, refactor, test, chore, ci, perf
Examples:
Text Only
feat(isolation): add HybridIsolationProvider
fix(middleware): use reset(token) instead of clear() in finally block
docs(guides): add JWT resolution guide
test(storage): add bulk_update_status integration tests
Pull request checklist¶
-
make checkpasses (lint + type + security) -
make testpasses (unit tests) - New code has docstrings (Google style)
- Public API changes are reflected in
docs/ -
CHANGELOG.mdupdated under[Unreleased] - Coverage stays ≥ 95%