diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3076319d..737bf178 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] platform: [ubuntu-latest, macos-latest, windows-latest] backend: [pyqt5] include: diff --git a/magicclass/ext/vispy/__init__.py b/magicclass/ext/vispy/__init__.py index 06dced29..c1b76bfa 100644 --- a/magicclass/ext/vispy/__init__.py +++ b/magicclass/ext/vispy/__init__.py @@ -1,10 +1,13 @@ -from .widgets2d import ( - VispyPlotCanvas, - VispyImageCanvas, - VispyMultiPlotCanvas, - VispyMultiImageCanvas, -) -from .widgets3d import Vispy3DCanvas, VispyMulti3DCanvas +try: + from .widgets2d import ( + VispyPlotCanvas, + VispyImageCanvas, + VispyMultiPlotCanvas, + VispyMultiImageCanvas, + ) + from .widgets3d import Vispy3DCanvas, VispyMulti3DCanvas +except OSError: + pass # cannot run vispy in macOS and python 3.13 __all__ = [ "VispyPlotCanvas", diff --git a/magicclass/ext/vispy/tests/test_vispy2d.py b/magicclass/ext/vispy/tests/test_vispy2d.py index e6b33a88..d92bab9a 100644 --- a/magicclass/ext/vispy/tests/test_vispy2d.py +++ b/magicclass/ext/vispy/tests/test_vispy2d.py @@ -1,8 +1,12 @@ +import sys import numpy as np from numpy.testing import assert_allclose -from magicclass.ext.vispy import VispyPlotCanvas +import pytest +@pytest.mark.skipif(not (sys.version_info < (3, 13)), reason="requires python<3.13") def test_add_and_delete_data(): + from magicclass.ext.vispy import VispyPlotCanvas + canvas = VispyPlotCanvas() curve = canvas.add_curve(np.random.random(100), color="blue") assert len(canvas.layers) == 1 diff --git a/magicclass/functools/_dispatch.py b/magicclass/functools/_dispatch.py index ae8f7637..27bd4a92 100644 --- a/magicclass/functools/_dispatch.py +++ b/magicclass/functools/_dispatch.py @@ -118,11 +118,8 @@ class singledispatchmethod(functools.singledispatchmethod): """ def __init__(self, func): - if not callable(func) and not hasattr(func, "__get__"): - raise TypeError(f"{func!r} is not callable or a descriptor") - + super().__init__(func) self.dispatcher = singledispatch(func) - self.func = func if sys.version_info < (3, 10): self._wrapped_func = func functools.update_wrapper( diff --git a/pyproject.toml b/pyproject.toml index ac3ba9bd..3dfca1f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,17 +9,17 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] dynamic = ["version"] description = "Generate multifunctional GUIs from classes" readme = "README.md" license = { file = "LICENSE" } -requires-python = ">=3.8" +requires-python = ">=3.9" authors = [ { name = "Hanjin Liu", email = "liuhanjin-sc@g.ecc.u-tokyo.ac.jp" }, ]