Refactor/upgrade pydantic to v2#107
Open
georgeRobertson2 wants to merge 12 commits into
Open
Conversation
deal with typing issue on get_type_hints generated from bumping from 3.11 to 3.12
removed previous typing fix as pydantic upgrade fixes the typing issues in 3.12
…engine into build/python_312_upgrade
…dation-engine into refactor/upgrade_pydantic_to_v2
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Pydantic Changes:
BaseModel:
Field:
Pydantic Config:
e.g. model_config = {...} OR ConfigDict()
Config(now model_config) depreciatedPydantic Validators:
@validatornowmode. E.g. pre=True -> mode="before"@validatorno longer required, recommended to delete and no issue@validatorand @root_validator depreciated and you now define within the Field with validate_default argPydantic Types:
if value is None: return valueirrelevant as the handler performs the check on the datatype based on whether the model allows optional or not.= NonedefaultSpecifc DVE changes:
Auditing:
get_polars_type_from_annotationrather than using PYTHON_TYPE_TO_POLARS_TYPE map as the FieldInfo object needs to be evaluated into a Polars typeis_field_complex()functionDomain Types (custom types):
locargument removed as it can no longer be supplied with the way pydantic v2 validations are writtenfunction wrapper:
FieldSpecification:
Fixes post 23/05/26: