-
Notifications
You must be signed in to change notification settings - Fork 509
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
Prepare for NumPy 2.0 #2845
Prepare for NumPy 2.0 #2845
Conversation
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.
I have reviewed the changes provided and performed greps for all items on the numpy 2 migration guide.
I only have one comment, which is not necessary for merge as it doesn't affect 2.0 compatibility:
- numpy 2.0.0 deprecates np.trapz which we use twice within our codebase. We should consider moving to scipy.integrate.trapezoid instead.
One observation that does not need to be incorporated, as it doesn't effect numpy 2.0.0 compatibility, is that np.trapz is deprecated
@nelsonag Thanks for the careful review! I've just added a commit replacing |
@nelsonag Do you have any further requests on this PR? |
@paulromano this looks good to me so far. I think the small amount of Cython used in the repo should be fine because it was using Cython > 3.0. I did go through the other Ruff rules for numpy after looking through the migration guide and noticed we are using legacy functions from |
@eepeterson Thanks for pointing that out about |
Actually jk, if I use |
@eepeterson OK, just took care of the NPY002 warnings from ruff ✔️ |
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.
Thanks @paulromano! will merge after the green light
Description
NumPy is going to be making a major release (2.0) soon that is backwards incompatible. Thankfully, there's very little we need to change in OpenMC in order to prepare for the 2.0 release. The only thing that needed to be changed was to replace
np.string_
withnp.bytes_
as mentioned in the migration guide.Checklist
I have run clang-format (version 15) on any C++ source files (if applicable)I have made corresponding changes to the documentation (if applicable)I have added tests that prove my fix is effective or that my feature works (if applicable)