Skip to content

RFC: prefer ndarray.reshape over (deprecated) in-place shape attributes mutations - #64

Merged
brandon-rhodes merged 1 commit into
brandon-rhodes:masterfrom
neutrinoceros:reshape
Jan 23, 2026
Merged

brandon-rhodes merged 1 commit into
brandon-rhodes:masterfrom
neutrinoceros:reshape

Conversation

@neutrinoceros

Copy link
Copy Markdown
Contributor

close #63

@mhvk mhvk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@neutrinoceros - it's all up to @brandon-rhodes, but the code as written imports specific functions from numpy directly, so it may make sense to follow that pattern. Indeed, I don't see an import numpy as np, so think the changes as you have them should fail. Might be good to test with astropy?

@mhvk

mhvk commented Jan 19, 2026

Copy link
Copy Markdown
Contributor

Alternatively, just use the .reshape() method?

@neutrinoceros neutrinoceros changed the title RFC: prefer np.reshape over (deprecated) in-place shape attributes mutations RFC: prefer ndarray.reshape over (deprecated) in-place shape attributes mutations Jan 19, 2026
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

oh right, I'm so used to having import numpy as np everywhere I didn't even think it could be missing. The ndarray.reshape method doesn't need an import so let's try that instead. Thanks !

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

I successfully ran astropy's test suite against this branch in astropy/astropy#19184

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

@brandon-rhodes could we get a best-guess estimate on if and when you'd be able to cut a release with this (or any similar) patch ? We're not in a hurry, and there are workarounds we can use to stabilize our CI in the meantime, I'm only trying to get a sense whether its worth it at all.

@brandon-rhodes
brandon-rhodes merged commit bf6924c into brandon-rhodes:master Jan 23, 2026
@brandon-rhodes

Copy link
Copy Markdown
Owner

With fingers crossed, I have just released version 2.24 with these changes. Let me know if it solves your CI problems; hopefully the changes work without any hitch!

@neutrinoceros
neutrinoceros deleted the reshape branch January 23, 2026 21:32
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Thanks a lot. I confirm this fixed our CI !

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.

NumPy 2.5 (dev) deprecates direct mutations to ndarray.shape attributes

3 participants