about 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.nix92
1 files changed, 56 insertions, 36 deletions
diff --git a/pkgs/development/python-modules/scipy/default.nix b/pkgs/development/python-modules/scipy/default.nix
index 1bd02b708089e..4677b47f1188f 100644
--- a/pkgs/development/python-modules/scipy/default.nix
+++ b/pkgs/development/python-modules/scipy/default.nix
@@ -1,31 +1,41 @@
 {
   lib,
   stdenv,
-  fetchFromGitHub,
-  fetchpatch,
   fetchurl,
   writeText,
   python,
-  pythonOlder,
   buildPythonPackage,
+  fetchFromGitHub,
+  fetchpatch,
+
+  # build-system
   cython,
   gfortran,
   meson-python,
   nukeReferences,
-  pkg-config,
   pythran,
-  wheel,
+  pkg-config,
   setuptools,
-  hypothesis,
-  pytest7CheckHook,
-  pytest-xdist,
-  numpy,
+  xcbuild,
+
+  # buildInputs
+  # Upstream has support for using Darwin's Accelerate package. However this
+  # requires a Darwin user to work on a nice way to do that via an override.
+  # See:
+  # https://github.com/scipy/scipy/blob/v1.14.0/scipy/meson.build#L194-L211
+  blas,
+  lapack,
   pybind11,
   pooch,
-  libxcrypt,
   xsimd,
-  blas,
-  lapack,
+
+  # dependencies
+  numpy,
+
+  # tests
+  hypothesis,
+  pytest7CheckHook,
+  pytest-xdist,
 
   # Reverse dependency
   sage,
@@ -38,8 +48,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.13.1";
-  srcHash = "sha256-KpTvBJhiJ/IBjIFQhvS+NhRP3tbyXU5gQnAiFv47sKU=";
+  version = "1.14.0";
+  srcHash = "sha256-rNplvbDExmMfcPuvhs+y9j5/9G6QR1GdMgQLty6oi2c=";
   datasetsHashes = {
     ascent = "1qjp35ncrniq9rhzb14icwwykqg2208hcssznn3hz27w39615kh3";
     ecg = "1bwbjp43b7znnwha5hv6wiz3g0bhwrpqpi75s12zidxrbwvd62pj";
@@ -55,7 +65,7 @@ let
   # Additional cross compilation related properties that scipy reads in scipy/meson.build
   crossFileScipy = writeText "cross-file-scipy.conf" ''
     [properties]
-    numpy-include-dir = '${numpy}/${python.sitePackages}/numpy/core/include'
+    numpy-include-dir = '${numpy.coreIncludeDir}'
     pythran-include-dir = '${pythran}/${python.sitePackages}/pythran'
     host-python-path = '${python.interpreter}'
     host-python-version = '${python.pythonVersion}'
@@ -63,12 +73,12 @@ let
 in
 buildPythonPackage {
   inherit pname version;
-  format = "pyproject";
+  pyproject = true;
 
   src = fetchFromGitHub {
     owner = "scipy";
-    repo = pname;
-    rev = "v${version}";
+    repo = "scipy";
+    rev = "refs/tags/v${version}";
     hash = srcHash;
     fetchSubmodules = true;
   };
@@ -89,18 +99,26 @@ buildPythonPackage {
   postPatch = ''
     substituteInPlace pyproject.toml \
       --replace-fail 'numpy>=2.0.0rc1,' 'numpy' \
+      --replace-fail "pybind11>=2.12.0,<2.13.0" "pybind11>=2.12.0" \
   '';
 
-  nativeBuildInputs = [
-    cython
-    gfortran
-    meson-python
-    nukeReferences
-    pythran
-    pkg-config
-    wheel
-    setuptools
-  ];
+  build-system =
+    [
+      cython
+      gfortran
+      meson-python
+      nukeReferences
+      pythran
+      pkg-config
+      setuptools
+    ]
+    ++ lib.optionals stdenv.hostPlatform.isDarwin [
+      # Minimal version required according to:
+      # https://github.com/scipy/scipy/blob/v1.14.0/scipy/meson.build#L185-L188
+      (xcbuild.override {
+        sdkVer = "13.3";
+      })
+    ];
 
   buildInputs = [
     blas
@@ -108,9 +126,9 @@ buildPythonPackage {
     pybind11
     pooch
     xsimd
-  ] ++ lib.optionals (pythonOlder "3.9") [ libxcrypt ];
+  ];
 
-  propagatedBuildInputs = [ numpy ];
+  dependencies = [ numpy ];
 
   __darwinAllowLocalNetworking = true;
 
@@ -123,7 +141,7 @@ buildPythonPackage {
 
   # 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) [
+  disabledTests = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
     "test_a_b_neg_int_after_euler_hypergeometric_transformation"
     "test_dst4_definition_ortho"
     "test_load_mat4_le"
@@ -132,7 +150,7 @@ buildPythonPackage {
     "test_uint64_max"
   ];
 
-  doCheck = !(stdenv.isx86_64 && stdenv.isDarwin);
+  doCheck = !(stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform.isDarwin);
 
   preConfigure =
     ''
@@ -169,7 +187,9 @@ buildPythonPackage {
   #
   #         ldr     x0, [x0, ___stack_chk_guard];momd
   #
-  hardeningDisable = lib.optionals (stdenv.isAarch64 && stdenv.isDarwin) [ "stackprotector" ];
+  hardeningDisable = lib.optionals (stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isDarwin) [
+    "stackprotector"
+  ];
 
   # remove references to dev dependencies
   postInstall = ''
@@ -201,12 +221,12 @@ buildPythonPackage {
 
   SCIPY_USE_G77_ABI_WRAPPER = 1;
 
-  meta = with lib; {
+  meta = {
     changelog = "https://github.com/scipy/scipy/releases/tag/v${version}";
     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; [ doronbehar ];
+    license = lib.licenses.bsd3;
+    maintainers = with lib.maintainers; [ doronbehar ];
   };
 }