Skip to content

Commit f217ee8

Browse files
feat: support py3.14 (#132)
* test py3.14 * add ignore * no napari in 314 * style(pre-commit.ci): auto fixes [...] * try fix precommit --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 42aaebe commit f217ee8

6 files changed

Lines changed: 13 additions & 13 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
strategy:
3232
fail-fast: false
3333
matrix:
34-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
34+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
3535
platform: [ubuntu-latest, macos-latest, windows-latest]
3636

3737
steps:

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ repos:
3434
- id: mypy
3535
files: "^src/"
3636
additional_dependencies:
37-
- numpy>=2.2
37+
- numpy>=2.4.0

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ classifiers = [
2121
"Programming Language :: Python :: 3.11",
2222
"Programming Language :: Python :: 3.12",
2323
"Programming Language :: Python :: 3.13",
24+
"Programming Language :: Python :: 3.14",
2425
]
2526
dynamic = ["version"]
2627
dependencies = ["numpy"]
@@ -34,7 +35,7 @@ test_thirdparty = [
3435
"colorspacious",
3536
"colour",
3637
"matplotlib",
37-
"napari>=0.5.0",
38+
"napari>=0.5.0; python_version<'3.14'",
3839
"PyQt6==6.8.1",
3940
"numba",
4041
"numba<0.61; python_version<'3.12'",
@@ -150,10 +151,9 @@ filterwarnings = [
150151
"ignore::DeprecationWarning:Pyinstaller",
151152
"ignore::DeprecationWarning:pkg_resources",
152153
"ignore::DeprecationWarning:altgraph",
153-
"ignore:'oneOf' deprecated:DeprecationWarning:matplotlib",
154-
"ignore:'parseString' deprecated:DeprecationWarning:matplotlib",
155-
"ignore:'resetCache' deprecated:DeprecationWarning:matplotlib",
156-
"ignore:'enablePackrat' deprecated:DeprecationWarning:matplotlib",
154+
"ignore::DeprecationWarning:pyparsing",
155+
"ignore::DeprecationWarning:matplotlib._mathtext",
156+
"ignore::DeprecationWarning:matplotlib._fontconfig_pattern",
157157
]
158158

159159
# https://mypy.readthedocs.io/en/stable/config_file.html

src/cmap/_color.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ def __getitem__(self, key: int) -> float:
603603
def __iter__(self) -> Iterator[float]:
604604
return iter(self._rgba)
605605

606-
def __array__(self, dtype: npt.DTypeLike = None) -> np.ndarray:
606+
def __array__(self, dtype: npt.DTypeLike | None = None) -> np.ndarray:
607607
return np.asarray(self._rgba, dtype=dtype)
608608

609609
@property

src/cmap/_colormap.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ def __reversed__(self) -> Iterator[ColorStop]:
10061006
# reverse the colors, but not the positions
10071007
yield ColorStop(1 - pos, Color(rgba))
10081008

1009-
def __array__(self, dtype: npt.DTypeLike = None) -> np.ndarray:
1009+
def __array__(self, dtype: npt.DTypeLike | None = None) -> np.ndarray:
10101010
"""Return (N, 5) array, N rows of (position, r, g, b, a)."""
10111011
return self._stops if dtype is None else self._stops.astype(dtype)
10121012

@@ -1522,5 +1522,4 @@ def _wrap_shift_color_stops(data: np.ndarray, shift_amount: float) -> np.ndarray
15221522
out[:, 0] += shift_amount
15231523
out[:, 0] %= 1
15241524
# sort the array by the first column
1525-
out = out[out[:, 0].argsort()]
1526-
return out # type: ignore[no-any-return]
1525+
return out[out[:, 0].argsort()]

src/cmap/data/glasbey/_glasbey.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# see __init__ and LICENSE_GLASBEY
33
from __future__ import annotations
44

5-
from typing import Literal
5+
from typing import Literal, cast
66

77
import numpy as np
88

@@ -185,4 +185,5 @@ def create_palette(
185185

186186
def _get_rgb_palette(cam02ucs_palette: np.ndarray) -> np.ndarray:
187187
raw_rgb_palette = _cspace_convert(cam02ucs_palette, "CAM02-UCS", "sRGB1")
188-
return np.clip(raw_rgb_palette, 0.0, 1.0)
188+
out = np.clip(raw_rgb_palette, 0.0, 1.0)
189+
return cast("np.ndarray", out)

0 commit comments

Comments
 (0)