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

Set pydantic version less than 2.0 for all conda envs #160

Merged
merged 4 commits into from
Aug 8, 2023
Merged

Conversation

dotsdl
Copy link
Member

@dotsdl dotsdl commented Aug 6, 2023

Pydantic 2.0 comes with major changes that we are not yet ready to support, and installs of it in environments that use alchemiscale are likely to break usage. This PR sets the version spec to <2.0 for pydantic in all conda envs.

Pydantic 2.0 comes with major changes that we are not yet ready to
support, and installs of it in environments that use `alchemiscale` are
likely to break usage. This PR sets the version spec to <2.0 for
pydantic in all conda envs.
@codecov-commenter
Copy link

codecov-commenter commented Aug 6, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.49% ⚠️

Comparison is base (d5a106e) 82.62% compared to head (ee6af5c) 82.13%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #160      +/-   ##
==========================================
- Coverage   82.62%   82.13%   -0.49%     
==========================================
  Files          21       21              
  Lines        2676     2676              
==========================================
- Hits         2211     2198      -13     
- Misses        465      478      +13     

see 1 file with indirect coverage changes

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

@hmacdope
Copy link
Collaborator

hmacdope commented Aug 6, 2023

Just FYI if you want to support pydantic~1 schema from pydantic>=2.0.0a @mattwthompson, @jhorton and I have been using this to import the v1 api from v2.

    from pydantic.v1 import BaseModel, Field

You can then use the following guard to support both versions.

try:
    from pydantic.v1 import BaseModel, Field
except ImportError:
    from pydantic import BaseModel, Field

@dotsdl
Copy link
Member Author

dotsdl commented Aug 8, 2023

Oh gotcha, I suppose that would be the preferred approach to avoid holding back the rest of the stack?

@dotsdl
Copy link
Member Author

dotsdl commented Aug 8, 2023

Trying out the import guard approach; will see if this breaks our tests.

We tried putting in import guardrails, but tests fail in an unclear way.
Will try to support pydantic 2.x at a later time.
@dotsdl
Copy link
Member Author

dotsdl commented Aug 8, 2023

Reverting to just supporting pydantic < 2.0 for now. We'll work toward proper pydantic 2.0 support in a future PR; tests gave an opaque error when we tried doing the import guard approach above: https://github.com/openforcefield/alchemiscale/actions/runs/5791301527/job/15695900360?pr=160

@dotsdl dotsdl merged commit 26c845f into main Aug 8, 2023
5 checks passed
@dotsdl dotsdl deleted the pin-pydantic-2.0 branch August 8, 2023 02:17
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.

None yet

3 participants