Summary
Convert ModelCoreOptions (L27 in model_core.py) from a mutable dataclass to a Pydantic BaseModel.
Motivation
ModelCoreOptions groups optional constructor parameters for ModelCore. Validation currently lives in ModelCore.__init__ (L89–172):
axis_names length must match state rank
other_axes entries must be non-negative
dtype must be a valid NumPy dtype
Moving these checks into the options model catches invalid configurations before they reach ModelCore, producing clearer error messages.
Scope
- Convert
ModelCoreOptions → Pydantic BaseModel (frozen or not — TBD based on usage)
- Add field validators for
axis_names/axis_coords consistency, other_axes non-negative, dtype coercion
- Simplify
ModelCore.__init__ by delegating validation to options
- Update tests
Constraints
Related
Summary
Convert
ModelCoreOptions(L27 inmodel_core.py) from a mutable dataclass to a PydanticBaseModel.Motivation
ModelCoreOptionsgroups optional constructor parameters forModelCore. Validation currently lives inModelCore.__init__(L89–172):axis_nameslength must match state rankother_axesentries must be non-negativedtypemust be a valid NumPy dtypeMoving these checks into the options model catches invalid configurations before they reach
ModelCore, producing clearer error messages.Scope
ModelCoreOptions→ PydanticBaseModel(frozen or not — TBD based on usage)axis_names/axis_coordsconsistency,other_axesnon-negative,dtypecoercionModelCore.__init__by delegating validation to optionsConstraints
xpfield (array backend) must remainobjecttyped for forward compatibility with GPU backends (Protocol-first backend abstraction for swappable solver backends #26)ruff check --previewandmypy --strictRelated
RunConfigand nested config dataclasses #52 (Pydantic-ify RunConfig)DiffusionConfigandGridGeometry#53 (Pydantic-ify DiffusionConfig)xpfield)