Skip to content
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

Antonyjin upgrade pydantic version #293

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Antonyjin
Copy link
Member

@Antonyjin Antonyjin commented Oct 21, 2024

This issue aims to upgrade the pydantic version to v2.

Related Jira tickets : ALEPH-149

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.

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

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
@Antonyjin Antonyjin linked an issue Oct 21, 2024 that may be closed by this pull request
@Antonyjin Antonyjin marked this pull request as draft October 21, 2024 15:44
Copy link

Failed to retrieve llama text: POST 504:

504 Gateway Time-out


The server didn't respond in time.

Pydantic>=2 is not compatible with fastapi<0.100.0
Copy link

codecov bot commented Oct 25, 2024

Codecov Report

Attention: Patch coverage is 42.30769% with 15 lines in your changes missing coverage. Please review.

Project coverage is 39.83%. Comparing base (b3d00dc) to head (c5788ec).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
src/aleph_client/commands/message.py 55.55% 4 Missing ⚠️
src/aleph_client/commands/program.py 0.00% 4 Missing ⚠️
src/aleph_client/commands/files.py 25.00% 3 Missing ⚠️
src/aleph_client/commands/instance/__init__.py 33.33% 2 Missing ⚠️
src/aleph_client/commands/aggregate.py 0.00% 1 Missing ⚠️
src/aleph_client/commands/utils.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #293   +/-   ##
=======================================
  Coverage   39.82%   39.83%           
=======================================
  Files          18       18           
  Lines        2117     2119    +2     
  Branches      257      257           
=======================================
+ Hits          843      844    +1     
- Misses       1222     1223    +1     
  Partials       52       52           

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

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.
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.

Upgrade pydantic version
1 participant