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

Add NumPy 2 support #505

Closed
wants to merge 1 commit into from
Closed

Add NumPy 2 support #505

wants to merge 1 commit into from

Conversation

cbrnr
Copy link
Contributor

@cbrnr cbrnr commented Oct 9, 2024

Fixes #493.

@cbrnr
Copy link
Contributor Author

cbrnr commented Oct 10, 2024

@tompollard you opened #506, #507, and #508 – do the changes in this PR not solve the issue? All tests pass with NumPy 2.

@@ -11,7 +11,7 @@ license = "MIT"

[tool.poetry.dependencies]
python = ">=3.7"
numpy = ">=1.10.1,<2.0.0"
numpy = ">=2.0.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This could even remain numpy = ">=1.26.0", since all changes should work with both NumPy 1.x and NumPy 2.x.

@tompollard
Copy link
Member

@cbrnr thanks for looking at this and sorry for the duplicate effort.

@tompollard you opened #506, #507, and #508 – do the changes in this PR not solve the issue? All tests pass with NumPy 2.

I think the change in this pull request resolves one of the issues, but not all of them. Errors may not be obvious because (1) the test suite doesn't have full coverage and (2) overflows don't raise errors by default.

I have tried to address the warnings raised when running tests with NPY_PROMOTION_STATE=weak_and_warn, but I think more work is needed (e.g. by extending tests).

We may want to set the package to raise error on overflow when in development, which I think we can do with np.seterr (https://numpy.org/doc/stable/reference/generated/numpy.seterr.html)

@cbrnr
Copy link
Contributor Author

cbrnr commented Oct 11, 2024

No problem! Feel free to take whatever you need from this PR, and let me know if you need further help. It would be great if NumPy 2 support wasn't too far in the future!

@cbrnr cbrnr closed this Oct 11, 2024
@cbrnr cbrnr deleted the numpy branch October 11, 2024 08:37
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.

OverflowError: Python integer 256 out of bounds for uint8
2 participants