Development Guidelines
The rules a change to this repository follows. How to set up, run and test the stack is in CONTRIBUTING.md, and the conventions, with the reasons for them, are in CLAUDE.md.
Python
- Write for Python 3.11, with type annotations.
- Use Pydantic v2:
field_validator,model_validator,ConfigDict, andBaseSettingsfrompydantic_settings. -
Import application code by its full path, rooted at
backend.app:from backend.app.models.metrics.metric import RawMetric. Never root an import atapp: Python loadsapp.models.metrics.metricas a different module frombackend.app.models.metrics.metric, with different classes. This search finds such an import, and prints nothing when there is none: -
A new core model's module goes in
CORE_MODEL_MODULESinbackend/app/models/__init__.py, whichregister_core_models()imports.
Lint and format
- Ruff formats and lints the Python and sorts its imports; its configuration is
[tool.ruff]inpyproject.toml. Do not add black, isort or flake8 back. make formatformats and fixes the Python in place.make lintruns what thelintcheck runs.- CI, the pre-commit hook and the virtual environment install the same ruff version.
Pull requests
- Write the title as a conventional commit,
type(optional scope): description, withtypeone offeat fix perf deps docs build ci refactor test chore revert style. Theconventional-titlecheck refuses any other title. - Sign off every commit and add a regression test to every bug fix:
CONTRIBUTING.mdand the Testing Guide say how.