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

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

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.61%. Comparing base (d6def2a) to head (11d7c21).

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.60%   39.61%           
=======================================
  Files          18       18           
  Lines        2164     2166    +2     
  Branches      266      266           
=======================================
+ Hits          857      858    +1     
- Misses       1254     1255    +1     
  Partials       53       53           

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

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.
@Antonyjin Antonyjin force-pushed the antonyjin-upgrade-pydantic-version branch from 8f522ba to e621718 Compare December 2, 2024 17:20
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