-
Notifications
You must be signed in to change notification settings - Fork 15
Migrate from Pydantic V1 to V2 #293
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
Merged
Merged
Conversation
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
Failed to retrieve llama text: POST 504: 504 Gateway Time-outThe server didn't respond in time. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #293 +/- ##
==========================================
- Coverage 61.60% 60.51% -1.09%
==========================================
Files 18 18
Lines 3183 3199 +16
Branches 448 451 +3
==========================================
- Hits 1961 1936 -25
- Misses 984 1024 +40
- Partials 238 239 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Aleph-message and sdk now uses pydantic v2 but no released yet Using the github link atm and wait for the release.
When upgrading the pydantic version, some function are / will become deprecated. replacing them in those files.
Added `default=extended_json_encoder` to `json.dumps()` to handle serialization of non-native JSON types, such as dates and other complex objects. Replacing function that are / will be deprecated in pydantic v2 and v3
Pydantic>=2 is not compatible with fastapi<0.100.0
Conflit between pydantic and yamlfix black did not pass
With Pydantic v2, strict type validation is enforced. The type field is expected to have the exact value "POST" as a literal.
8f522ba
to
e621718
Compare
- Unused varible deleted
- Replacing parse_obj() by model_validate() - Replacing copy() by model_copy() - Replacing dict() by model_dump()
…cause of some changes on aleph_message Before any change, there were classes dedicated to the size of Ephemeral and Persistent class such as PersistentVolumeSizeMb and EphemeralVolumeSizeMb. Now, the size is included inside the classes EphemeralVolume and PersistentVolume so have to access the size by another method. - Creating a function to get the max and min size, that way it is more rigorous - Calling this function to get max and min size of the different volumes
- Refactor the Dict() class inside the mocks test file to allow any key-value pair to be passed to the model.
Arnaud made some changes about getting hashes that were better but I deleted by mistakes Putting back his code
nesitor
reviewed
Apr 9, 2025
Reverting changes about accessing data of PersistentVolumeSizeMib and EphemeralVolumeSize - creating a function to access annotated type because we can no longer do Persistent.le to get the data
… get the annotation rules.
nesitor
approved these changes
Apr 11, 2025
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.
This issue aims to upgrade the pydantic version to v2.
Related Jira tickets : ALEPH-149
Self proofreading checklist
Changes
Many functions will be deprecated using pydantic v2 and completly unusable when using pydantic v3. So all of them have been replaced with the good ones.
How to test
hatch run testing-test-cov
Notes
At the moment, aleph-message and aleph-sdk-python version use the github link. We need to wait the release of these two repositories and then put the right version instead of the github URL