-
Notifications
You must be signed in to change notification settings - Fork 18
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
94
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 62.50% 62.45% -0.05%
==========================================
Files 70 70
Lines 6232 6246 +14
Branches 506 515 +9
==========================================
+ Hits 3895 3901 +6
- Misses 2179 2180 +1
- Partials 158 165 +7 ☔ View full report in Codecov by Sentry. |
When adding a depedency inside the pyproject, we need to add it as well in the makefile.
- Improved error handling in `get_signed_pubkey` to align with stricter JSON validation and date format requirements in Pydantic v2. - Addressed warnings and deprecated functions raised during the migration to Pydantic v2. - Updated type annotations to comply with Pydantic's stricter type checks (`url` now requires proper type validation). - Refactored test mocks to use `.model_dump_json()` instead of `.json()` for serialization - Adjusted test cases to account for new fields in validation errors (`url`, `ctx`, and `input`) introduced in Pydantic v2. - Applied linting for style consistency across tests and codebase. fix: yamlfix and pydantic are incompatible Fix: HttpUrl no longer need scheme value
Remove the counter way to assign a vm_id as it didn't work reliably Jira ticket: ALEPH-272 That method was broken when persitent instances were loaded at start up. Since the "new" feature that allow persistent instance across aleph-vm reboot if one was started then aleph-vm was stopped and restarted the counter method could reassign the ip and break the existing vm's. Secundary reason was that the feature wasn't working properly with the default settings, as `2**available_bits` returned 1. So that code path was only used if the node owner tweaked some undocumented settings making it hard to identify and debug in prod nodes.
* Feature: Implement new EVM chains. * FIX: Update Makefile with new dependency. * Fix: Updated to proper released package version of aleph_message dependency. --------- Co-authored-by: Andres D. Molins <[email protected]>
* Feature: allow IPv6 DNS Problem IPv6 DNS were automatically filtered when detected from resolvectl Solution: Nameservers are now split into ipv4 and ipv6 and can be passed to the VM accordingly At the moment we pass them if the ipv6 parameter is present on the tap interface but we need a more robust detection method * Display proper env conf
Symptom: The CustomError from the diagnostics VM was printed even if if IGNORE_TRACEBACK_FROM_DIAGNOSTICS was set to True (the default) Analysis: This was caused by the refactoring of the fastapi_example/main.py file done in fe9235a Which changed the output used to detect the error to catch Solution: Fix detection string
Jira ticket: ALEPH-298 some CRN failed on any action with error OSError: [Errno 24] Too many open files: Solution: Properly close stream to journald when the VM is stopped
Add a check for dependencies update
Pydantic's validation system now enforces strict checks, we cannot leave fields marked as required empty
Antonyjin
force-pushed
the
716-updating-pydantic-version
branch
from
November 19, 2024 11:51
90f4b27
to
907cd6d
Compare
- Updated the display() method to use self.model_config.env_prefix instead of self.Config.env_prefix. The previous implementation caused an AttributeError because Config is no longer supported in Pydantic v2. Adjusted the method to align with the new Pydantic v2 configuration approach, which uses model_config for settings validation and customization.
Antonyjin
force-pushed
the
716-updating-pydantic-version
branch
from
November 19, 2024 12:03
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
Antonyjin
force-pushed
the
716-updating-pydantic-version
branch
from
November 22, 2024 17:28
f8ce889
to
d96e9ca
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.