summary refs log tree commit diff
path: root/pkgs/development/python-modules/scipy/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/scipy/default.nix')
-rw-r--r--pkgs/development/python-modules/scipy/default.nix58
1 files changed, 52 insertions, 6 deletions
diff --git a/pkgs/development/python-modules/scipy/default.nix b/pkgs/development/python-modules/scipy/default.nix
index e58a165f5cc..2c5ecd42585 100644
--- a/pkgs/development/python-modules/scipy/default.nix
+++ b/pkgs/development/python-modules/scipy/default.nix
@@ -14,7 +14,7 @@
 , pythran
 , wheel
 , nose
-, pytest
+, pytestCheckHook
 , pytest-xdist
 , numpy
 , pybind11
@@ -32,8 +32,8 @@ let
   #     nix-shell maintainers/scripts/update.nix --argstr package python3.pkgs.scipy
   #
   # The update script uses sed regexes to replace them with the updated hashes.
-  version = "1.11.2";
-  srcHash = "sha256-7FE740/yKUXtujVX60fQB/xvCZFfV69FRihvSi6+UWo=";
+  version = "1.11.3";
+  srcHash = "sha256-swxRfFjTcKjKQv6GFdWNR6IKhdJQYhZSR7UWLtcnrXw=";
   datasetsHashes = {
     ascent = "1qjp35ncrniq9rhzb14icwwykqg2208hcssznn3hz27w39615kh3";
     ecg = "1bwbjp43b7znnwha5hv6wiz3g0bhwrpqpi75s12zidxrbwvd62pj";
@@ -79,8 +79,9 @@ in buildPythonPackage {
   # Relax deps a bit
   postPatch = ''
     substituteInPlace pyproject.toml \
+      --replace 'meson-python>=0.12.1,<0.14.0' 'meson-python' \
       --replace 'numpy==' 'numpy>=' \
-      --replace "pybind11>=2.10.4,<2.11.0" "pybind11>=2.10.4,<2.12.0" \
+      --replace "pybind11>=2.10.4,<2.11.1" "pybind11>=2.10.4,<2.12.0" \
       --replace 'wheel<0.41.0' 'wheel'
   '';
 
@@ -107,7 +108,22 @@ in buildPythonPackage {
 
   __darwinAllowLocalNetworking = true;
 
-  nativeCheckInputs = [ nose pytest pytest-xdist ];
+  nativeCheckInputs = [
+    nose
+    pytestCheckHook
+    pytest-xdist
+  ];
+
+  # The following tests are broken on aarch64-darwin with newer compilers and library versions.
+  # See https://github.com/scipy/scipy/issues/18308
+  disabledTests = lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
+    "test_a_b_neg_int_after_euler_hypergeometric_transformation"
+    "test_dst4_definition_ortho"
+    "test_load_mat4_le"
+    "hyp2f1_test_case47"
+    "hyp2f1_test_case3"
+    "test_uint64_max"
+  ];
 
   doCheck = !(stdenv.isx86_64 && stdenv.isDarwin);
 
@@ -145,9 +161,38 @@ in buildPythonPackage {
 
   checkPhase = ''
     runHook preCheck
+
+    # Adapted from pytestCheckHook because scipy uses a custom check phase.
+    # It needs to pass `$args` as a Python list to `scipy.test` rather than as
+    # arguments to pytest on the command-line.
+    args=""
+    if [ -n "$disabledTests" ]; then
+      disabledTestsString=$(_pytestComputeDisabledTestsString "''${disabledTests[@]}")
+      args+="'-k','$disabledTestsString'"
+    fi
+
+    if [ -n "''${disabledTestPaths-}" ]; then
+        eval "disabledTestPaths=($disabledTestPaths)"
+    fi
+
+    for path in ''${disabledTestPaths[@]}; do
+      if [ ! -e "$path" ]; then
+        echo "Disabled tests path \"$path\" does not exist. Aborting"
+        exit 1
+      fi
+      args+="''${args:+,}'--ignore=\"$path\"'"
+    done
+    args+="''${args:+,}$(printf \'%s\', "''${pytestFlagsArray[@]}")"
+    args=''${args%,}
+
     pushd "$out"
     export OMP_NUM_THREADS=$(( $NIX_BUILD_CORES / 4 ))
-    ${python.interpreter} -c "import scipy, sys; sys.exit(scipy.test('fast', verbose=10, parallel=$NIX_BUILD_CORES) != True)"
+    ${python.interpreter} -c "import scipy, sys; sys.exit(scipy.test(
+        'fast',
+        verbose=10,
+        extra_argv=[$args],
+        parallel=$NIX_BUILD_CORES
+    ) != True)"
     popd
     runHook postCheck
   '';
@@ -170,6 +215,7 @@ in buildPythonPackage {
 
   meta = with lib; {
     description = "SciPy (pronounced 'Sigh Pie') is open-source software for mathematics, science, and engineering";
+    downloadPage = "https://github.com/scipy/scipy";
     homepage = "https://www.scipy.org/";
     license = licenses.bsd3;
     maintainers = with maintainers; [ fridh doronbehar ];