Skip to content

Pydantic-ify ModelCoreOptions #54

@jc-macdonald

Description

@jc-macdonald

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

Metadata

Metadata

Assignees

Labels

architectureStructural or design-level changesrefactorCode reorganization without behavior change

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions