~ruther/guix-local

859e9fd56fd40ebb81e036552acd698691f9cabf — Sharlatan Hellseher 3 months ago d601af1
gnu: python-scipy: Update to 1.16.3.

* gnu/packages/python-science.scm (python-scipy): Update to 1.16.3.
[arguments] <test-flags>: Use Pytest directly, as seen in project's
GitHub Actions.
<phases>: Remove 'apply-i686-patch; add 'relax-requirements,
'hide-gfortran; rework custom 'check to run Pytest directly.
[native-inputs]: Remove gcc, python-cython-0; add python-cython, and
python-hypothesis.
[inputs]: Remove pybind11-2.10; add boost, pybind11, qhull, and xsimd.

* gnu/packages/patches/python-scipy-i686.patch: Delete file.
* gnu/local.mk (dist_patch_DATA): Deregister patch.

Change-Id: Ibc38577b9b0c915e54ca3b3096727c9c2f82e19c
Signed-off-by: Rutherther <rutherther@ditigal.xyz>
3 files changed, 74 insertions(+), 73 deletions(-)

M gnu/local.mk
D gnu/packages/patches/python-scipy-i686.patch
M gnu/packages/python-science.scm
M gnu/local.mk => gnu/local.mk +0 -1
@@ 2222,7 2222,6 @@ dist_patch_DATA =						\
  %D%/packages/patches/python-pytorch-system-libraries.patch	\
  %D%/packages/patches/python-pytorch-without-kineto.patch	\
  %D%/packages/patches/python-robotframework-sshlibrary-rf5-compat.patch \
  %D%/packages/patches/python-scipy-i686.patch 			\
  %D%/packages/patches/python-vaex-core-fix-tsl-use.patch	\
  %D%/packages/patches/python-vega-datasets-remove-la-riots-code.patch	\
  %D%/packages/patches/python-versioneer-guix-support.patch	\

D gnu/packages/patches/python-scipy-i686.patch => gnu/packages/patches/python-scipy-i686.patch +0 -49
@@ 1,49 0,0 @@
From https://github.com/scipy/scipy/pull/20135

From 53796772ed735c1564863fc7ca8d902acb628167 Mon Sep 17 00:00:00 2001
From: Ralf Gommers <ralf.gommers@gmail.com>
Date: Thu, 22 Feb 2024 09:10:46 +0100
Subject: [PATCH] MAINT: interpolate: define `F_INT` as `int` rather than
 `npy_int32`

This fixes an incompatible pointer issue that shows up as a warning in
Windows CI jobs, and is reported to break the build with GCC 14 on
Fedora 40 in gh-19993.

Using `#define F_INT int` is done in several other submodules; this
was the only instance of using `npy_int32`.

Closes gh-19993
---
 scipy/interpolate/src/_fitpackmodule.c | 4 ++--
 scipy/interpolate/src/fitpack.pyf      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/scipy/interpolate/src/_fitpackmodule.c b/scipy/interpolate/src/_fitpackmodule.c
index 0e913d1c7e43..dc79b2b28833 100644
--- a/scipy/interpolate/src/_fitpackmodule.c
+++ b/scipy/interpolate/src/_fitpackmodule.c
@@ -28,8 +28,8 @@ static PyObject *fitpack_error;
 
 #else
 
-#define F_INT npy_int32
-#define F_INT_NPY NPY_INT32
+#define F_INT int
+#define F_INT_NPY NPY_INT
 #define F_INT_MAX NPY_MAX_INT32
 #if NPY_BITSOF_SHORT == 32
 #define F_INT_PYFMT   "h"
diff --git a/scipy/interpolate/src/fitpack.pyf b/scipy/interpolate/src/fitpack.pyf
index 08cb0c141c98..a9535a83f479 100644
--- a/scipy/interpolate/src/fitpack.pyf
+++ b/scipy/interpolate/src/fitpack.pyf
@@ -16,7 +16,7 @@ python module dfitpack ! in
 #ifdef HAVE_ILP64
 typedef npy_int64 F_INT;
 #else
