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

Migrate to pydantic v2 #182

Merged
merged 21 commits into from
Mar 7, 2024
Merged

Migrate to pydantic v2 #182

merged 21 commits into from
Mar 7, 2024

Conversation

CasperWA
Copy link
Collaborator

Closes #163

Still not done - needs more work
Update everything to the pydantic v2 way, meaning use classmethods
__get_pydantic_core_schema__ and __get_pydantic_json_schema__,
drastically minimizing the class, but also making it a bit more opaque.

Use model_copy() instead of copy().

Remove dependency on sessions containing Python objects - rely only on
pure JSON types in the session object.
What it does (recursively dump all models as dicts) is the default
behaviour in pydantic v2 now, so there is no need for this
functionality.
@codecov-commenter
Copy link

codecov-commenter commented Nov 11, 2023

Codecov Report

Attention: Patch coverage is 72.85714% with 57 lines in your changes are missing coverage. Please review.

Project coverage is 74.31%. Comparing base (5cae62f) to head (df6b7e7).

Files Patch % Lines
oteapi_optimade/dlite/parse.py 35.13% 24 Missing ⚠️
oteapi_optimade/models/custom_types.py 82.89% 13 Missing ⚠️
oteapi_optimade/strategies/resource.py 43.47% 13 Missing ⚠️
oteapi_optimade/strategies/parse.py 50.00% 3 Missing ⚠️
oteapi_optimade/models/config.py 87.50% 2 Missing ⚠️
oteapi_optimade/strategies/filter.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #182      +/-   ##
==========================================
+ Coverage   74.04%   74.31%   +0.27%     
==========================================
  Files          15       14       -1     
  Lines         628      549      -79     
==========================================
- Hits          465      408      -57     
+ Misses        163      141      -22     
Flag Coverage Δ
local 74.31% <72.85%> (+0.27%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

It was found to be necessary when used in certain core OTEAPI
strategies.
It may be relevant to have all the pydantic_core.Url properties readily
available.

Also, make the OPTIMADE accessUrl further variable by making the host a
changeable environment variable (OPTIMADE_HOST).
@CasperWA CasperWA marked this pull request as ready for review March 7, 2024 12:38
@CasperWA CasperWA merged commit 98b0789 into main Mar 7, 2024
12 of 13 checks passed
@CasperWA CasperWA deleted the cwa/close-163-migrate-to-pydantic-v2 branch March 7, 2024 12:41
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.

Migrate to pydantic v2
2 participants