diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60a938110..37e1769f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] platform: [ubuntu-latest, macos-latest, windows-latest] steps: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8186ce787..f53e20a3b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,4 +34,4 @@ repos: - id: mypy files: "^src/" additional_dependencies: - - numpy>=2.2 + - numpy>=2.4.0 diff --git a/pyproject.toml b/pyproject.toml index 5cb275034..9bf16b37b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", ] dynamic = ["version"] dependencies = ["numpy"] @@ -34,7 +35,7 @@ test_thirdparty = [ "colorspacious", "colour", "matplotlib", - "napari>=0.5.0", + "napari>=0.5.0; python_version<'3.14'", "PyQt6==6.8.1", "numba", "numba<0.61; python_version<'3.12'", @@ -150,10 +151,9 @@ filterwarnings = [ "ignore::DeprecationWarning:Pyinstaller", "ignore::DeprecationWarning:pkg_resources", "ignore::DeprecationWarning:altgraph", - "ignore:'oneOf' deprecated:DeprecationWarning:matplotlib", - "ignore:'parseString' deprecated:DeprecationWarning:matplotlib", - "ignore:'resetCache' deprecated:DeprecationWarning:matplotlib", - "ignore:'enablePackrat' deprecated:DeprecationWarning:matplotlib", + "ignore::DeprecationWarning:pyparsing", + "ignore::DeprecationWarning:matplotlib._mathtext", + "ignore::DeprecationWarning:matplotlib._fontconfig_pattern", ] # https://mypy.readthedocs.io/en/stable/config_file.html diff --git a/src/cmap/_color.py b/src/cmap/_color.py index 56cde019b..4eb3b2a17 100644 --- a/src/cmap/_color.py +++ b/src/cmap/_color.py @@ -603,7 +603,7 @@ def __getitem__(self, key: int) -> float: def __iter__(self) -> Iterator[float]: return iter(self._rgba) - def __array__(self, dtype: npt.DTypeLike = None) -> np.ndarray: + def __array__(self, dtype: npt.DTypeLike | None = None) -> np.ndarray: return np.asarray(self._rgba, dtype=dtype) @property diff --git a/src/cmap/_colormap.py b/src/cmap/_colormap.py index ba4712891..748742ddc 100644 --- a/src/cmap/_colormap.py +++ b/src/cmap/_colormap.py @@ -1006,7 +1006,7 @@ def __reversed__(self) -> Iterator[ColorStop]: # reverse the colors, but not the positions yield ColorStop(1 - pos, Color(rgba)) - def __array__(self, dtype: npt.DTypeLike = None) -> np.ndarray: + def __array__(self, dtype: npt.DTypeLike | None = None) -> np.ndarray: """Return (N, 5) array, N rows of (position, r, g, b, a).""" return self._stops if dtype is None else self._stops.astype(dtype) @@ -1522,5 +1522,4 @@ def _wrap_shift_color_stops(data: np.ndarray, shift_amount: float) -> np.ndarray out[:, 0] += shift_amount out[:, 0] %= 1 # sort the array by the first column - out = out[out[:, 0].argsort()] - return out # type: ignore[no-any-return] + return out[out[:, 0].argsort()] diff --git a/src/cmap/data/glasbey/_glasbey.py b/src/cmap/data/glasbey/_glasbey.py index 2eef99f13..f8adfd389 100644 --- a/src/cmap/data/glasbey/_glasbey.py +++ b/src/cmap/data/glasbey/_glasbey.py @@ -2,7 +2,7 @@ # see __init__ and LICENSE_GLASBEY from __future__ import annotations -from typing import Literal +from typing import Literal, cast import numpy as np @@ -185,4 +185,5 @@ def create_palette( def _get_rgb_palette(cam02ucs_palette: np.ndarray) -> np.ndarray: raw_rgb_palette = _cspace_convert(cam02ucs_palette, "CAM02-UCS", "sRGB1") - return np.clip(raw_rgb_palette, 0.0, 1.0) + out = np.clip(raw_rgb_palette, 0.0, 1.0) + return cast("np.ndarray", out)