[med-svn] [Git][med-team/nipy][master] 5 commits: Pick up patch submitted to upstream for NumPy 2.3 support.

Michael R. Crusoe (@crusoe) gitlab at salsa.debian.org
Tue Sep 9 19:05:36 BST 2025



Michael R. Crusoe pushed to branch master at Debian Med / nipy


Commits:
737b7733 by Michael R. Crusoe at 2025-09-09T16:06:04+02:00
Pick up patch submitted to upstream for NumPy 2.3 support.

Closes: #1114704

- - - - -
52d5a21d by Michael R. Crusoe at 2025-09-09T18:25:24+02:00
d/control: switch to autopkgtest-pkg-pybuild.

- - - - -
e097b18d by Michael R. Crusoe at 2025-09-09T18:25:24+02:00
Standards-Version: 4.7.2 (routine-update)

- - - - -
1fff6c56 by Michael R. Crusoe at 2025-09-09T18:25:24+02:00
Add missing build dependency on python3-numpy-dev for command dh_numpy3.

Changes-By: lintian-brush
Fixes: lintian: missing-build-dependency-for-dh_-command
See-also: https://lintian.debian.org/tags/missing-build-dependency-for-dh_-command.html

- - - - -
4c689bd0 by Michael R. Crusoe at 2025-09-09T18:25:24+02:00
routine-update: Ready to upload to unstable

- - - - -


9 changed files:

- debian/changelog
- debian/control
- + debian/patches/0002-FIX-Remove-deprecated-Numpy-C-API-macros.patch
- debian/patches/local-mathjax.patch
- debian/patches/series
- − debian/patches/sympy-1.13.patch
- debian/rules
- − debian/tests/control
- − debian/tests/nipy_test.py


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,14 @@
+nipy (0.6.1-2) unstable; urgency=medium
+
+  * Team upload.
+  * Pick up patch submitted to upstream for NumPy 2.3 support. Closes:
+    #1114704
+  * d/control: switch to autopkgtest-pkg-pybuild.
+  * Standards-Version: 4.7.2 (routine-update)
+  * Add missing build dependency on python3-numpy-dev for command dh_numpy3.
+
+ -- Michael R. Crusoe <crusoe at debian.org>  Tue, 09 Sep 2025 16:41:30 +0200
+
 nipy (0.6.1-1) unstable; urgency=medium
 
   * Team Upload


=====================================
debian/control
=====================================
@@ -2,7 +2,7 @@ Source: nipy
 Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
 Uploaders: Étienne Mollier <emollier at debian.org>
 Section: python
-Testsuite: autopkgtest-pkg-python
+Testsuite: autopkgtest-pkg-pybuild
 Priority: optional
 Build-Depends: debhelper-compat (= 13),
                dh-sequence-python3,
@@ -26,8 +26,9 @@ Build-Depends: debhelper-compat (= 13),
                cython3,
                graphviz,
                dvipng,
-               help2man
-Standards-Version: 4.7.0
+               help2man,
+               python3-numpy-dev
+Standards-Version: 4.7.2
 Vcs-Browser: https://salsa.debian.org/med-team/nipy
 Vcs-Git: https://salsa.debian.org/med-team/nipy.git
 Homepage: https://nipy.org/nipy/


