Skip to content

Update pydantic to 2.12#338

Merged
sveinse merged 5 commits intocustom-components:masterfrom
steinmn:pydantic-2.12
Oct 12, 2025
Merged

Update pydantic to 2.12#338
sveinse merged 5 commits intocustom-components:masterfrom
steinmn:pydantic-2.12

Conversation

@steinmn
Copy link
Contributor

@steinmn steinmn commented Oct 8, 2025

Fixes #337

  • Step 1: Ensure full test coverage of validate.py (when including login credentials)
  • Step 2: Update Pydantic to 2.12
  • Step 3: Fix breaking changes
  • Step 4: Expand test_validate.py to include more real(ish) input data
  • Step 5: Expand documentation in comments and/or DEVELOPMENT.md

@steinmn steinmn marked this pull request as ready for review October 9, 2025 21:04
Copy link
Collaborator

@sveinse sveinse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a minor comment

Comment on lines +119 to +122
CHARGER_FIRMWARES = TypeAdapter(list[ChargerFirmware])
CHARGER_STATES = TypeAdapter(list[ChargerState])
CHARGER_UPDATES = TypeAdapter(dict[str, str])
CONSTANTS = TypeAdapter(dict[str, Any])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? Because of the lint recommendation that top-level variables are named in upper case, or something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that it's now an instance instead of a class, PascalCase didn't seem right to me, and it also seemed like a good idea to have a visual distinction between the two in the URLS-map. I don't remember if ruff complained about this, really just a personal preference, and I probably won't be hard to convince if you prefer a different case.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good practice to do so, but the reasoning to why weren't immediately clear to me. I'm good as this is now.

@sveinse sveinse merged commit 83514ce into custom-components:master Oct 12, 2025
6 checks passed
@steinmn steinmn deleted the pydantic-2.12 branch October 12, 2025 12:58
@sveinse sveinse added this to the v0.8.4 milestone Oct 12, 2025
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.

Update pydantic to 2.12, actually perform validation, and prepare for 0.8.4-release

2 participants