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

Update calls to numpy.reshape to avoid deprecation warnings #433

Merged
merged 2 commits into from
Sep 18, 2024

Conversation

FrederikSchnack
Copy link
Contributor

@FrederikSchnack FrederikSchnack commented Sep 16, 2024

NumPy 2.1 deprecates the newshape argument of the reshape function. Instead, one should use the positional-only argument shape. Every call in Psydac has been updated accordingly. This closes #432.

Copy link
Collaborator

@campospinto campospinto left a comment

Choose a reason for hiding this comment

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

So if understand correctly, these changes remove the warning for Numpy 2.1 but are not incompatible with the Python 3.9 tests (and the corresponding Numpy version) ? So we should probably wait for Python 3.9 to be dropped (Fall 2025?)

@FrederikSchnack
Copy link
Contributor Author

Yes exactly, I was a little too fast with the changes, but I don't know if there is any actual benefit of maintaining old versions of Python for long times (especially since all newer NumPy versions will not be compatible). But we could also remove the keywords in np.reshape completely, which I don't like conceptually, but it would remove the warnings and pass the tests with all Python versions.

@yguclu yguclu changed the title Specify shape in np.reshape Update calls to np.reshape to avoid deprecation warnings Sep 18, 2024
@yguclu yguclu changed the title Update calls to np.reshape to avoid deprecation warnings Update calls to numpy.reshape to avoid deprecation warnings Sep 18, 2024
@yguclu yguclu merged commit 516363e into devel Sep 18, 2024
7 checks passed
@yguclu yguclu deleted the reshape_deprecated branch September 18, 2024 14:42
max-models pushed a commit that referenced this pull request Oct 1, 2024
NumPy 2.1 deprecates the `newshape` argument of the `reshape` function.
Instead, one should use the positional-only argument `shape`. Every call
in Psydac has been updated accordingly. This closes #432.
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.

Deprecation Warning for np.reshape
3 participants