diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 782440d..10bc9d9 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.10', '3.11'] + python-version: ['3.11', '3.12', '3.13'] os: [macos-latest, ubuntu-latest, windows-latest] env: # Display must be available globally for linux to know where xvfb is diff --git a/.gitignore b/.gitignore index 66fa4da..7a092c7 100644 --- a/.gitignore +++ b/.gitignore @@ -107,4 +107,7 @@ _version_save.py .idea -pyjibe/_version.py \ No newline at end of file +pyjibe/_version.py + +# uv +uv.lock diff --git a/CHANGELOG b/CHANGELOG index ec949b3..fda13cc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,6 @@ 0.16.4 + - setup: support latest python versions (#32, #46) + - setup: support latest matplotlib versions (#32, #46) - fix: remember user's choice upon curve open (#44, #45) 0.16.3 - setup: bump afmformats to 0.18.6 diff --git a/pyjibe/fd/mpl_indent.py b/pyjibe/fd/mpl_indent.py index 77c9a66..5714f4e 100644 --- a/pyjibe/fd/mpl_indent.py +++ b/pyjibe/fd/mpl_indent.py @@ -104,13 +104,27 @@ def update(self, fdist, rescale_x=None, rescale_y=None): self.plots["residuals"].set_data(fdist["tip position"]*xscale, (fdist["fit residuals"])*yscale) # fit range - xy = self.plots["fit range"].get_xy() fitrange = (fdist[xaxis]*xscale)[fdist["fit range"]] fitmin = np.min(fitrange) fitmax = np.max(fitrange) - xy[:, 0] = fitmax - xy[2:4, 0] = fitmin - self.plots["fit range"].set_xy(xy) + fr_patch = self.plots["fit range"] + # Matplotlib changed `Axes.axvspan` from returning a + # Polygon (3.7.x) to returning a Rectangle (>=3.8). + if hasattr(fr_patch, "set_x") and hasattr(fr_patch, "set_width"): + fr_patch.set_x(fitmin) + fr_patch.set_width(fitmax - fitmin) + else: + xy = np.asarray(fr_patch.get_xy(), dtype=float).copy() + if xy.ndim == 2 and xy.shape[1] == 2 and xy.shape[0] >= 4: + # Expected vertex order: + # (xmin,0),(xmin,1),(xmax,1),(xmax,0),... + xy[0, 0] = fitmin + xy[1, 0] = fitmin + xy[2, 0] = fitmax + xy[3, 0] = fitmax + if xy.shape[0] >= 5: + xy[4, 0] = fitmin + fr_patch.set_xy(xy) self.update_plot(rescale_x=rescale_x, rescale_y=rescale_y) diff --git a/pyjibe/head/custom_widgets/mpl_navigation_toolbar_icons.py b/pyjibe/head/custom_widgets/mpl_navigation_toolbar_icons.py index 1da4e81..91035da 100644 --- a/pyjibe/head/custom_widgets/mpl_navigation_toolbar_icons.py +++ b/pyjibe/head/custom_widgets/mpl_navigation_toolbar_icons.py @@ -3,7 +3,7 @@ from PyQt6 import QtCore, QtGui, QtWidgets -from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT +from matplotlib.backends.backend_qtagg import NavigationToolbar2QT from matplotlib import cbook # TODO: diff --git a/pyproject.toml b/pyproject.toml index ccd34c5..9f80ae0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,8 +30,7 @@ license = { text = "GPL version 3.0 or later" } dependencies = [ "afmformats>=0.18.6", "nanite>=4.2.3", - # https://github.com/AFM-analysis/PyJibe/issues/32 - "matplotlib>=3,<3.7.5", # NavigationToolbar2QT mod + "matplotlib>3.7.5", # NavigationToolbar2QT mod "packaging", # for version checking during update "pyqt6", ] @@ -49,6 +48,10 @@ changelog = "https://pyjibe.readthedocs.io/en/stable/sec_changelog.html" [tool.setuptools] packages = ["pyjibe"] +[tool.coverage.run] +# sysmon is faster on py>=3.12 and avoids pytest collection hangs +core = "sysmon" + [tool.setuptools_scm] write_to = "pyjibe/_version.py" -version_scheme = "post-release" \ No newline at end of file +version_scheme = "post-release"