- Lint:
uv run ruff check src/ tests/ - Format:
uv run ruff format src/ tests/ - Test:
uv run pytest tests/ -v - Type check:
uv run ty - Docs:
uv run mkdocs build --strict - All checks before commit:
uv run ruff format src/ tests/ && uv run ruff check src/ tests/ && uv run pytest tests/ -v
Use uv for everything. Never use pip or venv directly.
src/tollkeeper/— library source (hatchling src layout)core.py— Tollkeeper entry point, TollkeeperSession state machine, CheckReport, AuditFailedErrorbackends/— Backend ABC (base.py), CsvBackend, IcebergBackend (stub)checks/— BaseCheck ABC, CheckResult, Polars DQ checkssignals/— SignalStore ABC, SqliteSignalStore, DbApiSignalStore
tests/— pytest suite, mirrors source modules (test_core.py,test_csv_backend.py, etc.)docs/— mkdocs-material source
- Fluent API:
Tollkeeper(backend).table(t).write(fn).audit(checks).publish() - TollkeeperSession is a state machine. Transitions: created → written → audited → published/rolled-back.
publish()androllback()are terminal, idempotent, mutually exclusive. Respect_publishedand_rolled_backflags. - Backend ABC is the extension point for storage. Do not add storage logic to
core.py. - BaseCheck ABC is the extension point for DQ. Each check implements
run(version_ref) -> CheckResult. - SignalStore is optional. All signal store code in
core.pyis guarded byif self._signal_store. - No Airflow imports in this package. Airflow integration is a separate package (Phase 2).
- Python ≥3.11. Use
X | None,list[T],from __future__ import annotations. - Type hints on all functions.
TYPE_CHECKINGguard for annotation-only imports. - Ruff line length: 120.
- Comments only when the why is non-obvious.
- Every bug fix and feature needs tests. TDD preferred.
- Use in-memory fakes (e.g.
FakeBackend), not mocks. - Test files:
tests/test_<module>.py. - Coverage must stay ≥80% (currently ~96%).
- Run the full suite before committing.
- Default branch:
develop(notmain). - PRs target
develop. Feature branches:feature/<name>. Bug fixes:fix/<name>. - CI: ruff lint, ruff format, pytest (3.11/3.12/3.13), mkdocs build --strict.
- Do not add dependencies for what a few lines can do.
- Do not add abstractions without a second consumer.
- Do not remove or weaken tests to make CI pass.
- Do not commit to
developdirectly; always use a PR. - Do not add
Generated by/Co-Authored-By: Claudetrailers.