002. Python development practices¶
- Status: accepted
- Date: 2026-11-27
Context¶
I follow the practices taught in my Python course (portal-python): src layout, a lockfile,
development tools in dependency groups, ruff with a curated rule set, mypy strict, a coverage
floor, dependency and secret scanning, loggers in libraries, no silent except.
Decision¶
- Dev and docs tools live in
[dependency-groups];uv.lockis committed and CI installs withuv sync --locked. Published extras (runtime,openai, ...) stay extras. - Ruff selects
E F W I N A B C90 D UP SIM RUF S PT, max complexity 10, Google docstrings. Ruff and mypy are pinned to the same versions in the dev group and in pre-commit. - mypy strict plus
warn_unreachableand thetruthy-bool,ignore-without-codeandredundant-exprerror codes. - Coverage floor of 88% (measured 91% branch coverage on 2026-11-27), enforced in the CI job that has the runtime extra installed.
- CI runs
pip-auditon the locked dependencies and gitleaks; pre-commit runs gitleaks too. - The library only creates loggers (
logging.getLogger(__name__)) and attaches aNullHandlertoaeon. Broadexcept Exceptionexists only at fail-safe boundaries (gate, audit writer, MCP loop, CLI) and always counts and logs the error.
Deviations from the course, kept on purpose¶
- Python 3.10+ is supported, so PEP 695 syntax is not used.
- The core has no third-party dependencies (no pydantic, httpx, tenacity), and the CLI uses argparse.
- The version comes from
src/aeon/_version.pythrough hatch, still a single source. - Exception names such as
ActionBlocked,ToolTimeoutandRateLimitedkeep their public names without anErrorsuffix (ruff N818 ignored): they name events the caller handles.