Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Internal code changes to improve support for NumPy 2.0.
Details
Spurned on by
let's see what changes we can make now to future-proof ourselves.
With the dvelopment build of NumPy 2.0 installed
and removing
matlpotlib
andastropy
(as the released versions of these I had, which are admittedly old, also have problems with NumPy 2.0) then most tests pass with this change. We do need to work out what to do with the change in string representation - e.g. #1864 (comment) - but this forms a nice limited-scope set of changes.Let's see how it copes with some of the older NumPy versions we have in our CI runs! It's hard to check against numpy 2.0 since we don't have a CI run that provides this.
There will likely be more changes needed for our compiled extensions, but that can come later (and I don't know how to make
pyproject.toml
use a development build of NumPy rather thanoldest-supported-numpy
!).Changes
np.exceptions
to importVisibleDeprecationWarning
, falling back to the old location if not availablenp.exceptions
was added in NumPy 1.25np.float64
rather thannp.float_
np.double
instead, but I think I like the choice of an explicit fixed-size datatype (since we have to deal with compiled code)float_
andfloat64
become synonyms but I assume it holds for all recent NumPy versionsnp.bytes_
rather thannp.string_
string_
andbytes_
become synonyms but I assume it holds for all recent NumPy versionsisinstance
rather than an explicittype
check