-
Notifications
You must be signed in to change notification settings - Fork 145
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
Relax numpy upper version cap #1172
Conversation
In Qiskit#1012 we added an upper version cap to numpy to prevent it from installing numpy 2.0 before we confirmed that rustworkx was compatible with it. Now that numpy 2.0.0rc1 has been released we're able to confirm that rustworkx works fine with numpy 2.0. This commit raises the upper bound on the numpy version to < 3 to enable installing numpy 2.0 with rustworkx.
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.
LGTM, thanks for confirming
While we didn't have any test coverage for this looking at the numpy 2.0 migration guide one thing we'll have to handle is the new copy kwarg on array: https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword This commit updates the sole use of __array__ we have on custom sequence return types so that if copy=False is passed in we raise a ValueError. Additionally, the dtype handling is done directly in the rustworkx code now to ensure we don't have any issues with numpy 2.0.
In talking with @jakelishman (who handled the numpy 2.0 compatibility for Qiskit) he pointed out that the |
Pull Request Test Coverage Report for Build 8855732656Details
💛 - Coveralls |
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.
Can we refactor the dtype handling to use py.import_bound()
and then handle the NumPy module as a traditional Python object to call the methods?
I'd rather avoid eval_bound
and __import__
in the same code
In #1012 we added an upper version cap to numpy to prevent it from installing numpy 2.0 before we confirmed that rustworkx was compatible with it. Now that numpy 2.0.0rc1 has been released we're able to confirm that rustworkx works fine with numpy 2.0. This commit raises the upper bound on the numpy version to < 3 to enable installing numpy 2.0 with rustworkx.