neofoam.framework.initialization.staged.spec

Immutable spec + builder for the 3-stage init pipeline.

StagedInitSpec is the frozen description of one solver’s load → resolve → build pipeline (callbacks only, no state). StagedInitSpecBuilder collects those callbacks via decorators and produces a StagedInitSpec on finalize(). Execution lives in runner.

Note: this *Spec is per-solver-instance pipeline registration. It is distinct from the long-lived ModelSpec / SolverSpec types that declare what a solver is.

class neofoam.framework.initialization.staged.spec.LoadResult(core_models: list[Any], optional_models: list[Any])[source]

Bases: object

Outcome of the LOAD stage: core and optional model objects.

validate() list[Any][source]

Validate all model configs and return a list of errors.

class neofoam.framework.initialization.staged.spec.StagedInitSpec(name: str, load_fn: Callable[[], LoadResult] | None = None, resolve_fn: Callable[[ConfigContext], None] | None = None, build_fn: Callable[[list[Any], list[Any]], list[InitStep]] | None = None)[source]

Bases: object

Immutable pipeline description ready to hand to a StagedInitRunner.

classmethod build(name: str) StagedInitSpecBuilder[source]

Start a fluent registration of the three stages.

class neofoam.framework.initialization.staged.spec.StagedInitSpecBuilder(name: str)[source]

Bases: object

Decorator-driven registration of a StagedInitSpec.

Each decorator returns self so the resulting function reference is preserved on the user’s side (the decorator pattern stays familiar).