=====================================
debian/patches/0002-FIX-Remove-deprecated-Numpy-C-API-macros.patch
=====================================
@@ -0,0 +1,71 @@
+From: Scott Huberty <seh33 at uw.edu>
+Date: Tue, 24 Jun 2025 12:44:28 -0700
+Subject: FIX: Remove deprecated Numpy C API macros
+
+If I understand correctly, NPY_OWNDATA and NPY_BEHAVED were deprecated in v1.7, which was released over a decade ago. These macros were officially removed in Numpy v2.3 (released June 2025).
+
+- https://github.com/numpy/numpy/releases/tag/v2.3.0
+- https://numpy.org/devdocs/release/1.7.0-notes.html
+- https://github.com/numpy/numpy/blob/v1.12.0b1/numpy/core/include/numpy/npy_1_7_deprecated_api.h
+---
+ lib/fff_python_wrapper/fffpy.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/lib/fff_python_wrapper/fffpy.c b/lib/fff_python_wrapper/fffpy.c
+index 718c358..9efdea6 100644
+--- a/lib/fff_python_wrapper/fffpy.c
++++ b/lib/fff_python_wrapper/fffpy.c
+@@ -41,7 +41,7 @@ void fff_vector_fetch_using_NumPy(fff_vector* y, const char* x, npy_intp stride,
+   npy_intp dim[1] = {(npy_intp)y->size};
+   npy_intp strides[1] = {stride};
+   PyArrayObject* X = (PyArrayObject*) PyArray_New(&PyArray_Type, 1, dim, type, strides,
+-						  (void*)x, itemsize, NPY_BEHAVED, NULL);
++						  (void*)x, itemsize, NPY_ARRAY_BEHAVED, NULL);
+   PyArrayObject* Y = (PyArrayObject*) PyArray_SimpleNewFromData(1, dim, NPY_DOUBLE, (void*)y->data);
+   PyArray_CopyInto(Y, X);
+   Py_XDECREF(Y);
+@@ -140,7 +140,7 @@ PyArrayObject* fff_vector_toPyArray(fff_vector* y)
+      buffer to Python and transfer ownership */
+   if (y->owner) {
+     x = (PyArrayObject*) PyArray_SimpleNewFromData(1, dims, NPY_DOUBLE, (void*)y->data);
+-    x->flags = (x->flags) | NPY_OWNDATA;
++    x->flags = (x->flags) | NPY_ARRAY_OWNDATA;
+   }
+   /* Otherwise, create Python array from scratch */
+   else
+@@ -166,7 +166,7 @@ PyArrayObject* fff_vector_const_toPyArray(const fff_vector* y)
+   for (i=0; i<size; i++, bufX++, bufY+=stride)
+     *bufX = *bufY;
+   x = (PyArrayObject*) PyArray_SimpleNewFromData(1, dims, NPY_DOUBLE, (void*)data);
+-  x->flags = (x->flags) | NPY_OWNDATA;
++  x->flags = (x->flags) | NPY_ARRAY_OWNDATA;
+ 
+   return x;
+ }
+@@ -244,7 +244,7 @@ PyArrayObject* fff_matrix_toPyArray(fff_matrix* y)
+      buffer to Python and transfer ownership */
+   if ((tda == size2) && (y->owner)) {
+     x = (PyArrayObject*) PyArray_SimpleNewFromData(2, dims, NPY_DOUBLE, (void*)y->data);
+-    x->flags = (x->flags) | NPY_OWNDATA;
++    x->flags = (x->flags) | NPY_ARRAY_OWNDATA;
+   }
+   /* Otherwise, create PyArray from scratch. Note, the input
+      fff_matrix is necessarily in row-major order. */
+@@ -278,7 +278,7 @@ PyArrayObject* fff_matrix_const_toPyArray(const fff_matrix* y)
+   }
+ 
+   x = (PyArrayObject*) PyArray_SimpleNewFromData(2, dims, NPY_DOUBLE, (void*)data);
+-  x->flags = (x->flags) | NPY_OWNDATA;
++  x->flags = (x->flags) | NPY_ARRAY_OWNDATA;
+ 
+   return x;
+ }
+@@ -467,7 +467,7 @@ PyArrayObject* fff_array_toPyArray(fff_array* y)
+    x = (PyArrayObject*) PyArray_SimpleNewFromData(yy->ndims, dims, datatype, (void*)yy->data);
+ 
+   /* Transfer ownership to Python */
+-  x->flags = (x->flags) | NPY_OWNDATA;
++  x->flags = (x->flags) | NPY_ARRAY_OWNDATA;
+ 
+   /* Dealloc memory if needed */
+   if (! y->owner)


