Skip to content

Commit 76db917

Browse files
authored
Merge pull request #262 from dstansby/nep29
Adhere to SPEC0
2 parents dc326e7 + 1818110 commit 76db917

File tree

10 files changed

+37
-30
lines changed

10 files changed

+37
-30
lines changed

.github/workflows/test_and_deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
platform: [ubuntu-latest, macos-latest, windows-latest]
23-
python-version: ['3.9', '3.10', '3.11']
23+
python-version: ['3.10', '3.11', '3.12']
2424

2525
steps:
2626
- uses: actions/checkout@v3
@@ -64,7 +64,7 @@ jobs:
6464
if: github.event_name != 'merge_group'
6565
with:
6666
token: ${{ secrets.CODECOV_TOKEN }}
67-
fail_ci_if_error: true
67+
fail_ci_if_error: false
6868

6969

7070

docs/changelog.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
Changelog
22
=========
3+
2.0.2
4+
-----
5+
Dependencies
6+
~~~~~~~~~~~~
7+
napari-matplotlib now adheres to `SPEC 0 <https://scientific-python.org/specs/spec-0000/>`_, and has:
8+
- Dropped support for Python 3.9
9+
- Added support for Python 3.12
10+
- Added a minimum required numpy verison of 1.23
11+
312
2.0.1
413
-----
514
Bug fixes

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ filterwarnings = [
1212
# Coming from vispy
1313
"ignore:distutils Version classes are deprecated:DeprecationWarning",
1414
"ignore:`np.bool8` is a deprecated alias for `np.bool_`:DeprecationWarning",
15+
# Coming from pydantic via napari
16+
"ignore:Pickle, copy, and deepcopy support will be removed from itertools in Python 3.14.:DeprecationWarning"
1517
]
1618
qt_api = "pyqt6"
1719
addopts = "--mpl --mpl-baseline-relative"
@@ -24,7 +26,7 @@ profile = "black"
2426
line_length = 79
2527

2628
[tool.ruff]
27-
target-version = "py39"
29+
target-version = "py310"
2830
select = ["I", "UP", "F", "E", "W", "D"]
2931
ignore = [
3032
"D100", # Missing docstring in public module
@@ -46,7 +48,7 @@ fix = true
4648
convention = "numpy"
4749

4850
[tool.mypy]
49-
python_version = "3.9"
51+
python_version = "3.10"
5052
# Block below are checks that form part of mypy 'strict' mode
5153
strict = true
5254
disallow_subclassing_any = false # TODO: fix

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ packages = find:
2929
install_requires =
3030
matplotlib
3131
napari
32-
numpy
32+
numpy>=1.23
3333
tinycss2
34-
python_requires = >=3.9
34+
python_requires = >=3.10
3535
include_package_data = True
3636
package_dir =
3737
=src

src/napari_matplotlib/base.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22
from pathlib import Path
3-
from typing import Optional
43

54
import matplotlib.style as mplstyle
65
import napari
@@ -38,7 +37,7 @@ class BaseNapariMPLWidget(QWidget):
3837
def __init__(
3938
self,
4039
napari_viewer: napari.Viewer,
41-
parent: Optional[QWidget] = None,
40+
parent: QWidget | None = None,
4241
):
4342
super().__init__(parent=parent)
4443
self.viewer = napari_viewer
@@ -173,7 +172,7 @@ class NapariMPLWidget(BaseNapariMPLWidget):
173172
def __init__(
174173
self,
175174
napari_viewer: napari.viewer.Viewer,
176-
parent: Optional[QWidget] = None,
175+
parent: QWidget | None = None,
177176
):
178177
super().__init__(napari_viewer=napari_viewer, parent=parent)
179178
self._setup_callbacks()
@@ -282,7 +281,7 @@ class SingleAxesWidget(NapariMPLWidget):
282281
def __init__(
283282
self,
284283
napari_viewer: napari.viewer.Viewer,
285-
parent: Optional[QWidget] = None,
284+
parent: QWidget | None = None,
286285
):
287286
super().__init__(napari_viewer=napari_viewer, parent=parent)
288287
self.add_single_axes()

src/napari_matplotlib/histogram.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Optional, cast
1+
from typing import Any, cast
22

33
import napari
44
import numpy as np
@@ -44,7 +44,7 @@ class HistogramWidget(SingleAxesWidget):
4444
def __init__(
4545
self,
4646
napari_viewer: napari.viewer.Viewer,
47-
parent: Optional[QWidget] = None,
47+
parent: QWidget | None = None,
4848
):
4949
super().__init__(napari_viewer, parent=parent)
5050
self._update_layers(None)
@@ -121,7 +121,7 @@ class FeaturesHistogramWidget(SingleAxesWidget):
121121
def __init__(
122122
self,
123123
napari_viewer: napari.viewer.Viewer,
124-
parent: Optional[QWidget] = None,
124+
parent: QWidget | None = None,
125125
):
126126
super().__init__(napari_viewer, parent=parent)
127127

@@ -137,12 +137,12 @@ def __init__(
137137
self._update_layers(None)
138138

139139
@property
140-
def x_axis_key(self) -> Optional[str]:
140+
def x_axis_key(self) -> str | None:
141141
"""Key to access x axis data from the FeaturesTable"""
142142
return self._x_axis_key
143143

144144
@x_axis_key.setter
145-
def x_axis_key(self, key: Optional[str]) -> None:
145+
def x_axis_key(self, key: str | None) -> None:
146146
self._x_axis_key = key
147147
self._draw()
148148

@@ -166,7 +166,7 @@ def _get_valid_axis_keys(self) -> list[str]:
166166
else:
167167
return self.layers[0].features.keys()
168168

169-
def _get_data(self) -> tuple[Optional[npt.NDArray[Any]], str]:
169+
def _get_data(self) -> tuple[npt.NDArray[Any] | None, str]:
170170
"""Get the plot data.
171171
172172
Returns

src/napari_matplotlib/scatter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Optional, Union
1+
from typing import Any
22

33
import napari
44
import numpy.typing as npt
@@ -100,7 +100,7 @@ class FeaturesScatterWidget(ScatterBaseWidget):
100100
def __init__(
101101
self,
102102
napari_viewer: napari.viewer.Viewer,
103-
parent: Optional[QWidget] = None,
103+
parent: QWidget | None = None,
104104
):
105105
super().__init__(napari_viewer, parent=parent)
106106

@@ -118,7 +118,7 @@ def __init__(
118118
self._update_layers(None)
119119

120120
@property
121-
def x_axis_key(self) -> Union[str, None]:
121+
def x_axis_key(self) -> str | None:
122122
"""
123123
Key for the x-axis data.
124124
"""
@@ -133,7 +133,7 @@ def x_axis_key(self, key: str) -> None:
133133
self._draw()
134134

135135
@property
136-
def y_axis_key(self) -> Union[str, None]:
136+
def y_axis_key(self) -> str | None:
137137
"""
138138
Key for the y-axis data.
139139
"""

src/napari_matplotlib/slice.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Optional
1+
from typing import Any
22

33
import matplotlib.ticker as mticker
44
import napari
@@ -30,7 +30,7 @@ class SliceWidget(SingleAxesWidget):
3030
def __init__(
3131
self,
3232
napari_viewer: napari.viewer.Viewer,
33-
parent: Optional[QWidget] = None,
33+
parent: QWidget | None = None,
3434
):
3535
# Setup figure/axes
3636
super().__init__(napari_viewer, parent=parent)

src/napari_matplotlib/util.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from typing import Optional, Union
21
from warnings import warn
32

43
import napari.qt
@@ -12,7 +11,7 @@ class Interval:
1211
An integer interval.
1312
"""
1413

15-
def __init__(self, lower_bound: Optional[int], upper_bound: Optional[int]):
14+
def __init__(self, lower_bound: int | None, upper_bound: int | None):
1615
"""
1716
Parameters
1817
----------
@@ -48,7 +47,7 @@ def __contains__(self, val: int) -> bool:
4847
return True
4948

5049
@property
51-
def _helper_text(self) -> Optional[str]:
50+
def _helper_text(self) -> str | None:
5251
"""
5352
Helper text for widgets.
5453
"""
@@ -86,9 +85,7 @@ def _has_id(nodes: list[tinycss2.ast.Node], id_name: str) -> bool:
8685
)
8786

8887

89-
def _get_dimension(
90-
nodes: list[tinycss2.ast.Node], id_name: str
91-
) -> Union[int, None]:
88+
def _get_dimension(nodes: list[tinycss2.ast.Node], id_name: str) -> int | None:
9289
"""
9390
Get the value of the DimensionToken for the IdentToken `id_name`.
9491

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[tox]
2-
envlist = py{39,310,311}
2+
envlist = py{310,311,312}
33
isolated_build = true
44

55
[gh-actions]
66
python =
7-
3.9: py39
87
3.10: py310
98
3.11: py311
9+
3.12: py312
1010

1111
[testenv]
1212
extras = testing

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy