Skip to content

Migrate Pydantic V1 to V2 #791

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 4 commits into from
Apr 9, 2025
Merged

Conversation

nesitor
Copy link
Member

@nesitor nesitor commented Apr 8, 2025

Feature: Migrate Pydantic V1 to V2.

Self proofreading checklist

  • The new code clear, easy to read and well commented.
  • New code does not duplicate the functions of builtin or popular libraries.
  • An LLM was used to review the new code and look for simplifications.
  • New classes and functions contain docstrings explaining what they provide.
  • All new code is covered by relevant tests.
  • Documentation has been updated regarding these changes.
  • Dependencies update in the project.toml have been mirrored in the Debian package build script packaging/Makefile

Changes

  1. We updated model validation in operator.py to use model_validate instead of parse_obj
  2. We fixed json methods in resources.py and configuration.py to use model_dump_json instead of json
  3. We updated the import from pydantic.json to pydantic_core in models.py
  4. We fixed the display method in conf.py to use model_config directly

How to test

Deploy that version on the staging CRNs and ensure that everything is working well.

@nesitor nesitor requested a review from olethanh April 8, 2025 11:04
@nesitor nesitor self-assigned this Apr 8, 2025
@nesitor nesitor force-pushed the andres-feature-migrate_pydantic_v1_to_v2 branch 2 times, most recently from 78fa940 to 43dd1a1 Compare April 8, 2025 11:24
Copy link

codecov bot commented Apr 8, 2025

Codecov Report

Attention: Patch coverage is 87.37864% with 13 lines in your changes missing coverage. Please review.

Project coverage is 64.56%. Comparing base (21a696d) to head (37aad72).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/aleph/vm/orchestrator/views/authentication.py 94.59% 1 Missing and 1 partial ⚠️
src/aleph/vm/storage.py 66.66% 2 Missing ⚠️
src/aleph/vm/conf.py 93.33% 1 Missing ⚠️
src/aleph/vm/models.py 0.00% 1 Missing ⚠️
src/aleph/vm/orchestrator/reactor.py 0.00% 1 Missing ⚠️
src/aleph/vm/orchestrator/run.py 50.00% 1 Missing ⚠️
src/aleph/vm/orchestrator/tasks.py 0.00% 1 Missing ⚠️
src/aleph/vm/orchestrator/views/__init__.py 66.66% 1 Missing ⚠️
src/aleph/vm/orchestrator/views/operator.py 0.00% 1 Missing ⚠️
src/aleph/vm/pool.py 50.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #791      +/-   ##
==========================================
+ Coverage   64.54%   64.56%   +0.02%     
==========================================
  Files          78       78              
  Lines        7087     7092       +5     
  Branches      597      598       +1     
==========================================
+ Hits         4574     4579       +5     
- Misses       2312     2313       +1     
+ Partials      201      200       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nesitor nesitor force-pushed the andres-feature-migrate_pydantic_v1_to_v2 branch 3 times, most recently from 4e28ff8 to dd70a80 Compare April 8, 2025 12:32
@nesitor nesitor force-pushed the andres-feature-migrate_pydantic_v1_to_v2 branch from dd70a80 to 81acfab Compare April 8, 2025 14:48
@olethanh olethanh merged commit 1a431ea into main Apr 9, 2025
36 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants