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

Updating to Pydantic V2 #260

Closed
glass-ships opened this issue Aug 7, 2023 · 9 comments · Fixed by #495
Closed

Updating to Pydantic V2 #260

glass-ships opened this issue Aug 7, 2023 · 9 comments · Fixed by #495
Assignees

Comments

@glass-ships
Copy link
Collaborator

Koza will need this looked at as well, along with the following:

monarch-app/backend (similarity)
><glass@rocinante> poetry show pydantic
 name         : pydantic                                                        
 version      : 1.10.12                                                         
 description  : Data validation and settings management using python type hints 

dependencies
 - typing-extensions >=4.2.0

required by
 - bioregistry <2.0
 - curies <2.0
 - fastapi >=1.6.2,<1.7 || >1.7,<1.7.1 || >1.7.1,<1.7.2 || >1.7.2,<1.7.3 || >1.7.3,<1.8 || >1.8,<1.8.1 || >1.8.1,<2.0.0
 - linkml *
 - linkml-runtime >=1.10.2,<2.0.0
@glass-ships glass-ships self-assigned this Aug 7, 2023
@glass-ships
Copy link
Collaborator Author

@glass-ships
Copy link
Collaborator Author

See linkml/linkml#1575

@cthoyt
Copy link
Contributor

cthoyt commented Dec 2, 2023

FYI bioregistry and CURIEs both now support pydantic 1/2

@glass-ships
Copy link
Collaborator Author

glass-ships commented Dec 5, 2023

Nice, so close!!

It looks like oaklib still indirectly depends on prefixmaps < 0.2, so once that gets updated I can move this forward!

Because no versions of oaklib match >0.5.22
 and oaklib (0.5.22) depends on kgcl-schema (0.6.0), oaklib (>=0.5.22) requires kgcl-schema (0.6.0).
And because kgcl-schema (0.6.0) depends on prefixmaps (>=0.1.5,<0.2.0), oaklib (>=0.5.22) requires prefixmaps (>=0.1.5,<0.2.0).
So, because monarch-py depends on both oaklib (>=0.5.22) and prefixmaps (^0.2), version solving failed.

@cthoyt
Copy link
Contributor

cthoyt commented Dec 5, 2023

We just fixed the kgcl-schema issue ten minutes ago

@cthoyt
Copy link
Contributor

cthoyt commented Dec 5, 2023

try again and hopefully it works 🚀

@glass-ships
Copy link
Collaborator Author

slightly delayed, but yes that worked - i'm able to upgrade pydantic to 2.5 here now!
thanks so much for your help!

@glass-ships
Copy link
Collaborator Author

@amc-corey-cox i hear you learned a better way to get our prefixmap, could I ask you to enlighten me?
I think updating that here would allow us to bring this in

kevinschaper pushed a commit that referenced this issue Jan 10, 2024
Closes #260 

### Summary

- Updates Pydantic to v2.5, along with some other packages to allow this
- Updates fixtures, scripts, and migrate related code 
- Updates tests
- curie expansion fails: on omim, ensembl, uberon, and wormbase
(potentially unrelated?)
@amc-corey-cox
Copy link
Collaborator

Sure, here is my notebook on this:
https://colab.research.google.com/drive/155XsHrhtrV85PjuAZ9ds9U3XHriG3_cF#scrollTo=__ctJM_dA7Ts
The salient feature is this:

from prefixmaps.io.parser import load_context
merged_context = load_context("merged")
merged_converter = merged_context.as_converter()

That will give you the converter from the merged context. I've also created a new context of merged.monarch that we should start using going forward but it is just merged and I don't think we should target that for the current release milestone.

You would use it the same way:

from prefixmaps.io.parser import load_context
merged_monarch_context = load_context("merged.monarch")
merged_monarch_converter = merged_context.as_converter()

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 a pull request may close this issue.

4 participants