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 2024-09-02 13:15:26
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-mplcursors (Old)
and /work/SRC/openSUSE:Factory/.python-mplcursors.new.2698 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-mplcursors"
Mon Sep 2 13:15:26 2024 rev:10 rq:1198187 version:0.5.3
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-mplcursors/python-mplcursors.changes
2024-02-05 22:02:54.754728817 +0100
+++
/work/SRC/openSUSE:Factory/.python-mplcursors.new.2698/python-mplcursors.changes
2024-09-02 13:15:30.413012621 +0200
@@ -1,0 +2,7 @@
+Sun Sep 1 18:29:49 UTC 2024 - Ben Greiner <[email protected]>
+
+- Make fit for new versions of Numpy, Matplotlib and Pytest
+ * Add mplcursors-1d9461c-np2.patch
+ * Add mplcursors-10b553e-mpl3.9-pytest8.patch
+
+-------------------------------------------------------------------
New:
----
mplcursors-10b553e-mpl3.9-pytest8.patch
mplcursors-1d9461c-np2.patch
BETA DEBUG BEGIN:
New: * Add mplcursors-1d9461c-np2.patch
* Add mplcursors-10b553e-mpl3.9-pytest8.patch
New:- Make fit for new versions of Numpy, Matplotlib and Pytest
* Add mplcursors-1d9461c-np2.patch
* Add mplcursors-10b553e-mpl3.9-pytest8.patch
BETA DEBUG END:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-mplcursors.spec ++++++
--- /var/tmp/diff_new_pack.0Onm8f/_old 2024-09-02 13:15:30.977036626 +0200
+++ /var/tmp/diff_new_pack.0Onm8f/_new 2024-09-02 13:15:30.977036626 +0200
@@ -23,6 +23,10 @@
License: Zlib
URL: https://github.com/anntzer/mplcursors
Source:
https://files.pythonhosted.org/packages/source/m/mplcursors/mplcursors-%{version}.tar.gz
+# PATCH-FIX-UPSTREAM mplcursors-10b553e-mpl3.9-pytest8.patch
https://github.com/anntzer/mplcursors/commit/10b553e
+Patch0: mplcursors-10b553e-mpl3.9-pytest8.patch
+# PATCH-FIX-UPSTREAM mplcursors-1d9461c-np2.patch
https://github.com/anntzer/mplcursors/commit/1d9461c
+Patch1: mplcursors-1d9461c-np2.patch
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools_scm}
++++++ mplcursors-10b553e-mpl3.9-pytest8.patch ++++++
>From 10b553e7a430f69c1da16e9279c44dd665fd3787 Mon Sep 17 00:00:00 2001
From: Antony Lee <[email protected]>
Date: Mon, 8 Apr 2024 11:58:04 +0200
Subject: [PATCH] Fixes for mpl 3.9, pytest 8, GHA node.js 20.
---
##.github/workflows/build.yml | 19 ++++++++++---------
##CHANGELOG.rst | 5 +++++
##pyproject.toml | 2 +-
src/mplcursors/_pick_info.py | 23 ++++++++++++++---------
tests/test_mplcursors.py | 17 ++++-------------
5 files changed, 34 insertions(+), 32 deletions(-)
--- a/src/mplcursors/_pick_info.py
+++ b/src/mplcursors/_pick_info.py
@@ -19,6 +19,7 @@
from matplotlib.backend_bases import RendererBase
from matplotlib.collections import (
LineCollection, PatchCollection, PathCollection)
+from matplotlib.colorbar import Colorbar
from matplotlib.container import BarContainer, ErrorbarContainer, StemContainer
from matplotlib.figure import Figure
from matplotlib.image import AxesImage
@@ -513,14 +514,18 @@ def wrapper(*args, **kwargs):
return wrapper
-def _format_coord_unspaced(ax, xy):
- # Un-space-pad, remove empty coordinates from the output of
- # `format_{x,y}data`, and rejoin with newlines.
- return "\n".join(
- line for line, empty in zip(
- re.split(",? +", ax.format_coord(*xy)),
- itertools.chain(["x=", "y=", "z="], itertools.repeat(None)))
- if line != empty).rstrip()
+def _format_coord_unspaced(ax, pos):
+ # This used to directly post-process the output of format_coord(), but got
+ # switched to handling special projections separately due to the change in
+ # formatting for rectilinear coordinates.
+ if ax.name == "polar":
+ return ax.format_coord(*pos).replace(", ", "\n")
+ elif ax.name == "3d": # Need to retrieve the actual line data coordinates.
+ warnings.warn("3d coordinates not supported yet")
+ return ""
+ else:
+ x, y = pos
+ return f"x={ax.format_xdata(x)}\ny={ax.format_ydata(y)}"
@functools.singledispatch
@@ -547,7 +552,7 @@ def _format_scalarmappable_value(artist, idx): #
matplotlib/matplotlib#12473.
if not artist.colorbar:
fig = Figure()
ax = fig.subplots()
- artist.colorbar = fig.colorbar(artist, cax=ax)
+ artist.colorbar = Colorbar(ax, artist)
# This hack updates the ticks without actually paying the cost of
# drawing (RendererBase.draw_path raises NotImplementedError).
try:
diff --git a/tests/test_mplcursors.py b/tests/test_mplcursors.py
index 2ff52fa..0beeeca 100644
--- a/tests/test_mplcursors.py
+++ b/tests/test_mplcursors.py
@@ -1,3 +1,4 @@
+from contextlib import ExitStack
import copy
import functools
import gc
@@ -46,12 +47,6 @@ def cleanup():
plt.close("all")
-def _internal_warnings(record):
- return [
- warning for warning in record
- if Path(mplcursors.__file__).parent in Path(warning.filename).parents]
-
-
def _process_event(name, ax, coords, *args):
ax.viewLim # unstale viewLim.
if name == "__mouse_click__":
@@ -244,9 +239,7 @@ def test_nan(ax, plot_args, click, targets):
def test_repeated_point(ax):
ax.plot([0, 1, 1, 2], [0, 1, 1, 2])
cursor = mplcursors.cursor()
- with pytest.warns(None) as record:
- _process_event("__mouse_click__", ax, (.5, .5), 1)
- assert not _internal_warnings(record)
+ _process_event("__mouse_click__", ax, (.5, .5), 1) # Should not warn.
@pytest.mark.parametrize("origin", ["lower", "upper"])
@@ -388,8 +381,7 @@ def test_dataless_errorbar(ax):
def test_stem(ax):
try: # stem use_line_collection API change.
- with pytest.warns(None):
- ax.stem([1, 2, 3], use_line_collection=True)
+ ax.stem([1, 2, 3], use_line_collection=True)
except TypeError:
ax.stem([1, 2, 3])
cursor = mplcursors.cursor()
@@ -409,10 +401,9 @@ def test_stem(ax):
def test_misc_artists(ax, plotter, warns):
plotter(ax)
cursor = mplcursors.cursor()
- with pytest.warns(None) as record:
+ with pytest.warns(UserWarning) if warns else ExitStack():
_process_event("__mouse_click__", ax, (.5, .5), 1)
assert len(cursor.selections) == 0
- assert len(_internal_warnings(record)) == warns
def test_indexless_projections(fig):
++++++ mplcursors-1d9461c-np2.patch ++++++
>From 1d9461cfc563809911e4bf71141f87fed4cc3e36 Mon Sep 17 00:00:00 2001
From: Antony Lee <[email protected]>
Date: Tue, 20 Aug 2024 10:40:34 +0200
Subject: [PATCH] Fix quiver/barbs annotation text on numpy 2.
diff --git a/src/mplcursors/_pick_info.py b/src/mplcursors/_pick_info.py
index 938273a..de95b8c 100644
--- a/src/mplcursors/_pick_info.py
+++ b/src/mplcursors/_pick_info.py
@@ -567,9 +567,9 @@ def _(sel):
@_call_with_selection
def _(sel):
artist = sel.artist
- text = "{}\n{}".format(
+ text = "{}\n({!s}, {!s})".format(
_format_coord_unspaced(artist.axes, sel.target),
- (artist.u[sel.index], artist.v[sel.index]))
+ artist.u[sel.index], artist.v[sel.index])
return text
@@ -577,9 +577,9 @@ def _(sel):
@_call_with_selection
def _(sel):
artist = sel.artist
- text = "{}\n{}".format(
+ text = "{}\n({!s}, {!s})".format(
_format_coord_unspaced(artist.axes, sel.target),
- (artist.U[sel.index], artist.V[sel.index]))
+ artist.U[sel.index], artist.V[sel.index])
return text