-
Notifications
You must be signed in to change notification settings - Fork 44
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
Update pydantic to ~=1.8 #731
Update pydantic to ~=1.8 #731
Conversation
Bumps [pydantic](https://github.com/samuelcolvin/pydantic) from 1.6.1 to 1.8. - [Release notes](https://github.com/samuelcolvin/pydantic/releases) - [Changelog](https://github.com/samuelcolvin/pydantic/blob/master/HISTORY.md) - [Commits](pydantic/pydantic@v1.6.1...v1.8) Signed-off-by: dependabot[bot] <[email protected]>
The latter is needed due to an updated serialization of Enums used in pydantic models in pydantic>=1.7.
Note, this will update the OpenAPI schemas, but this makes sense, as the Enum classes simply get the same treatment and representation as pydantic models have always had. |
Codecov Report
@@ Coverage Diff @@
## master #731 +/- ##
=======================================
Coverage 92.81% 92.81%
=======================================
Files 67 67
Lines 3520 3520
=======================================
Hits 3267 3267
Misses 253 253
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Added a test for the Otherwise, it's ready for review @ml-evs. |
It's worth mentioning @rartino and possibly @merkys as well for this PR, as we're slightly changing the OpenAPI schema (which will later be passed onto the central OPTIMADE repository). What: The change is for schema fields that use enumerations only, adding information about the default value and field descriptions - something that is already present for other non-enumeration schema fields. It also uses the Why: This is the updated way of handling Python |
I'm fine with this, but for continuity I think it makes sense to release the 1.0.1 of the specification before we make this change (I have just merged the most recent schema sync PR). Will review the new code soon. |
Yes and no. It shouldn't take long to update the schemas in the specification repo again immediately if we just hail the right people for 5 min. :) But to find out how long time it would take, we would first need an evaluation of this PR by those right people (hint @rartino, @merkys, ...) 😄 (specifically revieweing the OpenAPI schemas.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reviewed OpenAPI schemas and I am fine with their changes. In Python code I see only a single change in comment and addition of a test, which is almost always a good thing. Thus I tend to approve this PR.
As for updating the OpenAPI schemas for OPTIMADE, I am fine with both pre-1.0.1 and post-1.0.1 merge. Pre-1.0.1 merge is sensible due to specified default value for aggregate
.
@ml-evs I would still need you approval here as one of the code owners. Also, if you agree I will open another PR to update the schemas (again) in the OPTIMADE repository and we can try and quickly get this update in, including a release to v0.13.3. |
Ah! I found another "issue". The "title" OpenAPI key is not present for properties using Enum types. Indeed, it is now removed from |
When a pydantic model attribute/field specifies an Enum as the type, it doesn't auto-generate the "title" key for the OpenAPI schema. This commit adds them in explicitly. It also adds some doc strings where it was missing for Enums.
@merkys I have fixed the schemas according to the comment above. You can see the changes with respect to the ones that you accepted here and see the aggregated changes by reviewing normally. Note, that there are no longer changes in any "title" values there, only additions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @CasperWA, looks good.
The related OPTIMADE Python tools PR: Materials-Consortia/optimade-python-tools#731. The changes are related to enumerations (Python Enum sub-classes), extending information about them and defining the default value for the aggregate field attribute for a links resource.
The related OPTIMADE Python tools PR: Materials-Consortia/optimade-python-tools#731. The changes are related to enumerations (Python Enum sub-classes), extending information about them and defining the default value for the aggregate field attribute for a links resource.
The related OPTIMADE Python tools PR: Materials-Consortia/optimade-python-tools#731. The changes are related to enumerations (Python Enum sub-classes), extending information about them and defining the default value for the aggregate field attribute for a links resource.
The related OPTIMADE Python tools PR: Materials-Consortia/optimade-python-tools#731. The changes are related to enumerations (Python Enum sub-classes), extending information about them and defining the default value for the aggregate field attribute for a links resource.
Closes #730.
It seems we do not need to support more of the special OpenAPI keys that we're already supporting. Only
allOf
is used in the first-level for the retrieving the "attributes" fields anyway.This PR also closes #729, since it will update
pydantic
, adding proper support for Python 3.9.