-
Notifications
You must be signed in to change notification settings - Fork 19
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
716 updating pydantic version #721
Open
Antonyjin
wants to merge
104
commits into
main
Choose a base branch
from
716-updating-pydantic-version
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
Started the migration using the tool dump-pydantic. It only do some parts, but there are mch to do, not finished. Now, have to change and update manually.
Typing is more strict in pydantic v2
…dation support Validation was failing with Pydantic v2 due to stricter date formats and unhandled JSON errors. Adapted the exceptions so we handle format/validation with changes bringed by pydantic v2
The migration to Pydantic 2 bringed some warnings and deprecated funtions. Fixing them all manually
The return value for url was string but now pydantic is strict and need a good type Changing str to HttpUrl for url
…l_dump_json` In Pydantic v2, the `.json()` method has been replaced with `.model_dump_json()` for serializing json Updated the mock in `test_check_internet_wrong_result_code` to use `.model_dump_json` instead of `.json` to align with this change.
Pydantic 2 add more fields while returning error such as `url`, `ctx` or `input` Adapting the test to the new format given by pydantic
Adding a / with the url makes the url containing two slashes which break the url Removing it
Changed @root_validator to @model_validator(mode="after") for checking data after the model is created. Updated values to use a more flexible type for Pydantic v2. Accessed values as a dictionary (values["payload"]) instead of using values.payload.
…postponed annotations
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #721 +/- ##
==========================================
+ Coverage 63.33% 63.37% +0.03%
==========================================
Files 77 77
Lines 6854 6861 +7
Branches 576 577 +1
==========================================
+ Hits 4341 4348 +7
- Misses 2325 2326 +1
+ Partials 188 187 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
When adding a depedency inside the pyproject, we need to add it as well in the makefile.
bd06710
to
950d1cd
Compare
…leph-vm into 716-updating-pydantic-version
Previously, `os.makedirs` was called directly on variables like `MESSAGE_CACHE` or `CODE_CACHE`, which could be `None`. This caused issues with `mypy` and potential runtime errors since `os.makedirs` does not handle `None`. The fix ensures these variables are checked for `None` before calling `os.makedirs`, preventing invalid operations and aligning with type checks.
Previously, `os.makedirs` was called directly on variables like `MESSAGE_CACHE` or `CODE_CACHE`, which could be `None`. This caused issues with `mypy` and potential runtime errors since `os.makedirs` does not handle `None`. The fix ensures these variables are checked for `None` before calling `os.makedirs`, preventing invalid operations and aligning with type checks. fix: wrong name
f8ce889
to
d96e9ca
Compare
Replacing the function with TypeAdapter
4b5dfd5
to
631401e
Compare
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 need to be updated to v2
Jira tickets : ALEPH-150
Self proofreading checklist
Changes
Upgrading to pydantic 2.