Opinionated repository configuration and scaffolding for Frequenz projects.
Core stack: Python 3.11+, cookiecutter, nox, mkdocs, protobuf/gRPC.
Relevant history: Branch v0.x.x, Commit 6fb38df5.
src/frequenz/repo/config/: Main package; nox, mkdocs, pytest, setuptools, CLI helpers.cookiecutter/: Template sources, hooks, local extensions, migration logic.cookiecutter/{{cookiecutter.github_repo_name}}/: Embedded generated-repo skeleton.tests/: Unit tests plustests/integration/for template generation.tests_golden/: Reference outputs for integration tests; generated, do not edit directly.docs/: MkDocs source tree..github/: Workflows, issue templates, release-note templates.
- Template author workflow:
cookiecutter/,cookiecutter/migrate.py,tests/integration/test_cookiecutter_generation.py. - Generated scaffold files:
cookiecutter/{{cookiecutter.github_repo_name}}/. - Default nox behavior:
src/frequenz/repo/config/nox/default.py,nox/session.py. - Docs generation/versioning:
src/frequenz/repo/config/mkdocs/,docs/_scripts/,mkdocs.yml. - Template migrations:
cookiecutter/migrate.py,.github/cookiecutter-migrate.template.py. - Golden-test contract:
tests/integration/test_cookiecutter_generation.py,tests_golden/. - Release/CI policy:
.github/workflows/,RELEASE_NOTES.md,.github/RELEASE_NOTES.template.md.
RepositoryType:src/frequenz/repo/config/_core.py.GitHubActionsFormatter:src/frequenz/repo/config/github.py.CompileProto:src/frequenz/repo/config/setuptools/grpc_tools.py.get_sybil_arguments():src/frequenz/repo/config/pytest/examples.py.
- Header: License + copyright header required.
- Dataclasses: prefer
kw_only=True; usefrozen=Truefor immutables. - Functions: strict typing, Google-style docstrings, positional-only/keyword-only when useful.
- Tool config: prefer
pyproject.tomlas the canonical configuration source. - Versioning:
setuptools_scmmanaged; avoid manual version bumps. - Formatting: Black/isort, double quotes, 4 spaces in Python, 2 spaces in YAML/TOML/JSON.
RELEASE_NOTES.mdandcookiecutter/migrate.py: reset after a release from templates in.github/, consult the git history to match the style used in the past if you need to change them.- When this project changes,
cookiecutter/orsrc/, downstream projects are affected. Always add migration steps tocookiecutter/migrate.pywhen necessary.
- Do not edit
tests_golden/by hand. - Do not treat
cookiecutter/{{cookiecutter.github_repo_name}}/as the live repo root. - Do not bypass
cookiecutter/migrate.pywhen template changes affect existing repos. - Do not edit generated outputs under
build/orsite/as primary sources. - Do not bypass updating AGENTS.md files when changing structure or conventions.
- Do not bypass updating
docs/when changing public APIs or user-facing features. - Do not skip updating
cookiecutter/migrate.pywhen changes need to be propagated to existing generated repos. - Do not add generic repo-agnostic guidance.
- Telegraphic internal documentation style.
- Idempotent migrations via
migrate.pywithmanual_step()markers. - Template workflow splits naturally into template edit, golden update, migration result.
pip install -e .[dev]: Full dev environment.nox: Run full tests/checks (formatting, flake8, mypy, pylint, pytest).nox -s pytest_max: Full test suite.UPDATE_GOLDEN=1 pytest tests/integration/test_cookiecutter_generation.py::test_golden: Refresh golden fixtures.python3 cookiecutter/migrate.py: Validate migration logic.mkdocs build: Build docs locally.- Consult
CONTRIBUTING.mdfor full cookiecutter, docs, and release workflows.