Skip to content

feat(core): add config loader and Jinja2 template renderer - #5

Merged
gerfru merged 2 commits into
mainfrom
feat/python-core
Jul 4, 2026
Merged

feat(core): add config loader and Jinja2 template renderer#5
gerfru merged 2 commits into
mainfrom
feat/python-core

Conversation

@gerfru

@gerfru gerfru commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • src/core/config.py: Pydantic models for all core.yaml sections + load_config() that deep-merges core + overlay YAML and validates the result
  • src/core/renderer.py: render_template() renders any .md.j2 with StrictUndefined (fails fast on missing variables)
  • adapters/__init__.py stubs for selfhosted / atlassian / m365 (content in next PR)
  • tests/test_config.py: validates core.yaml structure — clause refs, KPI fields, CAPA state machine
  • tests/test_renderer.py: renders policy, procedure, CAPA form with mock config

Test plan

  • CI passes (mypy, pytest, ruff)
  • All test_config assertions pass against current core.yaml
  • All test_renderer assertions pass against current templates

Generated with Claude Code

gerfru and others added 2 commits July 4, 2026 19:39
src/core/config.py:
- Pydantic models for all core.yaml sections (Organisation, Role, Clause,
  Document, RecordType, KPI, CapaState, CoreConfig)
- _deep_merge() for core + overlay YAML
- load_config() validates the merged result with CoreConfig.model_validate()

src/core/renderer.py:
- build_context() maps CoreConfig fields to Jinja2 template variables
- render_template() renders any .md.j2 with StrictUndefined (fails fast on
  missing variables)

tests/test_config.py: validates core.yaml structure (clause refs, KPI fields,
CAPA state machine transitions)
tests/test_renderer.py: renders policy, procedure, and CAPA form with a mock
config, asserts key content

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove extra blank line in config.py import block (I001)
- Drop unused pytest/CoreConfig/load_config imports in tests (F401)
- Replace autoescape=False with select_autoescape() in renderer (B701)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gerfru
gerfru merged commit dd70fe0 into main Jul 4, 2026
6 checks passed
@gerfru
gerfru deleted the feat/python-core branch July 4, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant