Skip to content

Commit c4c38c6

Browse files
authored
Merge pull request #222 from dstansby/nopy38
Remove support for Python 3.8
2 parents 16084b2 + d768a92 commit c4c38c6

File tree

12 files changed

+31
-31
lines changed

12 files changed

+31
-31
lines changed

.github/workflows/test_and_deploy.yml

+1-1
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.8', '3.9', '3.10', '3.11']
23+
python-version: ['3.9', '3.10', '3.11']
2424

2525
steps:
2626
- uses: actions/checkout@v3

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ repos:
2020
rev: v1.6.0
2121
hooks:
2222
- id: mypy
23-
additional_dependencies: [numpy, matplotlib<3.8]
23+
additional_dependencies: [numpy, matplotlib]
2424

2525
- repo: https://github.com/astral-sh/ruff-pre-commit
2626
# Ruff version.

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ profile = "black"
2323
line_length = 79
2424

2525
[tool.ruff]
26-
target-version = "py38"
26+
target-version = "py39"
2727
select = ["I", "UP", "F", "E", "W", "D"]
2828
ignore = [
2929
"D100", # Missing docstring in public module
@@ -45,7 +45,7 @@ fix = true
4545
convention = "numpy"
4646

4747
[tool.mypy]
48-
python_version = "3.8"
48+
python_version = "3.9"
4949
# Block below are checks that form part of mypy 'strict' mode
5050
warn_unused_configs = true
5151
warn_redundant_casts = true

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ install_requires =
3131
napari
3232
numpy
3333
tinycss2
34-
python_requires = >=3.8
34+
python_requires = >=3.9
3535
include_package_data = True
3636
package_dir =
3737
=src

src/napari_matplotlib/base.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22
from pathlib import Path
3-
from typing import List, Optional, Tuple
3+
from typing import Optional
44

55
import matplotlib
66
import matplotlib.style as mplstyle
@@ -184,7 +184,7 @@ class NapariMPLWidget(BaseNapariMPLWidget):
184184
#: Number of layers taken as input
185185
n_layers_input = Interval(None, None)
186186
#: Type of layer taken as input
187-
input_layer_types: Tuple[napari.layers.Layer, ...] = (napari.layers.Layer,)
187+
input_layer_types: tuple[napari.layers.Layer, ...] = (napari.layers.Layer,)
188188

189189
def __init__(
190190
self,
@@ -193,7 +193,7 @@ def __init__(
193193
):
194194
super().__init__(napari_viewer=napari_viewer, parent=parent)
195195
self._setup_callbacks()
196-
self.layers: List[napari.layers.Layer] = []
196+
self.layers: list[napari.layers.Layer] = []
197197

198198
helper_text = self.n_layers_input._helper_text
199199
if helper_text is not None:

src/napari_matplotlib/histogram.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, List, Optional, Tuple
1+
from typing import Any, Optional
22

33
import napari
44
import numpy as np
@@ -107,7 +107,7 @@ def _set_axis_keys(self, x_axis_key: str) -> None:
107107
self._x_axis_key = x_axis_key
108108
self._draw()
109109

110-
def _get_valid_axis_keys(self) -> List[str]:
110+
def _get_valid_axis_keys(self) -> list[str]:
111111
"""
112112
Get the valid axis keys from the layer FeatureTable.
113113
@@ -122,7 +122,7 @@ def _get_valid_axis_keys(self) -> List[str]:
122122
else:
123123
return self.layers[0].features.keys()
124124

125-
def _get_data(self) -> Tuple[Optional[npt.NDArray[Any]], str]:
125+
def _get_data(self) -> tuple[Optional[npt.NDArray[Any]], str]:
126126
"""Get the plot data.
127127
128128
Returns

src/napari_matplotlib/scatter.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, List, Optional, Tuple, Union
1+
from typing import Any, Optional, Union
22

33
import napari
44
import numpy.typing as npt
@@ -40,7 +40,7 @@ def draw(self) -> None:
4040
self.axes.set_xlabel(x_axis_name)
4141
self.axes.set_ylabel(y_axis_name)
4242

43-
def _get_data(self) -> Tuple[npt.NDArray[Any], npt.NDArray[Any], str, str]:
43+
def _get_data(self) -> tuple[npt.NDArray[Any], npt.NDArray[Any], str, str]:
4444
"""
4545
Get the plot data.
4646
@@ -67,7 +67,7 @@ class ScatterWidget(ScatterBaseWidget):
6767
n_layers_input = Interval(2, 2)
6868
input_layer_types = (napari.layers.Image,)
6969

70-
def _get_data(self) -> Tuple[npt.NDArray[Any], npt.NDArray[Any], str, str]:
70+
def _get_data(self) -> tuple[npt.NDArray[Any], npt.NDArray[Any], str, str]:
7171
"""
7272
Get the plot data.
7373
@@ -106,7 +106,7 @@ def __init__(
106106

107107
self.layout().addLayout(QVBoxLayout())
108108

109-
self._selectors: Dict[str, QComboBox] = {}
109+
self._selectors: dict[str, QComboBox] = {}
110110
for dim in ["x", "y"]:
111111
self._selectors[dim] = QComboBox()
112112
# Re-draw when combo boxes are updated
@@ -147,7 +147,7 @@ def y_axis_key(self, key: str) -> None:
147147
self._selectors["y"].setCurrentText(key)
148148
self._draw()
149149

150-
def _get_valid_axis_keys(self) -> List[str]:
150+
def _get_valid_axis_keys(self) -> list[str]:
151151
"""
152152
Get the valid axis keys from the layer FeatureTable.
153153
@@ -186,7 +186,7 @@ def draw(self) -> None:
186186
if self._ready_to_scatter():
187187
super().draw()
188188

189-
def _get_data(self) -> Tuple[npt.NDArray[Any], npt.NDArray[Any], str, str]:
189+
def _get_data(self) -> tuple[npt.NDArray[Any], npt.NDArray[Any], str, str]:
190190
"""
191191
Get the plot data from the ``features`` attribute of the first
192192
selected layer.

src/napari_matplotlib/slice.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, List, Optional, Tuple
1+
from typing import Any, Optional
22

33
import matplotlib.ticker as mticker
44
import napari
@@ -99,7 +99,7 @@ def current_dim_index(self) -> int:
9999
return self._dim_names.index(self.current_dim_name)
100100

101101
@property
102-
def _dim_names(self) -> List[str]:
102+
def _dim_names(self) -> list[str]:
103103
"""
104104
List of dimension names. This is a property as it varies depending on the
105105
dimensionality of the currently selected data.
@@ -111,7 +111,7 @@ def _dim_names(self) -> List[str]:
111111
else:
112112
raise RuntimeError("Don't know how to handle ndim != 2 or 3")
113113

114-
def _get_xy(self) -> Tuple[npt.NDArray[Any], npt.NDArray[Any]]:
114+
def _get_xy(self) -> tuple[npt.NDArray[Any], npt.NDArray[Any]]:
115115
"""
116116
Get data for plotting.
117117
"""

src/napari_matplotlib/tests/scatter/test_scatter_features.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from copy import deepcopy
2-
from typing import Any, Dict, Tuple
2+
from typing import Any
33

44
import numpy as np
55
import numpy.typing as npt
@@ -34,7 +34,7 @@ def test_features_scatter_widget_2D(
3434

3535

3636
def make_labels_layer_with_features() -> (
37-
Tuple[npt.NDArray[np.uint16], Dict[str, Any]]
37+
tuple[npt.NDArray[np.uint16], dict[str, Any]]
3838
):
3939
label_image: npt.NDArray[np.uint16] = np.zeros((100, 100), dtype=np.uint16)
4040
for label_value, start_index in enumerate([10, 30, 50], start=1):

src/napari_matplotlib/tests/test_layer_changes.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from copy import deepcopy
2-
from typing import Any, Dict, Tuple, Type
2+
from typing import Any
33

44
import numpy as np
55
import numpy.typing as npt
@@ -61,8 +61,8 @@ def test_change_features_layer(
6161

6262
def assert_features_plot_changes(
6363
viewer: Viewer,
64-
widget_cls: Type[NapariMPLWidget],
65-
data: Tuple[npt.NDArray[np.generic], Dict[str, Any]],
64+
widget_cls: type[NapariMPLWidget],
65+
data: tuple[npt.NDArray[np.generic], dict[str, Any]],
6666
) -> None:
6767
"""
6868
When the selected layer is changed, make sure the plot generated

src/napari_matplotlib/util.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import List, Optional, Tuple, Union
1+
from typing import Optional, Union
22
from warnings import warn
33

44
import napari.qt
@@ -76,7 +76,7 @@ def _helper_text(self) -> Optional[str]:
7676
return helper_text
7777

7878

79-
def _has_id(nodes: List[tinycss2.ast.Node], id_name: str) -> bool:
79+
def _has_id(nodes: list[tinycss2.ast.Node], id_name: str) -> bool:
8080
"""
8181
Is `id_name` in IdentTokens in the list of CSS `nodes`?
8282
"""
@@ -86,7 +86,7 @@ def _has_id(nodes: List[tinycss2.ast.Node], id_name: str) -> bool:
8686

8787

8888
def _get_dimension(
89-
nodes: List[tinycss2.ast.Node], id_name: str
89+
nodes: list[tinycss2.ast.Node], id_name: str
9090
) -> Union[int, None]:
9191
"""
9292
Get the value of the DimensionToken for the IdentToken `id_name`.
@@ -108,7 +108,7 @@ def _get_dimension(
108108

109109

110110
def from_napari_css_get_size_of(
111-
qt_element_name: str, fallback: Tuple[int, int]
111+
qt_element_name: str, fallback: tuple[int, int]
112112
) -> QSize:
113113
"""
114114
Get the size of `qt_element_name` from napari's current stylesheet.

tox.ini

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[tox]
2-
envlist = py{38,39,310,311}
2+
envlist = py{39,310,311}
33
isolated_build = true
44

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

1111
[testenv]
1212
extras = testing

0 commit comments

Comments
 (0)