Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-mplcursors for openSUSE:Factory checked in at 2023-01-10 15:00:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-mplcursors (Old) and /work/SRC/openSUSE:Factory/.python-mplcursors.new.32243 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-mplcursors" Tue Jan 10 15:00:04 2023 rev:7 rq:1057614 version:0.5.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-mplcursors/python-mplcursors.changes 2022-01-22 08:18:37.574725013 +0100 +++ /work/SRC/openSUSE:Factory/.python-mplcursors.new.32243/python-mplcursors.changes 2023-01-10 15:00:34.401465348 +0100 @@ -1,0 +2,7 @@ +Mon Jan 9 21:07:06 UTC 2023 - Ben Greiner <c...@bnavigator.de> + +- Update to v0.5.2 + * Fix compatibility with Matplotlib 3.6 and with PEP517 builds. + * Non-multiple cursors can now be dragged. + +------------------------------------------------------------------- Old: ---- mplcursors-0.5.1.tar.gz New: ---- mplcursors-0.5.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-mplcursors.spec ++++++ --- /var/tmp/diff_new_pack.n9YEqF/_old 2023-01-10 15:00:34.789467577 +0100 +++ /var/tmp/diff_new_pack.n9YEqF/_new 2023-01-10 15:00:34.793467599 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-mplcursors # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,17 +16,18 @@ # -%{?!python_module:%define python_module() python3-%{**}} %define skip_python2 1 Name: python-mplcursors -Version: 0.5.1 +Version: 0.5.2 Release: 0 Summary: Interactive data selection cursors for Matplotlib License: MIT URL: https://github.com/anntzer/mplcursors Source: https://files.pythonhosted.org/packages/source/m/mplcursors/mplcursors-%{version}.tar.gz +BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools_scm} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-matplotlib >= 3.1 @@ -45,10 +46,10 @@ %autopatch -p1 %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check ++++++ mplcursors-0.5.1.tar.gz -> mplcursors-0.5.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/.codecov.yml new/mplcursors-0.5.2/.codecov.yml --- old/mplcursors-0.5.1/.codecov.yml 2020-01-19 19:15:57.000000000 +0100 +++ new/mplcursors-0.5.2/.codecov.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -comment: false diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/.coveragerc new/mplcursors-0.5.2/.coveragerc --- old/mplcursors-0.5.1/.coveragerc 2021-08-24 23:05:24.000000000 +0200 +++ new/mplcursors-0.5.2/.coveragerc 1970-01-01 01:00:00.000000000 +0100 @@ -1,4 +0,0 @@ -[run] -branch = true -source = mplcursors -omit = **/_version.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/.doc-requirements.txt new/mplcursors-0.5.2/.doc-requirements.txt --- old/mplcursors-0.5.1/.doc-requirements.txt 2021-08-24 21:46:30.000000000 +0200 +++ new/mplcursors-0.5.2/.doc-requirements.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,4 +0,0 @@ -pandas==1.3.2 -pydata-sphinx-theme==0.6.3 -sphinx==4.1.2 -sphinx-gallery==0.9.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/.github/workflows/build.yml new/mplcursors-0.5.2/.github/workflows/build.yml --- old/mplcursors-0.5.1/.github/workflows/build.yml 2021-11-06 21:28:28.000000000 +0100 +++ new/mplcursors-0.5.2/.github/workflows/build.yml 2022-09-26 16:50:45.000000000 +0200 @@ -8,10 +8,12 @@ strategy: matrix: python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"] - oldest: [0] + flag: [""] include: - python-version: "3.6" - oldest: 1 + flag: "oldest" + - python-version: "3.10" + flag: "pre" steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 @@ -19,12 +21,17 @@ python-version: ${{ matrix.python-version }} - name: Install run: | - if [[ '${{ matrix.oldest }}' = 1 ]]; then + case '${{ matrix.flag }}' in + oldest) PYTEST_VERSION='==3.7.1' PYTEST_COV_VERSION='==2.9.0' NUMPY_VERSION='==1.11.*' MATPLOTLIB_VERSION='==3.1.0' - fi && + ;; + pre) + PIP_INSTALL_PRE=true + ;; + esac && pip install --upgrade pip setuptools wheel pytest"$PYTEST_VERSION" pytest-cov"$PYTEST_COV_VERSION" && # Force install of numpy before matplotlib. pip install --upgrade --upgrade-strategy=only-if-needed --only-binary=:all: numpy"$NUMPY_VERSION" && @@ -33,5 +40,31 @@ pip list - name: Test run: | - python -mpytest --cov --cov-branch --cov-report=xml - - uses: codecov/codecov-action@v1 + pyver="$(python -c 'import sys; print("{0.major}.{0.minor}".format(sys.version_info))')" && + COVERAGE_FILE=".coverage.$pyver" python -mpytest --cov --cov-branch --cov-report=xml + - name: Upload coverage + uses: actions/upload-artifact@v2 + with: + name: coverage + path: .coverage.* + + coverage: + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Download + uses: actions/download-artifact@v2 + with: + name: coverage + - name: Run + run: | + shopt -s globstar && + python -mpip install --upgrade coverage && + python -mcoverage combine .coverage.* && # Unifies paths across envs. + python -mcoverage annotate && + ( grep -HnTC2 '^!' **/*,cover || true ) && + python -mcoverage report --show-missing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/.readthedocs.yaml new/mplcursors-0.5.2/.readthedocs.yaml --- old/mplcursors-0.5.1/.readthedocs.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/mplcursors-0.5.2/.readthedocs.yaml 2022-06-15 18:43:18.000000000 +0200 @@ -0,0 +1,7 @@ +version: 2 + +python: + install: + - path: . + extra_requirements: + - docs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/.readthedocs.yml new/mplcursors-0.5.2/.readthedocs.yml --- old/mplcursors-0.5.1/.readthedocs.yml 2018-03-27 11:46:49.000000000 +0200 +++ new/mplcursors-0.5.2/.readthedocs.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,4 +0,0 @@ -requirements_file: .doc-requirements.txt -python: - version: 3 - pip_install: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/CHANGELOG.rst new/mplcursors-0.5.2/CHANGELOG.rst --- old/mplcursors-0.5.1/CHANGELOG.rst 2021-11-18 11:48:31.000000000 +0100 +++ new/mplcursors-0.5.2/CHANGELOG.rst 2022-09-27 21:20:16.000000000 +0200 @@ -1,6 +1,12 @@ Changelog ========= +0.5.2 +----- + +- Fix compatibility with Matplotlib 3.6 and with PEP517 builds. +- Non-multiple cursors can now be dragged. + 0.5.1 ----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/PKG-INFO new/mplcursors-0.5.2/PKG-INFO --- old/mplcursors-0.5.1/PKG-INFO 2021-11-18 11:51:47.299765000 +0100 +++ new/mplcursors-0.5.2/PKG-INFO 2022-09-27 21:23:28.269556000 +0200 @@ -1,24 +1,24 @@ Metadata-Version: 2.1 Name: mplcursors -Version: 0.5.1 +Version: 0.5.2 Summary: Interactive data selection cursors for Matplotlib. Home-page: https://github.com/anntzer/mplcursors Author: Antony Lee License: MIT -Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Framework :: Matplotlib Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python :: 3 Requires-Python: >=3.6 Description-Content-Type: text/x-rst +Provides-Extra: docs License-File: LICENSE.txt Interactive data selection cursors for Matplotlib ================================================= | |GitHub| |PyPI| |conda-forge| |Debian| |Fedora| |openSUSE| -| |Read the Docs| |Build| |CodeCov| +| |Read the Docs| |Build| .. |GitHub| image:: https://img.shields.io/badge/github-anntzer%2Fmplcursors-brightgreen @@ -44,9 +44,6 @@ .. |Build| image:: https://img.shields.io/github/workflow/status/anntzer/mplcursors/build :target: https://github.com/anntzer/mplcursors/actions -.. |CodeCov| - image:: https://img.shields.io/codecov/c/github/anntzer/mplcursors - :target: https://codecov.io/gh/anntzer/mplcursors mplcursors provides interactive data selection cursors for Matplotlib_. It is inspired from mpldatacursor_, with a much simplified API. @@ -70,5 +67,3 @@ .. _mpldatacursor: https://github.com/joferkington/mpldatacursor .. _pytest: https://pytest.org .. _readthedocs.org: https://mplcursors.readthedocs.org - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/README.rst new/mplcursors-0.5.2/README.rst --- old/mplcursors-0.5.1/README.rst 2021-11-06 19:41:26.000000000 +0100 +++ new/mplcursors-0.5.2/README.rst 2022-09-26 16:50:45.000000000 +0200 @@ -2,7 +2,7 @@ ================================================= | |GitHub| |PyPI| |conda-forge| |Debian| |Fedora| |openSUSE| -| |Read the Docs| |Build| |CodeCov| +| |Read the Docs| |Build| .. |GitHub| image:: https://img.shields.io/badge/github-anntzer%2Fmplcursors-brightgreen @@ -28,9 +28,6 @@ .. |Build| image:: https://img.shields.io/github/workflow/status/anntzer/mplcursors/build :target: https://github.com/anntzer/mplcursors/actions -.. |CodeCov| - image:: https://img.shields.io/codecov/c/github/anntzer/mplcursors - :target: https://codecov.io/gh/anntzer/mplcursors mplcursors provides interactive data selection cursors for Matplotlib_. It is inspired from mpldatacursor_, with a much simplified API. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/doc/source/conf.py new/mplcursors-0.5.2/doc/source/conf.py --- old/mplcursors-0.5.1/doc/source/conf.py 2021-11-06 15:00:05.000000000 +0100 +++ new/mplcursors-0.5.2/doc/source/conf.py 2022-09-26 16:50:45.000000000 +0200 @@ -15,13 +15,6 @@ 'sphinx.ext.viewcode', 'sphinx_gallery.gen_gallery', ] -_req_path = Path('../../.doc-requirements.txt') -needs_extensions = { - 'sphinx_gallery.gen_gallery': - dict(line.split('==') for line in _req_path.read_text().splitlines())[ - 'sphinx-gallery'] - -} source_suffix = '.rst' exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/examples/dataframe.py new/mplcursors-0.5.2/examples/dataframe.py --- old/mplcursors-0.5.1/examples/dataframe.py 2021-08-24 22:19:50.000000000 +0200 +++ new/mplcursors-0.5.2/examples/dataframe.py 2022-09-26 16:50:45.000000000 +0200 @@ -4,24 +4,69 @@ :class:`~pandas.DataFrame`\\s can be used similarly to any other kind of input. Here, we generate a scatter plot using two columns and label the points using -a third column. +all columns. + +This example also applies a shadow effect to the hover panel. """ from matplotlib import pyplot as plt + +from matplotlib.patheffects import withSimplePatchShadow import mplcursors from pandas import DataFrame df = DataFrame( - [("Alice", 163, 54), - ("Bob", 174, 67), - ("Charlie", 177, 73), - ("Diane", 168, 57)], - columns=["name", "height", "weight"]) - -df.plot.scatter("height", "weight") -mplcursors.cursor().connect( - "add", lambda sel: sel.annotation.set_text(df["name"][sel.index])) + dict( + Suburb=["Ames", "Somerset", "Sawyer"], + Area=[1023, 2093, 723], + SalePrice=[507500, 647000, 546999], + ) +) + +df.plot.scatter(x="Area", y="SalePrice", s=100) + + +def show_hover_panel(get_text_func=None): + cursor = mplcursors.cursor( + hover=2, # Transient + annotation_kwargs=dict( + bbox=dict( + boxstyle="square,pad=0.5", + facecolor="white", + edgecolor="#ddd", + linewidth=0.5, + path_effects=[withSimplePatchShadow(offset=(1.5, -1.5))], + ), + linespacing=1.5, + arrowprops=None, + ), + highlight=True, + highlight_kwargs=dict(linewidth=2), + ) + + if get_text_func: + cursor.connect( + event="add", + func=lambda sel: sel.annotation.set_text(get_text_func(sel.index)), + ) + + return cursor + + +def on_add(index): + item = df.iloc[index] + parts = [ + f"Suburb: {item.Suburb}", + f"Area: {item.Area:,.0f}m²", + f"Sale price: ${item.SalePrice:,.0f}", + ] + + return "\n".join(parts) + + +show_hover_panel(on_add) + plt.show() # test: skip diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/lib/mplcursors/_mplcursors.py new/mplcursors-0.5.2/lib/mplcursors/_mplcursors.py --- old/mplcursors-0.5.1/lib/mplcursors/_mplcursors.py 2021-10-29 01:16:01.000000000 +0200 +++ new/mplcursors-0.5.2/lib/mplcursors/_mplcursors.py 2022-09-27 21:19:37.000000000 +0200 @@ -152,7 +152,9 @@ A list of artists that can be selected by this cursor. multiple : bool, default: False - Whether multiple artists can be "on" at the same time. + Whether multiple artists can be "on" at the same time. If on, + cursor dragging is disabled (so that one does not end up with many + cursors on top of one another). highlight : bool, default: False Whether to also highlight the selected artist. If so, @@ -169,7 +171,7 @@ - True, alias `HoverMode.Persistent`: hovering is active; annotations remain in place even after the mouse moves away from the artist (until another artist is selected, if *multiple* is - False. + False). - 2, alias `HoverMode.Transient`: hovering is active; annotations are removed as soon as the mouse moves away from the artist. @@ -248,6 +250,9 @@ connect_pairs += [ ("button_press_event", self._on_nonhover_button_press), ] + if not self._multiple: + connect_pairs.append( + ("motion_notify_event", self._on_nonhover_button_press)) self._disconnectors = [ partial(canvas.mpl_disconnect, canvas.mpl_connect(*pair)) for pair in connect_pairs @@ -368,9 +373,14 @@ # Pre-fetch the figure and axes, as callbacks may actually unset them. figure = self._get_figure(pi.artist) axes = self._get_axes(pi.artist) - if axes.get_renderer_cache() is None: - figure.canvas.draw() # Needed by draw_artist below anyways. - renderer = axes.get_renderer_cache() + get_cached_renderer = ( + figure.canvas.get_renderer + if hasattr(figure.canvas, "get_renderer") + else axes.get_renderer_cache) # matplotlib <3.6. + renderer = get_cached_renderer() + if renderer is None: + figure.canvas.draw() # Needed below anyways. + renderer = get_cached_renderer() ann = axes.annotate( _pick_info.get_ann_text(*pi), xy=pi.target, xytext=(np.nan, np.nan), @@ -440,7 +450,7 @@ elif ann.axes: # Fast path, only needed if the annotation has not been immediately # removed. - figure.draw_artist(ann) + ann.draw(renderer) figure.canvas.blit() # Removal comes after addition so that the fast blitting path works. if not self._multiple: @@ -681,6 +691,12 @@ Keyword arguments are passed to the `Cursor` constructor. """ + # Explicit check to avoid a confusing + # "TypeError: Cursor.__init__() got multiple values for argument 'artists'" + if "artists" in kwargs: + raise TypeError( + "cursor() got an unexpected keyword argument 'artists'") + if pickables is None: # Do not import pyplot ourselves to avoid forcing the backend. plt = sys.modules.get("matplotlib.pyplot") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/lib/mplcursors/_pick_info.py new/mplcursors-0.5.2/lib/mplcursors/_pick_info.py --- old/mplcursors-0.5.1/lib/mplcursors/_pick_info.py 2021-10-29 20:47:24.000000000 +0200 +++ new/mplcursors-0.5.2/lib/mplcursors/_pick_info.py 2022-09-26 16:50:45.000000000 +0200 @@ -149,13 +149,6 @@ _Target, doc="The point picked within the artist, in data coordinates.") -def _with_attrs(array, **kwargs): - array = AttrArray(array) - for k, v in kwargs.items(): - setattr(array, k, v) - return array - - @functools.singledispatch def compute_pick(artist, event): """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/lib/mplcursors/_version.py new/mplcursors-0.5.2/lib/mplcursors/_version.py --- old/mplcursors-0.5.1/lib/mplcursors/_version.py 2021-11-18 11:51:47.000000000 +0100 +++ new/mplcursors-0.5.2/lib/mplcursors/_version.py 2022-09-27 21:23:26.000000000 +0200 @@ -1,5 +1,5 @@ # coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control -version = '0.5.1' -version_tuple = (0, 5, 1) +__version__ = version = '0.5.2' +__version_tuple__ = version_tuple = (0, 5, 2) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/lib/mplcursors.egg-info/PKG-INFO new/mplcursors-0.5.2/lib/mplcursors.egg-info/PKG-INFO --- old/mplcursors-0.5.1/lib/mplcursors.egg-info/PKG-INFO 2021-11-18 11:51:47.000000000 +0100 +++ new/mplcursors-0.5.2/lib/mplcursors.egg-info/PKG-INFO 2022-09-27 21:23:27.000000000 +0200 @@ -1,24 +1,24 @@ Metadata-Version: 2.1 Name: mplcursors -Version: 0.5.1 +Version: 0.5.2 Summary: Interactive data selection cursors for Matplotlib. Home-page: https://github.com/anntzer/mplcursors Author: Antony Lee License: MIT -Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Framework :: Matplotlib Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python :: 3 Requires-Python: >=3.6 Description-Content-Type: text/x-rst +Provides-Extra: docs License-File: LICENSE.txt Interactive data selection cursors for Matplotlib ================================================= | |GitHub| |PyPI| |conda-forge| |Debian| |Fedora| |openSUSE| -| |Read the Docs| |Build| |CodeCov| +| |Read the Docs| |Build| .. |GitHub| image:: https://img.shields.io/badge/github-anntzer%2Fmplcursors-brightgreen @@ -44,9 +44,6 @@ .. |Build| image:: https://img.shields.io/github/workflow/status/anntzer/mplcursors/build :target: https://github.com/anntzer/mplcursors/actions -.. |CodeCov| - image:: https://img.shields.io/codecov/c/github/anntzer/mplcursors - :target: https://codecov.io/gh/anntzer/mplcursors mplcursors provides interactive data selection cursors for Matplotlib_. It is inspired from mpldatacursor_, with a much simplified API. @@ -70,5 +67,3 @@ .. _mpldatacursor: https://github.com/joferkington/mpldatacursor .. _pytest: https://pytest.org .. _readthedocs.org: https://mplcursors.readthedocs.org - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/lib/mplcursors.egg-info/SOURCES.txt new/mplcursors-0.5.2/lib/mplcursors.egg-info/SOURCES.txt --- old/mplcursors-0.5.1/lib/mplcursors.egg-info/SOURCES.txt 2021-11-18 11:51:47.000000000 +0100 +++ new/mplcursors-0.5.2/lib/mplcursors.egg-info/SOURCES.txt 2022-09-27 21:23:28.000000000 +0200 @@ -1,13 +1,11 @@ -.codecov.yml -.coveragerc -.doc-requirements.txt .gitignore -.readthedocs.yml +.readthedocs.yaml CHANGELOG.rst LICENSE.txt README.rst setup.cfg setup.py +setup_mplcursors_pth.py setupext.py .github/workflows/build.yml doc/.gitignore diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/lib/mplcursors.egg-info/requires.txt new/mplcursors-0.5.2/lib/mplcursors.egg-info/requires.txt --- old/mplcursors-0.5.1/lib/mplcursors.egg-info/requires.txt 2021-11-18 11:51:47.000000000 +0100 +++ new/mplcursors-0.5.2/lib/mplcursors.egg-info/requires.txt 2022-09-27 21:23:27.000000000 +0200 @@ -1 +1,7 @@ matplotlib>=3.1 + +[docs] +pandas +pydata_sphinx_theme!=0.10.1 +sphinx +sphinx-gallery diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/setup.cfg new/mplcursors-0.5.2/setup.cfg --- old/mplcursors-0.5.1/setup.cfg 2021-11-18 11:51:47.299765000 +0100 +++ new/mplcursors-0.5.2/setup.cfg 2022-09-27 21:23:28.269556000 +0200 @@ -1,9 +1,20 @@ [tool:pytest] +minversion = 3.7.1 filterwarnings = error ignore::DeprecationWarning error::DeprecationWarning:mplcursors +[coverage:run] +branch = true +source = mplcursors +omit = **/_version.py + +[coverage:paths] +source = + lib/ + /**/python*/site-packages/ + [egg_info] tag_build = tag_date = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/setup.py new/mplcursors-0.5.2/setup.py --- old/mplcursors-0.5.1/setup.py 2021-11-06 15:00:41.000000000 +0100 +++ new/mplcursors-0.5.2/setup.py 2022-09-26 16:50:45.000000000 +0200 @@ -1,55 +1,7 @@ from setupext import find_namespace_packages, setup -# We cannot directly import matplotlib if `MPLCURSORS` is set because -# `sys.path` is not correctly set yet. -# -# The loading of `matplotlib.figure` does not go through the path entry finder -# because it is a submodule, so we must use a metapath finder instead. - -@setup.register_pth_hook("mplcursors.pth") -def _pth_hook(): - import os - if os.environ.get("MPLCURSORS"): - from importlib.machinery import PathFinder - import sys - class MplcursorsMetaPathFinder(PathFinder): - def find_spec(self, fullname, path=None, target=None): - spec = super().find_spec(fullname, path, target) - if fullname == "matplotlib.figure": - def exec_module(module): - type(spec.loader).exec_module(spec.loader, module) - # The pth file does not get properly uninstalled from - # a develop install. See pypa/pip#4176. - try: - import mplcursors - except ImportError: - return - import functools - import json - import weakref - # Ensure that when the cursor is removed(), or gets - # GC'd because its referents artists are GC'd, the - # entry also disappears. - cursors = weakref.WeakValueDictionary() - options = json.loads(os.environ["MPLCURSORS"]) - @functools.wraps(module.Figure.draw) - def wrapper(self, *args, **kwargs): - rv = wrapper.__wrapped__(self, *args, **kwargs) - if self not in cursors: - cursor = mplcursors.cursor(self, **options) - if cursor.artists: - cursors[self] = cursor - else: - # No artist yet; skip possible - # initialization code. - cursor.remove() - return rv - module.Figure.draw = wrapper - spec.loader.exec_module = exec_module - sys.meta_path.remove(self) - return spec - sys.meta_path.insert(0, MplcursorsMetaPathFinder()) +setup.register_pth_hook("setup_mplcursors_pth.py", "mplcursors.pth") setup( @@ -78,4 +30,12 @@ install_requires=[ "matplotlib>=3.1", ], + extras_require={ + "docs": [ + "pandas", + "pydata_sphinx_theme!=0.10.1", + "sphinx", + "sphinx-gallery", + ], + }, ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/setup_mplcursors_pth.py new/mplcursors-0.5.2/setup_mplcursors_pth.py --- old/mplcursors-0.5.1/setup_mplcursors_pth.py 1970-01-01 01:00:00.000000000 +0100 +++ new/mplcursors-0.5.2/setup_mplcursors_pth.py 2022-09-26 16:50:45.000000000 +0200 @@ -0,0 +1,49 @@ +import os + + +if os.environ.get("MPLCURSORS"): + # We cannot directly import matplotlib if `MPLCURSORS` is set because + # `sys.path` is not correctly set yet. + # The loading of `matplotlib.figure` does not go through the path entry + # finder because it is a submodule, so we use a metapath finder instead. + + from importlib.machinery import PathFinder + import sys + + class MplcursorsMetaPathFinder(PathFinder): + def find_spec(self, fullname, path=None, target=None): + spec = super().find_spec(fullname, path, target) + if fullname == "matplotlib.figure": + def exec_module(module): + type(spec.loader).exec_module(spec.loader, module) + # The pth file does not get properly uninstalled from a + # develop install. See pypa/pip#4176. + try: + import mplcursors + except ImportError: + return + import functools + import json + import weakref + # Ensure that when the cursor is removed(), or gets GC'd + # because its referents artists are GC'd, the entry also + # disappears. + cursors = weakref.WeakValueDictionary() + options = json.loads(os.environ["MPLCURSORS"]) + @functools.wraps(module.Figure.draw) + def wrapper(self, *args, **kwargs): + rv = wrapper.__wrapped__(self, *args, **kwargs) + if self not in cursors: + cursor = mplcursors.cursor(self, **options) + if cursor.artists: + cursors[self] = cursor + else: + # No artist yet; skip possible init code. + cursor.remove() + return rv + module.Figure.draw = wrapper + spec.loader.exec_module = exec_module + sys.meta_path.remove(self) + return spec + + sys.meta_path.insert(0, MplcursorsMetaPathFinder()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mplcursors-0.5.1/setupext.py new/mplcursors-0.5.2/setupext.py --- old/mplcursors-0.5.1/setupext.py 2021-09-17 19:36:27.000000000 +0200 +++ new/mplcursors-0.5.2/setupext.py 2022-09-26 21:00:53.000000000 +0200 @@ -1,9 +1,7 @@ """setuptools helpers.""" -import functools -import inspect from pathlib import Path -import re +import tokenize import setuptools # find_namespace_packages itself bounds support to setuptools>=40.1. @@ -13,24 +11,14 @@ __all__ = ["Extension", "find_namespace_packages", "setup"] -def register_pth_hook(fname, func=None): +def register_pth_hook(source_path, pth_name): """ :: - # Add a pth hook. - @setup.register_pth_hook("hook_name.pth") - def _hook(): - '''hook contents.''' + setup.register_pth_hook("hook_source.py", "hook_name.pth") # Add hook. """ - if func is None: - return functools.partial(register_pth_hook, fname) - source = inspect.getsource(func) - if not re.match( - rf"@setup\.register_pth_hook.*\ndef {re.escape(func.__name__)}\(", - source): - raise SyntaxError("register_pth_hook must be used as a toplevel " - "decorator to a function") - _, source = source.split("\n", 1) - _pth_hook_mixin._pth_hooks.append((fname, func.__name__, source)) + with tokenize.open(source_path) as file: + source = file.read() + _pth_hook_mixin._pth_hooks.append((pth_name, source)) class _pth_hook_mixin: @@ -38,14 +26,14 @@ def run(self): super().run() - for fname, name, source in self._pth_hooks: - with Path(self.install_dir, fname).open("w") as file: - file.write(f"import os; exec({source!r}); {name}()") + for pth_name, source in self._pth_hooks: + with Path(self.install_dir, pth_name).open("w") as file: + file.write(f"import os; exec({source!r})") def get_outputs(self): return (super().get_outputs() - + [str(Path(self.install_dir, fname)) - for fname, _, _ in self._pth_hooks]) + + [str(Path(self.install_dir, pth_name)) + for pth_name, _ in self._pth_hooks]) def _prepare_pth_hook(kwargs):