public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Benjamin A. Beasley <code@musicinmybrain.net>
To: git-commits@fedoraproject.org
Subject: [rpms/python-vascpy] rawhide: Patch for Pandas version 3 (fixes RHBZ#2485977)
Date: Sun, 12 Jul 2026 06:37:47 GMT	[thread overview]
Message-ID: <178383826709.1.3570341766633375078.rpms-python-vascpy-8eff5f2fcf5a@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/python-vascpy
Branch : rawhide
Commit : 8eff5f2fcf5aa4bd551f299391202ea6afb523a4
Author : Benjamin A. Beasley <code@musicinmybrain.net>
Date   : 2026-07-12T07:31:58+01:00
Stats  : +122/-0 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/python-vascpy/c/8eff5f2fcf5aa4bd551f299391202ea6afb523a4?branch=rawhide

Log:
Patch for Pandas version 3 (fixes RHBZ#2485977)

---
diff --git a/2.patch b/2.patch
new file mode 100644
index 0000000..7541584
--- /dev/null
+++ b/2.patch
@@ -0,0 +1,118 @@
+From 58a2df9198342d73c3eabd06f7bc483a44b36913 Mon Sep 17 00:00:00 2001
+From: "Benjamin A. Beasley" <code@musicinmybrain.net>
+Date: Sun, 12 Jul 2026 06:37:48 +0100
+Subject: [PATCH 1/3] Adapt `PointGraph.remove()` for Pandas 3
+
+With Copy-on-Write (PDEP-7) behavior in Pandas 3, the edges property
+getter returns a read-only ndarray, so we cannot use the `-=` operator
+on it.
+---
+ vascpy/point_vasculature.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/vascpy/point_vasculature.py b/vascpy/point_vasculature.py
+index 74ce233..1b02663 100644
+--- a/vascpy/point_vasculature.py
++++ b/vascpy/point_vasculature.py
+@@ -167,7 +167,8 @@ def remove(
+         # Cumulative sum    :  0 1 2 2 2 2 3 4 5 5
+         # After Reindexing  :  - - 0 1 2 - - - 3 4
+         # Subtracting the cumulative sum from the remaining edges will correcty reindex them
+-        self.edges -= np.cumsum(~mask_nodes_to_keep)[self.edges]
++        edges = self.edges  # With Pandas 3, read-only ndarray based on CoW dataframe
++        self.edges = edges - np.cumsum(~mask_nodes_to_keep)[edges]
+ 
+ 
+ class PointVasculature(PointGraph):
+
+From bed21dc1569a74e83ed97727c5cc47d606aa77c4 Mon Sep 17 00:00:00 2001
+From: "Benjamin A. Beasley" <code@musicinmybrain.net>
+Date: Sun, 12 Jul 2026 07:05:29 +0100
+Subject: [PATCH 2/3] In `test_set_properties`, avoid `LossySetitemError`
+
+Since Pandas 3 checks for narrowing (potentially lossy) type
+conversions, be more explicit about data types of random test data
+ndarrays and/or do narrowing conversions on them explicitly in the test
+before checking that their values round-trip.
+---
+ tests/test_point_vasculature.py | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/tests/test_point_vasculature.py b/tests/test_point_vasculature.py
+index 02e4f73..8f80af3 100644
+--- a/tests/test_point_vasculature.py
++++ b/tests/test_point_vasculature.py
+@@ -157,7 +157,7 @@ def test_get_properties(point_vasculature, points, edges, edge_types, diameters)
+ 
+ def test_set_properties(point_vasculature):
+ 
+-    new_points = np.random.random((10, 3))
++    new_points = np.random.random((10, 3)).astype(np.float32)
+     point_vasculature.points = new_points
+     npt.assert_allclose(point_vasculature.points, new_points)
+ 
+@@ -165,11 +165,11 @@ def test_set_properties(point_vasculature):
+     point_vasculature.edges = new_edges
+     npt.assert_array_equal(point_vasculature.edges, new_edges)
+ 
+-    new_edge_types = np.random.randint(0, 100, 9)
++    new_edge_types = np.random.randint(0, 100, 9, dtype=np.int32)
+     point_vasculature.edge_types = new_edge_types
+     npt.assert_array_equal(point_vasculature.edge_types, new_edge_types)
+ 
+-    new_diameters = np.random.random(10)
++    new_diameters = np.random.random(10).astype(np.float32)
+     point_vasculature.diameters = new_diameters
+     npt.assert_allclose(point_vasculature.diameters, new_diameters)
+ 
+@@ -181,7 +181,7 @@ def test_set_properties(point_vasculature):
+     old_points[(1, 3, 5), 2] = new_values[:, 1]
+     npt.assert_allclose(point_vasculature.points, old_points)
+ 
+-    new_values = np.random.random(10)
++    new_values = np.random.randint(-128, 128, 10, dtype=np.int8)
+     point_vasculature.node_properties.loc[:, "property1"] = new_values
+     npt.assert_allclose(point_vasculature.node_properties.loc[:, "property1"], new_values)
+ 
+@@ -195,7 +195,7 @@ def test_set_properties(point_vasculature):
+ 
+     npt.assert_allclose(point_vasculature.edges, old_edges)
+ 
+-    new_values = np.random.random(9)
++    new_values = np.random.randint(-128, 128, 9, dtype=np.int8)
+     point_vasculature.edge_properties.loc[:, "property1"] = new_values
+     npt.assert_allclose(point_vasculature.edge_properties.loc[:, "property1"], new_values)
+ 
+
+From 6c1506c43d1c74f4d77500b670df5a44a6ee5a7c Mon Sep 17 00:00:00 2001
+From: "Benjamin A. Beasley" <code@musicinmybrain.net>
+Date: Sun, 12 Jul 2026 07:09:10 +0100
+Subject: [PATCH 3/3] Adapt `test_set_properties` for CoW in Pandas 3
+
+Copy read-only ndarrays before attempting to mutate them.
+---
+ tests/test_point_vasculature.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tests/test_point_vasculature.py b/tests/test_point_vasculature.py
+index 8f80af3..7ff5e80 100644
+--- a/tests/test_point_vasculature.py
++++ b/tests/test_point_vasculature.py
+@@ -173,7 +173,7 @@ def test_set_properties(point_vasculature):
+     point_vasculature.diameters = new_diameters
+     npt.assert_allclose(point_vasculature.diameters, new_diameters)
+ 
+-    old_points = point_vasculature.points
++    old_points = point_vasculature.points.copy()
+     new_values = np.array([[9, 10], [10, 11], [11, 12]])
+     point_vasculature.node_properties.loc[[1, 3, 5], ["x", "z"]] = new_values
+ 
+@@ -185,7 +185,7 @@ def test_set_properties(point_vasculature):
+     point_vasculature.node_properties.loc[:, "property1"] = new_values
+     npt.assert_allclose(point_vasculature.node_properties.loc[:, "property1"], new_values)
+ 
+-    old_edges = point_vasculature.edges
++    old_edges = point_vasculature.edges.copy()
+     new_values = np.array([[1, 3], [4, 1]])
+ 
+     point_vasculature.edge_properties.loc[[0, 7], ["start_node", "end_node"]] = new_values

diff --git a/python-vascpy.spec b/python-vascpy.spec
index e9516dc..9d22524 100644
--- a/python-vascpy.spec
+++ b/python-vascpy.spec
@@ -13,6 +13,10 @@ License:        Apache-2.0
 URL:            %forgeurl
 Source:         %forgesource
 
+# Support Pandas version 3
+# https://github.com/openbraininstitute/vascpy/pull/2
+Patch:          %{url}/pull/2.patch
+
 BuildArch:      noarch
 BuildRequires:  python3-devel
 BuildRequires:  python3dist(pytest)

                 reply	other threads:[~2026-07-12  6:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178383826709.1.3570341766633375078.rpms-python-vascpy-8eff5f2fcf5a@fedoraproject.org \
    --to=code@musicinmybrain.net \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox