Skip to content

Conversation

@samcunliffe
Copy link
Collaborator

We're currently broken because numpy removed the deprecated newshape argument to numpy.reshape in 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.


Whilst I was at it, I spotted a trivial typo in tox.ini and realised we still have a pre-commit.ci badge but we dropped it in #308 (sorry for the unrelated changes!)

@samcunliffe samcunliffe requested a review from Copilot January 6, 2026 10:34
@samcunliffe samcunliffe self-assigned this Jan 6, 2026
@samcunliffe samcunliffe added Bug Something isn't working Tests Adding to or fixing the tests Maintenance Not related to the development of new features dependencies Pull requests that update a dependency file labels Jan 6, 2026
Copy link

Copilot AI left a 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.23 to >=2.1 in setup.cfg and pre-commit config
  • Replaced deprecated newshape parameter with shape in 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.

@samcunliffe samcunliffe requested a review from dstansby January 6, 2026 10:40
@samcunliffe
Copy link
Collaborator Author

Yet another sidenote: I can't request @K-Meech to review... is that because she needs to be a collaborator on the repo first?

@dstansby
Copy link
Member

dstansby commented Jan 6, 2026

Thanks for this - I think we should follow SPEC 0 anyway, so this is definitely 👍

Unrelated to this PR:

  • Did you enable copilot reviews? I am 👎 on having it enabled, but happy to discuss if anyone feels strongly
  • @K-Meech would you like to be a maintainer here? If so I can get you added to the right teams.

@dstansby
Copy link
Member

dstansby commented Jan 6, 2026

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?

@samcunliffe
Copy link
Collaborator Author

samcunliffe commented Jan 6, 2026

Can we lower the pin to numpy 2.0 though

No, unfortunately, we can't. The change is 2.0 → 2.1.

Did you enable copilot reviews? I am 👎 on having it enabled, but happy to discuss if anyone feels strongly

No, it was available to click so I clicked.
I'm easy: but since you're 👎 enough to type 👎, then I'd support a "no-copilot" rule. Do you want to write something into CONTRIBUTING.md?

@K-Meech
Copy link
Contributor

K-Meech commented Jan 7, 2026

@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.

@dstansby
Copy link
Member

dstansby commented Jan 8, 2026

Yeah, absolutely no expecation of actually doing anything - I thought it might be helpful to self merge-and-release fixes you find when using napari-matplotlib, instead of having to wait for someone else to look over them.

@dstansby
Copy link
Member

dstansby commented Jan 8, 2026

Since

  1. The affected code is only in the tests
  2. We should still support NumPy 2.0 for users

Could you put the min pin to numpy>=2.0 for the whole package, and then introduce a numpy>=2.1 pin for tests?

@samcunliffe samcunliffe changed the title Drop support for numpy 2.0 and older. Require numpy 2.1 or newer in tests. Adopt SPEC-0 in the package. Jan 8, 2026
@samcunliffe
Copy link
Collaborator Author

instead of having to wait for someone else to look over them.

I'm still a bit uncomfortable merging my own PRs.
Even in this relatively trivial case, the review was helpful...

@dstansby dstansby merged commit 500d817 into matplotlib:main Jan 8, 2026
13 checks passed
@dstansby
Copy link
Member

dstansby commented Jan 8, 2026

I'm still a bit uncomfortable merging my own PRs.
Even in this relatively trivial case, the review was helpful...

This is fair

@samcunliffe samcunliffe deleted the drop-numpy-v1-support branch January 8, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working dependencies Pull requests that update a dependency file Maintenance Not related to the development of new features Tests Adding to or fixing the tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants