Skip to content

Stage 1.7: Config — build the pydantic-settings stack in parallel #452

Description

@jepegit

Part of Stage 1 — behavior-preserving construction (see the Stage-1 tracking issue). Stage 0: #439. Plan documents live in the shared workspace: cellpy-workspace/architecture-plan/ (the architecture-plan repo; formerly architecture-plan/) (alongside the cellpy and cellpy-core repos). Everything in Stage 1 lands on master with the full suite green; nothing flips user-visible behavior.

Goal

Config plan Step 2: the cellpy/config/ package built next to the old system, nothing
importing it yet — models mirroring today's sections (paths, file_names, reader,
db, batch, instruments as typed models, defaults (ScienceDefaults, values in
cellpy units by convention), units (new, validated against
cellpycore.units.CellpyUnits keys), secrets (SecretStr, env-only)); layered loader
(defaults → user cellpy.toml via platformdirs → project-local walk-up → env/.env →
runtime); provenance (sources()); YAML→TOML converter; override() context manager +
isolated_config pytest fixture.

Why

The parallel build is what makes the Step-3 swap a flag-day with a small diff. The
inventory parity test from #430 asserts new defaults == old, field by field — including
deliberate fixes surfaced by validation (the limit_loaded_cycles int-vs-list lie gets a
proper union type here). The units: section is the home the unit plan's Phase 5
depends on (config plan §3.2, added in the 2026-07-09 cross-check).

Links

Acceptance

  • Parity test green: every (section, field, default) triple matches or carries a
    documented, deliberate divergence note.
  • override() fixture demonstrated in one test; provenance answers "where did this
    value come from" for all four layers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cellpy2-stage1cellpy 2 Stage 1: behavior-preserving construction

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions