Skip to content

Commit 500d817

Browse files
authored
Require numpy 2.1 or newer in tests. Adopt SPEC-0 in the package. (#321)
* Switch `reshape` to `shape` and drop support for old numpy versions. * Fix tox.ini missing env from envlist. * Remove pre-commit.ci badge since we're not using it anymore. * Was actually added in numpy 2.1. So we also don't support numpy 2.0. * Aaaand, we can remove a deprecation warning suppression. * Full SPEC-0
1 parent 6027e7c commit 500d817

File tree

6 files changed

+12
-14
lines changed

6 files changed

+12
-14
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ repos:
77
- id: trailing-whitespace
88

99
- repo: https://github.com/astral-sh/ruff-pre-commit
10-
rev: v0.13.1
10+
rev: v0.14.10
1111
hooks:
1212
- id: ruff-format
1313

@@ -17,14 +17,14 @@ repos:
1717
- id: napari-plugin-checks
1818

1919
- repo: https://github.com/pre-commit/mirrors-mypy
20-
rev: v1.18.2
20+
rev: v1.19.1
2121
hooks:
22-
- id: mypy
23-
additional_dependencies: [numpy, matplotlib]
22+
- id: mypy
23+
additional_dependencies: [numpy>=2.1, matplotlib]
2424

2525
- repo: https://github.com/astral-sh/ruff-pre-commit
2626
# Ruff version.
27-
rev: 'v0.13.1'
27+
rev: "v0.14.10"
2828
hooks:
2929
- id: ruff
3030

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
[![Python Version](https://img.shields.io/pypi/pyversions/napari-matplotlib.svg?color=green)](https://python.org)
66
[![tests](https://github.com/matplotlib/napari-matplotlib/workflows/tests/badge.svg)](https://github.com/matplotlib/napari-matplotlib/actions)
77
[![codecov](https://codecov.io/gh/matplotlib/napari-matplotlib/branch/main/graph/badge.svg)](https://codecov.io/gh/matplotlib/napari-matplotlib)
8-
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/matplotlib/pytest-mpl/master.svg)](https://results.pre-commit.ci/latest/github/matplotlib/pytest-mpl/master)
98
[![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/napari-matplotlib)](https://napari-hub.org/plugins/napari-matplotlib)
9+
[![SPEC 0 — Minimum Supported Dependencies](https://img.shields.io/badge/SPEC-0-green?labelColor=%23004811&color=%235CA038)](https://scientific-python.org/specs/spec-0000/)
1010

1111
A plugin to create Matplotlib plots from napari layers
1212

13-
----------------------------------
13+
---
1414

1515
## Introduction
16+
1617
`napari-matplotlib` is a bridge between `napari` and `matplotlib`, making it easy to create publication quality `Matplotlib` plots based on the data loaded in `napari` layers.
1718

1819
Documentation can be found at https://napari-matplotlib.github.io/
@@ -33,9 +34,7 @@ If you encounter any problems, please [file an issue] along with a detailed desc
3334

3435
[@napari]: https://github.com/napari
3536
[BSD-3]: http://opensource.org/licenses/BSD-3-Clause
36-
3737
[file an issue]: https://github.com/dstansby/napari-matplotlib/issues
38-
3938
[napari]: https://github.com/napari/napari
4039
[tox]: https://tox.readthedocs.io/en/latest/
4140
[pip]: https://pypi.org/project/pip/

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ filterwarnings = [
1414
"ignore:`np.bool8` is a deprecated alias for `np.bool_`:DeprecationWarning",
1515
# Coming from pydantic via napari
1616
"ignore:Pickle, copy, and deepcopy support will be removed from itertools in Python 3.14.:DeprecationWarning",
17-
# Until we stop supporting older numpy versions (<2.1)
18-
"ignore:(?s).*`newshape` keyword argument is deprecated.*$:DeprecationWarning",
1917
]
2018
qt_api = "pyqt6"
2119
addopts = [

setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ packages = find:
2929
install_requires =
3030
matplotlib
3131
napari>=0.5
32-
numpy>=1.23
32+
numpy>=2
3333
tinycss2
3434
python_requires = >=3.11
3535
include_package_data = True
@@ -56,6 +56,7 @@ docs =
5656
sphinx-gallery
5757
testing =
5858
napari[pyqt6_experimental]>=0.4.18
59+
numpy>=2.1
5960
pooch
6061
pyqt6
6162
pytest

src/napari_matplotlib/tests/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def fig_to_array(fig: Figure) -> npt.NDArray[np.uint8]:
1515
io_buf.seek(0)
1616
img_arr: npt.NDArray[np.uint8] = np.reshape(
1717
np.frombuffer(io_buf.getvalue(), dtype=np.uint8),
18-
newshape=(int(fig.bbox.bounds[3]), int(fig.bbox.bounds[2]), -1),
18+
shape=(int(fig.bbox.bounds[3]), int(fig.bbox.bounds[2]), -1),
1919
)
2020
return img_arr
2121

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py{310,311,312}
2+
envlist = py{311,312,313}
33
isolated_build = true
44

55
[gh-actions]

0 commit comments

Comments
 (0)