Skip to content

Remove support for Python 3.8 #222

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

Merged
merged 2 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
rev: v1.6.0
hooks:
- id: mypy
additional_dependencies: [numpy, matplotlib<3.8]
additional_dependencies: [numpy, matplotlib]

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ profile = "black"
line_length = 79

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

[tool.mypy]
python_version = "3.8"
python_version = "3.9"
# Block below are checks that form part of mypy 'strict' mode
warn_unused_configs = true
warn_redundant_casts = true
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ install_requires =
napari
numpy
tinycss2
python_requires = >=3.8
python_requires = >=3.9
include_package_data = True
package_dir =
=src
Expand Down
6 changes: 3 additions & 3 deletions src/napari_matplotlib/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
from pathlib import Path
from typing import List, Optional, Tuple
from typing import Optional

import matplotlib
import matplotlib.style as mplstyle
Expand Down Expand Up @@ -184,7 +184,7 @@ class NapariMPLWidget(BaseNapariMPLWidget):
#: Number of layers taken as input
n_layers_input = Interval(None, None)
#: Type of layer taken as input
input_layer_types: Tuple[napari.layers.Layer, ...] = (napari.layers.Layer,)
input_layer_types: tuple[napari.layers.Layer, ...] = (napari.layers.Layer,)

def __init__(
self,
Expand All @@ -193,7 +193,7 @@ def __init__(
):
super().__init__(napari_viewer=napari_viewer, parent=parent)
self._setup_callbacks()
self.layers: List[napari.layers.Layer] = []
self.layers: list[napari.layers.Layer] = []

helper_text = self.n_layers_input._helper_text
if helper_text is not None:
Expand Down
6 changes: 3 additions & 3 deletions src/napari_matplotlib/histogram.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, List, Optional, Tuple
from typing import Any, Optional

import napari
import numpy as np
Expand Down Expand Up @@ -107,7 +107,7 @@ def _set_axis_keys(self, x_axis_key: str) -> None:
self._x_axis_key = x_axis_key
self._draw()

def _get_valid_axis_keys(self) -> List[str]:
def _get_valid_axis_keys(self) -> list[str]:
"""
Get the valid axis keys from the layer FeatureTable.

Expand All @@ -122,7 +122,7 @@ def _get_valid_axis_keys(self) -> List[str]:
else:
return self.layers[0].features.keys()

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

Returns
Expand Down
12 changes: 6 additions & 6 deletions src/napari_matplotlib/scatter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Dict, List, Optional, Tuple, Union
from typing import Any, Optional, Union

import napari
import numpy.typing as npt
Expand Down Expand Up @@ -40,7 +40,7 @@ def draw(self) -> None:
self.axes.set_xlabel(x_axis_name)
self.axes.set_ylabel(y_axis_name)

def _get_data(self) -> Tuple[npt.NDArray[Any], npt.NDArray[Any], str, str]:
def _get_data(self) -> tuple[npt.NDArray[Any], npt.NDArray[Any], str, str]:
"""
Get the plot data.

Expand All @@ -67,7 +67,7 @@ class ScatterWidget(ScatterBaseWidget):
n_layers_input = Interval(2, 2)
input_layer_types = (napari.layers.Image,)

def _get_data(self) -> Tuple[npt.NDArray[Any], npt.NDArray[Any], str, str]:
def _get_data(self) -> tuple[npt.NDArray[Any], npt.NDArray[Any], str, str]:
"""
Get the plot data.

Expand Down Expand Up @@ -106,7 +106,7 @@ def __init__(

self.layout().addLayout(QVBoxLayout())

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

def _get_valid_axis_keys(self) -> List[str]:
def _get_valid_axis_keys(self) -> list[str]:
"""
Get the valid axis keys from the layer FeatureTable.

Expand Down Expand Up @@ -186,7 +186,7 @@ def draw(self) -> None:
if self._ready_to_scatter():
super().draw()

def _get_data(self) -> Tuple[npt.NDArray[Any], npt.NDArray[Any], str, str]:
def _get_data(self) -> tuple[npt.NDArray[Any], npt.NDArray[Any], str, str]:
"""
Get the plot data from the ``features`` attribute of the first
selected layer.
Expand Down
6 changes: 3 additions & 3 deletions src/napari_matplotlib/slice.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, List, Optional, Tuple
from typing import Any, Optional

import matplotlib.ticker as mticker
import napari
Expand Down Expand Up @@ -99,7 +99,7 @@ def current_dim_index(self) -> int:
return self._dim_names.index(self.current_dim_name)

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

def _get_xy(self) -> Tuple[npt.NDArray[Any], npt.NDArray[Any]]:
def _get_xy(self) -> tuple[npt.NDArray[Any], npt.NDArray[Any]]:
"""
Get data for plotting.
"""
Expand Down
4 changes: 2 additions & 2 deletions src/napari_matplotlib/tests/scatter/test_scatter_features.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from copy import deepcopy
from typing import Any, Dict, Tuple
from typing import Any

import numpy as np
import numpy.typing as npt
Expand Down Expand Up @@ -34,7 +34,7 @@ def test_features_scatter_widget_2D(


def make_labels_layer_with_features() -> (
Tuple[npt.NDArray[np.uint16], Dict[str, Any]]
tuple[npt.NDArray[np.uint16], dict[str, Any]]
):
label_image: npt.NDArray[np.uint16] = np.zeros((100, 100), dtype=np.uint16)
for label_value, start_index in enumerate([10, 30, 50], start=1):
Expand Down
6 changes: 3 additions & 3 deletions src/napari_matplotlib/tests/test_layer_changes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from copy import deepcopy
from typing import Any, Dict, Tuple, Type
from typing import Any

import numpy as np
import numpy.typing as npt
Expand Down Expand Up @@ -61,8 +61,8 @@ def test_change_features_layer(

def assert_features_plot_changes(
viewer: Viewer,
widget_cls: Type[NapariMPLWidget],
data: Tuple[npt.NDArray[np.generic], Dict[str, Any]],
widget_cls: type[NapariMPLWidget],
data: tuple[npt.NDArray[np.generic], dict[str, Any]],
) -> None:
"""
When the selected layer is changed, make sure the plot generated
Expand Down
8 changes: 4 additions & 4 deletions src/napari_matplotlib/util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List, Optional, Tuple, Union
from typing import Optional, Union
from warnings import warn

import napari.qt
Expand Down Expand Up @@ -76,7 +76,7 @@ def _helper_text(self) -> Optional[str]:
return helper_text


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


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


def from_napari_css_get_size_of(
qt_element_name: str, fallback: Tuple[int, int]
qt_element_name: str, fallback: tuple[int, int]
) -> QSize:
"""
Get the size of `qt_element_name` from napari's current stylesheet.
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[tox]
envlist = py{38,39,310,311}
envlist = py{39,310,311}
isolated_build = true

[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311

[testenv]
extras = testing
Expand Down