Skip to content

Conversation

@srivarra
Copy link
Contributor

@srivarra srivarra commented Dec 12, 2025

Using the Pydantic V2 API instead of the v1 compatibility namespace (pydantic.v1)

Resources

waveorder/cli/settings.py

  1. MyBaseModel: Removed extra=Extra.forbid from inheritance, use model_config = ConfigDict(extra="forbid")
  2. Model validators: Changed @model_validator(mode="after") from cls, valuesself, use self.field instead of values.get("field"), return self
  3. Field validators: Converted validators accessing other fields to @model_validator(mode="after") (e.g., na_det, warn_unit_consistency). Basically the changes make pydantic models more "dataclassy" instead of more "dictionary-y(?)"

Added a few type hints as well for the individual models where I ran into them, might not be exhaustive.

@srivarra srivarra linked an issue Dec 12, 2025 that may be closed by this pull request
@srivarra srivarra marked this pull request as ready for review December 12, 2025 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use pydantic V2 models

2 participants