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

Support pydantic v2 and get rid of plum warnings #922

Merged
merged 3 commits into from
Apr 2, 2024

Conversation

johnzl-777
Copy link
Collaborator

@johnzl-777 johnzl-777 commented Apr 1, 2024

This PR attempts to kill two 🐦s with one two 🪨s :

  1. Due to Amazon Braket packages Bloqade depends on migrating to pydantic V2 and the incompatibility of the pydantic V1 API with V2, the easiest route to upgrade Bloqade to V2 has been taken (just replacing import pydantic... with import pydantic.v1).

  2. plum, used for multiple dispatch in add_position, does not seem to play nicely with numpy ndarrays, issuing a warning that the type hint could not be resolved and the type is not faithful. As a result, plum is no longer used and I've instead fallen back to a combination of if..elif and is_bearable from beartype.door

@johnzl-777 johnzl-777 requested a review from weinbe58 April 1, 2024 19:14
Copy link
Contributor

github-actions bot commented Apr 1, 2024

PR Preview Action v1.4.7
Preview removed because the pull request was closed.
2024-04-02 15:07 UTC

Copy link

codecov bot commented Apr 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.72%. Comparing base (259e5dc) to head (5e089b6).
Report is 1 commits behind head on main.

❗ Current head 5e089b6 differs from pull request most recent head b4c3736. Consider uploading reports for the commit b4c3736 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #922   +/-   ##
=======================================
  Coverage   89.72%   89.72%           
=======================================
  Files         110      110           
  Lines        7864     7867    +3     
=======================================
+ Hits         7056     7059    +3     
  Misses        808      808           

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

Copy link
Member

@weinbe58 weinbe58 left a comment

Choose a reason for hiding this comment

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

LGTM, make sure to remove plum from the dependencies if it isn't being used

@weinbe58 weinbe58 merged commit 05a9f94 into main Apr 2, 2024
8 checks passed
@weinbe58 weinbe58 deleted the john/pydantic-v2-support branch April 2, 2024 14:58
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.

2 participants