-
Notifications
You must be signed in to change notification settings - Fork 23
Require numpy 2.1 or newer in tests. Adopt SPEC-0 in the package. #321
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
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.
Pull request overview
This PR updates the minimum numpy version requirement from >=1.23 to >=2.1 and modernizes the Python version support to align with the updated numpy dependency. This change addresses a breaking API change where numpy 2.4 removed the deprecated newshape parameter from numpy.reshape().
Key Changes:
- Updated numpy dependency from
>=1.23to>=2.1in setup.cfg and pre-commit config - Replaced deprecated
newshapeparameter withshapein numpy.reshape() call - Updated Python version support from 3.10-3.12 to 3.11-3.13 in tox.ini
- Removed obsolete pre-commit.ci badge from README (following #308)
- Updated pre-commit hook versions (ruff, mypy)
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| setup.cfg | Updated numpy minimum version requirement from >=1.23 to >=2.1 |
| src/napari_matplotlib/tests/helpers.py | Changed numpy.reshape() parameter from deprecated newshape to shape |
| tox.ini | Updated Python test environments from py{310,311,312} to py{311,312,313} |
| .pre-commit-config.yaml | Updated ruff (v0.13.1 → v0.14.10), mypy (v1.18.2 → v1.19.1), and aligned numpy dependency to >=2.1 |
| README.md | Removed obsolete pre-commit.ci badge |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Yet another sidenote: I can't request @K-Meech to review... is that because she needs to be a collaborator on the repo first? |
|
Thanks for this - I think we should follow SPEC 0 anyway, so this is definitely 👍 Unrelated to this PR:
|
|
Can we lower the pin to numpy 2.0 though, since SPEC 0 doesn't say we should drop support for numpy 2.0 yet? |
No, unfortunately, we can't. The change is 2.0 → 2.1.
No, it was available to click so I clicked. |
|
@samcunliffe - all looks good to me! @dstansby - happy to be added as a maintainer, but I can't commit a lot of time to this (I'm still maintaining various packages from my previous jobs which consumes a lot of my extra time 😅 ) Can contribute reviews / the odd bug fix though - especially since we use this package on the napari course, which we intend to teach regularly going forward. |
|
Yeah, absolutely no expecation of actually doing anything - I thought it might be helpful to self merge-and-release fixes you find when using |
|
Since
Could you put the min pin to |
I'm still a bit uncomfortable merging my own PRs. |
This is fair |
We're currently broken because numpy removed the deprecated
newshapeargument tonumpy.reshapein numpy 2.4.So we either make an upper pin (
numpy >= 1.23,<2.4), if you want to support old versions of numpy for any reason. Or (my preference) we drop support for numpy versions older than 2.0. This PR is the latter.@dstansby, you spotted this in 2024... Support napari>=0.5 #274 (comment)
Does this need a changelog entry? And a new version?
Whilst I was at it, I spotted a trivial typo in
tox.iniand realised we still have a pre-commit.ci badge but we dropped it in #308 (sorry for the unrelated changes!)