-
Notifications
You must be signed in to change notification settings - Fork 96
NumPy 2.0 compatibility changes #224
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
Conversation
|
@jjhelmus it would be great to get these fixes in (perhaps check the complete code base with |
|
@reneeotten Thanks for the tip, ruff check found one more function name which is removed in NumPy >2.0, this is now pushed. BTW, the code should be still compatible with NumPy 1.26 after this PR, as all these renamed functions were already available in that version. |
|
Thanks for submitting these changes. Unfortunately, the change from |
|
Added |
|
As I suspected, this does break some of the examples that relied on accessing elements from a record array instead of a the new array object. I will try and fix the test data story before attempting to review this again. #87 |
I understand that some of the examples might not work after this change, but isn't that better than having the whole package defunct with NumPy v2. You are not restricting NumPy to the 1.x branch in the dependency declaration so everyone installing this will likely do so in an environment with NumPy v2.x by now. So I would really suggest to merge this PR, release a new version, and then work on examples whenever time permits. |
|
NumPy v2 has been released well over a year by now. The changes in this PR are required to work with that version. Your own test-suite fails in the current state because you don't restrict numpy to v1 branch; I would say it's time to get the package compatible with NumPy v2 and worry about the possibility of old examples not working anymore later. @jjhelmus could you please weigh in on this? Thanks! |
|
Fully agree with @reneeotten — and thanks to all maintainers (foremost @jjhelmus) and contributors for keeping this excellent package moving forward. nmrglue has been invaluable to the community, and it’s great to see continued attention to modernization. The current dependency on NumPy 1 is becoming a real constraint. NumPy 1.x does not support Python 3.13 (and certainly won’t support 3.14), so updating the requirement to NumPy 2.x is essentially a prerequisite for enabling the project to adopt newer Python versions. Aligning with the modern NumPy API would significantly help future-proof the package and ease integration for downstream users. |
|
I'm going to merge this change now that CI is set up and this fixes the tests in the nmrglue folder that were broken without this change. The changes this makes related to examples and the tests in the tests directory can be fixed after this is merged. |
…re either failing, or are slow, or have external dependencies (corrected after jjhelmus#224)
…re either failing, or are slow, or have external dependencies (corrected after jjhelmus#224)
This PR fixes some function names that were deprecated in NumPy 2.0.