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

Add support for Pydantic 2 #440

Merged
merged 15 commits into from
Sep 28, 2023
Merged

Conversation

Andrew-S-Rosen
Copy link
Member

@Andrew-S-Rosen Andrew-S-Rosen commented Sep 27, 2023

@utf: As you likely saw, Pydantic 2 introduced many new features and changes. In an effort to support Pydantic 2, much of the MP software stack has now been modified accordingly. With maggma, emmet, and monty now supporting Pydantic 2, I have updated Jobflow to match.

Tagging @munrojm who initiated this switch for the rest of the MP stack. I haven't gotten all the tests to pass yet --- suggestions are very welcome!

Closes #422.

@Andrew-S-Rosen Andrew-S-Rosen changed the title Add support for Pydantic 2 [WIP] Add support for Pydantic 2 Sep 27, 2023
@Andrew-S-Rosen Andrew-S-Rosen changed the title [WIP] Add support for Pydantic 2 Add support for Pydantic 2 Sep 28, 2023
@@ -161,7 +161,7 @@ class InnerSchema(BaseModel):
class MediumSchema(BaseModel):
s: str
nested: InnerSchema
nested_opt: Optional[InnerSchema]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I had to change this in the test suite. For some reason, leaving it as Optional[InnerSchema] caused ref.nested.nested_opt.m.uuid not to be raised. Must be a change in how Pydantic 2 handles optional-annotated fields.

@Andrew-S-Rosen
Copy link
Member Author

@utf: This should be ready to review + merge!

@codecov
Copy link

codecov bot commented Sep 28, 2023

Codecov Report

Merging #440 (de0d676) into main (614ba43) will not change coverage.
Report is 14 commits behind head on main.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #440   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           19        19           
  Lines         1509      1510    +1     
  Branches       412       414    +2     
=========================================
+ Hits          1509      1510    +1     
Files Coverage Δ
src/jobflow/core/reference.py 100.00% <100.00%> (ø)
src/jobflow/settings.py 100.00% <100.00%> (ø)

@utf
Copy link
Member

utf commented Sep 28, 2023

Thanks @Andrew-S-Rosen, looks great.

@utf utf merged commit 90c425b into materialsproject:main Sep 28, 2023
9 checks passed
@utf utf added the enhancement New feature or request label Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Pydantic2
2 participants