This document contains critical information about working with this codebase. Follow these guidelines precisely.
-
Package Management
- ONLY use uv, NEVER pip
- Installation:
uv add package - Upgrading:
uv add --dev package --upgrade-package package - FORBIDDEN:
uv pip install,@latestsyntax, editinguv.lockby hand
-
Code Quality
- Type hints required for all code
- Imports used only in type annotations go under
if TYPE_CHECKING:withfrom __future__ import annotationsat the top of the module (RuffTCrules) - Follow existing patterns exactly
- Use Google style for docstring
-
Testing Requirements
- Framework:
uv run --frozen pytest(runs in parallel; use-n 0for--pdb) - Coverage: test edge cases and errors
- Coverage report:
uv run --frozen pytest --cov(CI fails below 80% branch coverage ofsrc/) - New features require tests
- Bug fixes require regression tests
- Framework:
-
Git
- Follow the Conventional Commits style on commit messages.
- NEVER use
git commit --no-verify; fix what the hooks report instead.
-
Running
- Application:
uv run Python-Project-Template(orpython -m my_package)
- Application:
- Ruff
- Format:
uv run --frozen ruff format . - Check:
uv run --frozen ruff check . - Fix:
uv run --frozen ruff check . --fix
- Format:
- Type Check
- Check:
uv run --frozen ty check
- Check:
- Git Hooks (prek)
- Config:
.pre-commit-config.yaml - Install:
uv run prek install - Runs: on git commit
- Tools: uv lock, Ruff, ty
- Config:
- Agent Hooks
.agents/hooks/format-python.shformats and lints every Python file right after Claude Code or Codex edits it (wired in.claude/settings.jsonand.codex/hooks.json). Do not re-run the formatter manually after edits.