-typedef npy_int32 F_INT;
+typedef int F_INT;
 #endif
 
 static double dmax(double* seq, F_INT len) {

M gnu/packages/python-science.scm => gnu/packages/python-science.scm +74 -23
@@ 3441,47 3441,95 @@ cross-validation.")
(define-public python-scipy
  (package
    (name "python-scipy")
    (version "1.12.0")
    (version "1.16.3")
    ;; TODO: PyPI archive bundles extra in subprojects:
    ;; - https://github.com/boostorg/math
    ;; - https://github.com/scipy/HiGHS
    ;; - https://github.com/scipy/xsf
    ;; - qhull
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "scipy" version))
       (sha256
        (base32 "18rn15wg3lp58z204fbjjhy0h79c53yg3c4qqs9h3liniamspxab"))))
        (base32 "1jxf6mjr3whbh23p8bnlcyiss5rsamq37qgys8xz8qi781cpds01"))))
    (build-system pyproject-build-system)
    (arguments
     (list
      ;; tests: 78689 passed, 4982 skipped, 319 xfailed, 19 xpassed, 2660 warnings
      #:configure-flags
      ''(("setup-args" . #("-Duse-system-libraries=all")))
      #:test-flags
      #~(list "--durations=10"
              "--numprocesses" (number->string (min 4 (parallel-job-count)))
              "--pyargs" "scipy"
              "-k" (string-join
                    ;; Network access is requied.
                    (list "not test_ascent"
                          "test_electrocardiogram"
                          "test_existence_all"
                          "test_face"
                          ;; pycparser.ply.yacc.YaccError: Unable to build parser
                          "test_callbacks"
                          "test_bad_callbacks"
                          ;; AssertionError: Items are not equal: ACTUAL:
                          ;; np.complex128(inf+nanj) DESIRED: (inf+0j)
                          "test_expm1_complex"
                          ;; AssertionError: Not equal to tolerance rtol=1e-07, atol=0
                          "test_log1p_complex"
                          ;; AssertionError: Not equal to tolerance rtol=5e-09, atol=0
                          "test_nctdtr_accuracy[3.0-5.0--2.0-1.5645373999149622e-09-5e-09]"
                          ;; Bad results (X out of Y) for the following points
                          ;; (in output 0):
                          "test_spherical_in_complex"
                          "test_spherical_jn_complex"
                          "test_spherical_kn"
                          "test_spherical_yn_complex"
                          ;; Not equal to tolerance rtol=1e-07, atol=0
                          "test_negative_real_gh14582[spherical_in-False]"
                          "test_negative_real_gh14582[spherical_in-True]"
                          "test_negative_real_gh14582[spherical_jn-False]"
                          "test_negative_real_gh14582[spherical_jn-True]"
                          "test_negative_real_gh14582[spherical_yn-False]"
                          "test_negative_real_gh14582[spherical_yn-True]"
                          ;; Failed: DID NOT WARN. No warnings of type (<class
                          ;; 'RuntimeWarning'>,) were emitted.
                          "test_boost_eval_issue_14606")
                    " and not "))
      #:phases
      #~(modify-phases %standard-phases
          #$@(if (target-x86-32?)
                 #~((add-after 'unpack 'apply-i686-patch
                      (lambda _
                        (let ((patch-file
                               #$(local-file
                                  (search-patch "python-scipy-i686.patch"))))
                          (invoke "patch" "--force" "-p1" "-i"
                                  patch-file)))))
                 #~())
          (add-after 'unpack 'relax-requirements
            (lambda _
              (substitute* "meson.build"
                ;; boost
                (("1.88.0") "1.89.0"))))
          (add-after 'set-paths 'hide-gfortran
            ;; See: <https://issues.guix.gnu.org/73439#45>.
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((gfortran #$(this-package-native-input "gfortran")))
                (setenv "CPLUS_INCLUDE_PATH"
                        (string-join
                         (delete (string-append gfortran "/include/c++")
                                 (string-split (getenv "CPLUS_INCLUDE_PATH") #\:))
                         ":")))))
          (replace 'check
            (lambda* (#:key tests? #:allow-other-keys)
            (lambda* (#:key test-flags tests? #:allow-other-keys)
              (when tests?
                ;; Step out of the source directory to avoid interference.
                ;; See: <.github/workflows/linux.yml> for any other posible
                ;; tests setup.
                (with-directory-excursion "/tmp"
                  (invoke "python" "-c"
                          (string-append
                           "import scipy; scipy.test('fast', parallel="
                           (number->string (parallel-job-count))
                           ", verbose=2)")))))))))
                  (setenv "HOME" "/tmp")
                  (setenv "PYTHONOPTIMIZE" "2")
                  (apply invoke "pytest" "-vv" test-flags))))))))
    (native-inputs
     (list gfortran
           ;; XXX: Adding gfortran shadows GCC headers, causing a compilation
           ;; failure.  Somehow also providing GCC works around it ...
           gcc
           meson-python
           pkg-config
           python-click
           python-cython-0
           python-cython
           python-doit
           python-hypothesis
           python-mpmath
           python-numpydoc
           python-pooch


@@ 3495,8 3543,11 @@ cross-validation.")
           python-threadpoolctl
           python-typing-extensions))
    (inputs
     (list openblas
           pybind11-2.10))
     (list boost
           openblas
           pybind11
           qhull
           xsimd))
    (propagated-inputs
     (list python-numpy))
    (home-page "https://scipy.org/")