From daca436666fbc4c94e0a31f9c56da8eb398c0bbe Mon Sep 17 00:00:00 2001 From: Ian Hunt-Isaak Date: Fri, 21 Feb 2025 22:01:33 -0500 Subject: [PATCH] BUG: fix version comparison (#10) * fix: fix version comparison that works for mpl >= 3.10 * docs: update rtd config --- .readthedocs.yaml | 21 ++++++++++++++------- pyproject.toml | 2 +- src/mpl_image_segmenter/_segmenter.py | 4 ++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 4079af7..2cf32f5 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -1,12 +1,19 @@ version: 2 -python: - version: 3.8 - install: - - method: pip - path: . - extra_requirements: - - doc + +# Set the OS, Python version and other tools you might need + +build: + os: ubuntu-22.04 + tools: + python: "3.12" + +python: + install: + - method: pip + path: . + extra_requirements: + - doc # Build documentation in the docs/ directory with Sphinx sphinx: configuration: docs/conf.py diff --git a/pyproject.toml b/pyproject.toml index 8805b7a..0526556 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "matplotlib", + "matplotlib>=3.5", "mpl-pan-zoom", "numpy", ] diff --git a/src/mpl_image_segmenter/_segmenter.py b/src/mpl_image_segmenter/_segmenter.py index 09f9d5d..5107198 100644 --- a/src/mpl_image_segmenter/_segmenter.py +++ b/src/mpl_image_segmenter/_segmenter.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING import numpy as np -from matplotlib import __version__ as mpl_version +from matplotlib import __version_info__ as mpl_version_info from matplotlib import get_backend from matplotlib.colors import TABLEAU_COLORS, XKCD_COLORS, to_rgba_array from matplotlib.path import Path @@ -126,7 +126,7 @@ def __init__( # type: ignore if isinstance(lasso_mousebutton, str): lasso_mousebutton = button_dict[lasso_mousebutton.lower()] - if mpl_version < "3.7": + if mpl_version_info < (3, 7): self.lasso = LassoSelector( self.ax, self._onselect,