=====================================
debian/patches/local-mathjax.patch
=====================================
@@ -1,10 +1,18 @@
-Author: Stuart Prescott <stuart at debian.org>
-Description: Use mathjax package
+From: Stuart Prescott <stuart at debian.org>
+Date: Tue, 9 Sep 2025 16:03:52 +0200
+Subject: Use mathjax package
+
 Forwarded: not-needed
 Last-Updated: 2020-01-31
+---
+ doc/conf.py | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/doc/conf.py b/doc/conf.py
+index 6a9fda0..8c06683 100644
 --- a/doc/conf.py
 +++ b/doc/conf.py
-@@ -241,3 +241,5 @@
+@@ -241,3 +241,5 @@ doctest_default_flags = (_sedd.ELLIPSIS | _sedd.IGNORE_EXCEPTION_DETAIL |
  # https://github.com/scikit-image/scikit-image/pull/1356
  numpydoc_show_class_members = False
  numpydoc_class_members_toctree = False


=====================================
debian/patches/series
=====================================
@@ -1,2 +1,2 @@
 local-mathjax.patch
-#sympy-1.13.patch
+0002-FIX-Remove-deprecated-Numpy-C-API-macros.patch


=====================================
debian/patches/sympy-1.13.patch deleted
=====================================
@@ -1,83 +0,0 @@
-Description: fix test failures with sympy 1.13
- Since version 1.13, SymPy makes a hard distinction between integers and
- floats.  This causes a couple of tests to fail, with the most relevant
- part of the error showing:
- .
-         self = AffineTransform(
-            function_domain=CoordinateSystem(coord_names=('x', 'y', 'z'), name='', coord_dtype=object),
-            fun...ne=array([[3, 0, 0, 0],
-                          [0, 4, 0, 0],
-                          [0, 0, 5, 0],
-                          [0, 0, 0, 1]])
-         )
-         function_domain = CoordinateSystem(coord_names=('x', 'y', 'z'), name='', coord_dtype=object)
-         function_range = CoordinateSystem(coord_names=('i', 'j', 'k'), name='', coord_dtype=object)
-         affine = array([[1.00000000000000, 0, 0, 0],
-                [0, 0, 1.00000000000000, 0],
-                [0, 1.00000000000000, 0, 0],
-                [0, 0, 0, 1.00000000000000]], dtype=object)
-         
-             def __init__(self, function_domain, function_range, affine):
-                 """ Initialize AffineTransform
-         […]
-                 if not np.all(affine[-1] == bottom_row):
-         >           raise ValueError('the homogeneous transform should have bottom=' + \
-                                      f'row {repr(bottom_row)}')
-         E           ValueError: the homogeneous transform should have bottom=row array([0, 0, 0, 1])
- .
- This change implements a number of adjustments to fix the
- AffineTransform constructor, and normalize the expected test output
- where needed.
-
-Author: Étienne Mollier <emollier at debian.org>
-Forwarded: https://github.com/nipy/nipy/pull/569
-Last-Update: 2024-09-04
----
-This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- nipy.orig/nipy/core/reference/coordinate_map.py
-+++ nipy/nipy/core/reference/coordinate_map.py
-@@ -558,10 +558,11 @@
-                              'affine matrix shape')
-         # Test that it is actually an affine mapping in homogeneous
-         # form
--        bottom_row = np.array([0]*self.ndims[0] + [1])
-+        bottom_row = np.array([0]*self.ndims[0] + [1.], dtype=dtype)
-         if not np.all(affine[-1] == bottom_row):
-             raise ValueError('the homogeneous transform should have bottom=' + \
--                             f'row {repr(bottom_row)}')
-+                             f'row {repr(bottom_row)}' + ' but it has bottom=' \
-+                             + f'row {repr(affine[-1])}')
-         self.affine = affine
- 
-     ###################################################################
---- nipy.orig/nipy/core/reference/tests/test_coordinate_map.py
-+++ nipy/nipy/core/reference/tests/test_coordinate_map.py
-@@ -956,8 +956,8 @@
-     # Check that we can make functional inverses of AffineTransforms, and
-     # CoordinateMap versions of AffineTransforms
-     arr_p1 = np.eye(4)[:, [0, 2, 1, 3]]
--    in_list = [0, 1, 2]
--    out_list = [0, 2, 1]
-+    in_list = [0, 1., 2.]
-+    out_list = [0, 2., 1.]
-     for dt in _SYMPY_SAFE_DTYPES:
-         in_cs = CoordinateSystem('ijk', coord_dtype=dt)
-         out_cs = CoordinateSystem('xyz', coord_dtype=dt)
-@@ -975,7 +975,7 @@
-         except:
-             1/0
-         res = r_cmap(out_coord)
--        assert_array_equal(res, coord)
-+        assert_array_equal(res, np.asarray(coord, dtype=exp_i_dt))
-         assert res.dtype == exp_i_dt
-         # Default behavior is preserve_type=False
-         r_cmap = cmap.inverse(preserve_dtype=False)
-@@ -991,7 +991,7 @@
-         cm_cmap = _as_coordinate_map(cmap)
-         assert_array_equal(cm_cmap(coord), out_list)
-         rcm_cmap = cm_cmap.inverse()
--        assert_array_equal(rcm_cmap(coord), out_list)
-+        assert_array_equal(rcm_cmap(coord), np.asarray(out_list, dtype=dt))
-         res = rcm_cmap(out_coord)
-         assert_array_equal(res, coord)
-         assert res.dtype == dt


=====================================
debian/rules
=====================================
@@ -16,6 +16,8 @@ export MPLBACKEND=Agg
 DESTDIR = $(CURDIR)/debian/python3-$(PYBUILD_NAME)
 DISTDIR = $(DESTDIR)/usr/lib/python3/dist-packages
 
+export PYBUILD_TEST_ARGS=--pyargs nipy
+
 # Mega rule
 %:
 	dh $@ --buildsystem=pybuild --with=sphinxdoc


=====================================
debian/tests/control deleted
=====================================
@@ -1,3 +0,0 @@
-Test-Command: cd debian/tests && python3 -m pytest nipy_test.py
-Depends: python3-nipy, python3-nipy-lib, python-nipy-doc, python3-pytest
-Restrictions: allow-stderr


=====================================
debian/tests/nipy_test.py deleted
=====================================
@@ -1,35 +0,0 @@
-import pytest
-import numpy as np
-from nipy.testing import anatfile
-from nipy import load_image
-from nipy import save_image
-from nipy.core.api import Image, vox2mni
-
-# Reference for nipy example usage, visit official documentation
-# https://nipy.org/nipy/users/basic_io.html
-
-# fixture
- at pytest.fixture
-def image_from_disk():
-    return load_image(anatfile)
-
-# Load Image from File
-def test_loaded_image_shape(image_from_disk):
-    assert image_from_disk.shape == (33, 41, 25)
-
-# Access Data into an Array
-def test_loaded_image_dimension(image_from_disk):
-    assert image_from_disk.ndim == 3
-
-# Save image to a File
-def test_image_save_to_file(tmp_path, image_from_disk):
-    output_file = tmp_path / 'newimagefile.nii'
-    newimg = save_image(image_from_disk, str(output_file))
-    assert output_file.is_file()
-
-
-# Create Image from an Array
-def test_create_image_from_array():
-    rawarray = np.zeros((43,128,128))
-    arr_img = Image(rawarray, vox2mni(np.eye(4)))
-    assert arr_img.shape == (43,128,128)
\ No newline at end of file



View it on GitLab: https://salsa.debian.org/med-team/nipy/-/compare/783f90481fe76e41eab15cb31ae8ec5b911f7656...4c689bd06f5144866f26177def7bd8e3de37511a

-- 
View it on GitLab: https://salsa.debian.org/med-team/nipy/-/compare/783f90481fe76e41eab15cb31ae8ec5b911f7656...4c689bd06f5144866f26177def7bd8e3de37511a
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20250909/26670378/attachment-0001.htm>


More information about the debian-med-commit mailing list