Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork11.8k
API: Removeptp,itemset andnewbyteorder fromnp.ndarray class#24682
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
06a34b2 to80cbd85Compare80cbd85 to65bb8ddComparengoldbaum commentedSep 11, 2023
Searching on github, there seems to be a lot of usage of
usage of From that, I think we definitely at least need an |
mtsokol commentedSep 11, 2023
As a replacement I'm using: arr.view(arr.dtype.newbytorder(new_order)) as |
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.
FYI thendarray.itemset type annotations still persist as of the moment and will have to be removed as well.
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 for pointing out! I removed them.
ca8425f to1b24963Comparengoldbaum commentedSep 12, 2023
Let me know if you need a hand setting up the |
c217775 to0d4887dComparemtsokol commentedSep 13, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@ngoldbaum Right, I forgot to add them. I pushed new changes - now in |
xrefnumpy/numpy#24682Only a handful of lines, and _mostly_ in tests/relatively unused utility functions like rgb_to_hsv, but still something that should be addressed.
ngoldbaum left a comment
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.
It looks like matplotlib is ready. Are there any other downstream libraries we need to wait on PRs for?
Just one minor nit on the error message otherwise I think this is ready so long as downstream is ready as far as we're aware.
numpy/core/src/multiarray/getset.c Outdated
| array_ptp(PyArrayObject*self,void*NPY_UNUSED(ignored)) | ||
| { | ||
| PyErr_SetString(PyExc_AttributeError, | ||
| "`ptp` has been removed from ndarray class. " |
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.
Minor nit, here and in the other messages I'd say "was removed from the ndarray class in NumPy 2.0".
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.
Sure! I updated them.
mtsokol commentedSep 17, 2023
I checked other libraries and opened four PRs that reflect changes introduced there:
Then we're good to go. |
eendebakpt commentedSep 17, 2023
Both results in: The results in So the normal indexing is even faster than a direct @mtsokol The title of the PR contains |
ptp,setitem andnewbyteorder fromnp.ndarray classptp,itemset andnewbyteorder fromnp.ndarray classmtsokol commentedSep 17, 2023
@eendebakpt Ah yes, I did a typo - fixed. |
ngoldbaum commentedSep 20, 2023
All the downstream PRs are merged so let's pull this one in. Thanks@mtsokol. As always, if you're reading this because of CI breakage and you think we made a mistake in this PR and the migrations we've offered aren't sufficient, please open an issue. |
jakirkham commentedApr 2, 2024
Were there deprecation warnings added to NumPy 1 for these removals somewhere? |
ngoldbaum commentedApr 2, 2024
Given that it's a major version bump we decided to do a few API cleanups without any deprecation, including these. If that proves to be too disruptive, we're open to re-adding with deprecation warnings. |
jakirkham commentedApr 2, 2024
We just ran into it when testing between NumPy 1 & 2 I don't think we need to readd them as there is a path to using the functions instead of the methods Though it might be worth adding a deprecation warning in the next NumPy 1 release just so users know this is coming |
jakirkham commentedApr 2, 2024
cc@grlee77 (who ran into this; in case you have more thoughts here) |
Hi@rgommers@ngoldbaum,
This PR contains the first batch of cleanup changes for
numpy.ndarrayclass described inNEP 52 section. It covers removal ofptp,setitemandnewbyteordermethods fromndarray. Should I add deprecation message or are these too niche to mention that?Please note that I left
np.matrixandnp.ma.MaskedArrayclasses intact as they are already legacy. (masked array has its own implementation and matrix class usesnp.ptp)