diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 782440d..31df5a6 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 @@ -53,6 +53,7 @@ jobs: env: # github token required for testing update.py GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERAGE_CORE: sysmon # for py>=3.12 this is much faster run: | coverage run --source=pyjibe -m pytest -x tests - name: Lint with flake8 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 c396111..26473e3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +0.16.4 + - setup: support latest python versions (#32, #46) + - setup: support latest matplotlib versions (#32, #46) 0.16.3 - setup: bump afmformats to 0.18.6 - setup: bump nanite to 4.2.3 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/pyproject.toml b/pyproject.toml index ccd34c5..3e1c471 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,<4", "packaging", # for version checking during update "pyqt6", ] @@ -51,4 +50,4 @@ packages = ["pyjibe"] [tool.setuptools_scm] write_to = "pyjibe/_version.py" -version_scheme = "post-release" \ No newline at end of file +version_scheme = "post-release"