-
Notifications
You must be signed in to change notification settings - Fork 195
Pydantic v2 #1197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Pydantic v2 #1197
Conversation
| use_enum_values = True | ||
| underscore_attrs_are_private = True | ||
| json_encoders = {InputCombination: lambda v: v.json_key()} | ||
| Cfg = ConfigDict( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mypy] reported by reviewdog 🐶
error: Extra key "underscore_attrs_are_private" for TypedDict "ConfigDict" [typeddict-unknown-key]
|
|
||
| class ImmutableCfg(Cfg): | ||
| allow_mutation = False | ||
| ImmutableCfg = ConfigDict( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mypy] reported by reviewdog 🐶
error: Extra key "allow_mutation" for TypedDict "ConfigDict" [typeddict-unknown-key]
|
|
||
| if output_type != EV_KEY and output_code is not None and not output_symbol: | ||
| values["mapping_type"] = MappingType.ANALOG.value | ||
| self.mapping_type = MappingType.ANALOG.value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mypy] reported by reviewdog 🐶
error: Incompatible types in assignment (expression has type "str", variable has type "MappingType | None") [assignment]
|
|
||
| if output_type is None and output_code is None and output_symbol: | ||
| values["mapping_type"] = MappingType.KEY_MACRO.value | ||
| self.mapping_type = MappingType.KEY_MACRO.value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mypy] reported by reviewdog 🐶
error: Incompatible types in assignment (expression has type "str", variable has type "MappingType | None") [assignment]
| values["mapping_type"] = MappingType.KEY_MACRO.value | ||
|
|
||
| return values | ||
| self.mapping_type = MappingType.KEY_MACRO.value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mypy] reported by reviewdog 🐶
error: Incompatible types in assignment (expression has type "str", variable has type "MappingType | None") [assignment]
| @root_validator | ||
| def validate_output_symbol_variant(cls, values): | ||
| @model_validator(mode="after") | ||
| def validate_output_symbol_variant(self) -> Self: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mypy] reported by reviewdog 🐶
error: Name "Self" is not defined [name-defined]
| return self | ||
|
|
||
| @model_validator(mode="after") | ||
| def validate_output_integrity(self) -> Self: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mypy] reported by reviewdog 🐶
error: Name "Self" is not defined [name-defined]
| return self | ||
|
|
||
| @model_validator(mode="after") | ||
| def output_matches_input(self) -> Self: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mypy] reported by reviewdog 🐶
error: Name "Self" is not defined [name-defined]
|
python3-pydantic-core is not available in ubuntu 24.04 LTS. 24.04 still has pydantic v1. I don't think I want to stop supporting 24.04 yet, and therefore want to delay the switch to pydantic v2. Python 3.15 will be released on 2026-10-01 or something (https://peps.python.org/pep-0790/), so in about a year. It remains to be seen if pydantic v1 breaks with that release for input-remapper. |
v1 is not completely compatible with 3.14, and might break soon.
It seems for now this is not critical for input-remapper. Fedora users have reported that it works with that other recent fix.