nshconfig
nshconfig is a small lifecycle layer over Pydantic for typed, Python-first ML
configuration. Pydantic defines and validates the schema, and nshconfig
re-exports its authoring API for a single import. nshconfig adds explicit
mutable drafts, unbound parent-dependent templates, and declaration-ordered
Python interpolation.
import nshconfig as C
class Optimizer(C.Config):
learning_rate: float = 3e-4
class Run(C.Config):
optimizer: Optimizer
epochs: int
work = Run.config_draft()
work.optimizer.learning_rate = 1e-4
work.epochs = 100
run = work.config_finalize()
Calling Run(...) directly first performs ordinary Pydantic validation. A narrow
missing-parent interpolation failure produces an inert template that binds when
used in a concrete parent field; otherwise construction returns a final or raises
the original validation error. Drafts are explicit, mutable, and may be
incomplete. Finalization returns a fresh, field-frozen Pydantic model without
consuming the draft.
There is no configuration language, registry, loader, provenance subsystem, record format, or code-generation layer. The semantic design is the authority for lifecycle, ordering, and structural graph behavior.