python312Packages.numpy: 1.26.4 -> 2.1.2

This commit is contained in:
natsukium
2024-11-18 18:36:49 +01:00
committed by Martin Weinelt
parent 6b9e3472ae
commit 5bfacde24b
30 changed files with 10 additions and 140 deletions
@@ -24,10 +24,6 @@ buildPythonPackage rec {
hash = "sha256-3l0qfsl7FnBFBmlx8loVDR5AYfBxWb4jZJY02zbnl0Y=";
};
postPatch = ''
substituteInPlace pyproject.toml --replace "numpy>=2.0.0rc1" "numpy"
'';
nativeBuildInputs = [
astropy-extension-helpers
numpy
@@ -36,11 +36,6 @@ buildPythonPackage rec {
hash = "sha256-NhVY4rCTqZvr5p8f1H+shqGSYHpMFu05ugqACyq2DDQ=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "numpy>=2.0.0" "numpy"
'';
build-system = [
astropy-extension-helpers
cython
@@ -9,7 +9,7 @@
pytestCheckHook,
pythonOlder,
blis,
numpy_2,
numpy_1,
gitUpdater,
}:
@@ -28,12 +28,6 @@ buildPythonPackage rec {
};
postPatch = ''
# The commit pinning numpy to version 2 doesn't have any functional changes:
# https://github.com/explosion/cython-blis/pull/108
# BLIS should thus work with numpy and numpy_2.
substituteInPlace pyproject.toml setup.py \
--replace-fail "numpy>=2.0.0,<3.0.0" numpy
# See https://github.com/numpy/numpy/issues/21079
# has no functional difference as the name is only used in log output
substituteInPlace blis/benchmark.py \
@@ -62,8 +56,8 @@ buildPythonPackage rec {
passthru = {
tests = {
numpy_2 = blis.overridePythonAttrs (old: {
numpy = numpy_2;
numpy_1 = blis.overridePythonAttrs (old: {
numpy = numpy_1;
});
};
updateScript = gitUpdater {
@@ -43,8 +43,6 @@ buildPythonPackage rec {
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "numpy>=2.0.0" "numpy"
substituteInPlace requirements-runtime.txt \
--replace "pytest" ""
'';
@@ -34,11 +34,6 @@ buildPythonPackage rec {
hash = "sha256-AckQ1WNMaafv3sRuChfUc9Iyh2fwAdTcC1xLSOWFyL0=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "numpy>=2.0.0rc1" "numpy"
'';
build-system = [ setuptools-scm ];
nativeBuildInputs = [
@@ -7,7 +7,6 @@
fsspec,
git,
numpy,
oldest-supported-numpy,
packaging,
pandas,
pytestCheckHook,
@@ -33,11 +32,6 @@ buildPythonPackage rec {
hash = "sha256-YiaVkpPzH8ZmTiEtCom9xLbKzByIt7Ilig/WlmGrYH4=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "numpy>=2.0.0rc1" "oldest-supported-numpy"
'';
build-system = [
setuptools
setuptools-scm
@@ -47,7 +41,7 @@ buildPythonPackage rec {
nativeBuildInputs = [
cython
git
oldest-supported-numpy
numpy
];
dependencies = [
@@ -51,13 +51,6 @@ buildPythonPackage rec {
touch extern/{voro++,fsph,Eigen}/.git
'';
# Scipy still depends on numpy 1, and so we'd get 'package duplicates in
# closure' error if we'd use numpy_2
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail 'numpy>=2.0.0rc1' 'numpy' \
'';
nativeBuildInputs = [
cmake
cython
@@ -4,7 +4,6 @@
cython,
fetchFromGitHub,
numpy,
numpy_2,
pytestCheckHook,
pythonOlder,
setuptools,
@@ -26,7 +25,7 @@ buildPythonPackage rec {
build-system = [
cython
numpy_2
numpy
setuptools
];
@@ -44,13 +44,6 @@ buildPythonPackage rec {
scipy
];
# scipy derivation dont support numpy_2 and is patched to use version 1
# Using numpy_2 in the derivation will cause a clojure duplicate error
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail 'numpy>=2.0.0rc1,' 'numpy' \
'';
pythonImportsCheck = [ "gstools" ];
nativeCheckInputs = [ pytestCheckHook ];
@@ -110,8 +110,6 @@ buildPythonPackage rec {
# script.
postPatch =
''
substituteInPlace pyproject.toml \
--replace-fail '"numpy>=2.0.0rc1,<2.3",' ""
patchShebangs tools
''
+ lib.optionalString (stdenv.hostPlatform.isLinux && interactive) ''
@@ -32,10 +32,6 @@ buildPythonPackage rec {
hash = "sha256-N9VX42ZUiJ1wIBkr+1b51fk4lMsymX64N65YbFOP17Y=";
};
postPatch = ''
sed -i "/numpy>=/d" pyproject.toml
'';
build-system = [
cython
oldest-supported-numpy
@@ -27,13 +27,6 @@ buildPythonPackage rec {
hash = "sha256-4Ie8fuk9CKdn/64TsCfN2No2dU16ICpBRWYerqqF0/0=";
};
# Upstream wants to build against the newest version of numpy possible, but
# we only want to build against our default numpy.
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "numpy>=2.0.0rc1,<3" "numpy"
'';
nativeBuildInputs = [
cython
setuptools
@@ -8,7 +8,7 @@
buildPythonPackage,
setuptools,
numpy,
numpy_2,
numpy_1,
llvmlite,
libcxx,
importlib-metadata,
@@ -161,8 +161,8 @@ buildPythonPackage rec {
doFullCheck = true;
testsWithoutSandbox = false;
};
numpy_2 = numba.override {
numpy = numpy_2;
numpy_1 = numba.override {
numpy = numpy_1;
};
};
@@ -32,15 +32,6 @@ buildPythonPackage rec {
dos2unix numexpr/tests/test_numexpr.py
'';
# patch for compatibility with numpy < 2.0
# see more details, https://numpy.org/devdocs/numpy_2_0_migration_guide.html#c-api-changes
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "numpy>=2.0.0" "numpy"
sed -i "1i#define PyDataType_SET_ELSIZE(descr, elsize)" numexpr/interpreter.cpp
sed -i "1i#define PyDataType_ELSIZE(descr) ((descr)->elsize)" numexpr/interpreter.cpp
'';
nativeBuildInputs = [ dos2unix ];
build-system = [
@@ -80,7 +80,6 @@ let
substituteInPlace pyproject.toml \
--replace-fail "meson-python==0.13.1" "meson-python>=0.13.1" \
--replace-fail "meson==1.2.1" "meson>=1.2.1" \
--replace-fail "numpy>=2.0" "numpy"
'';
nativeBuildInputs = [
@@ -35,11 +35,6 @@ buildPythonPackage rec {
hash = "sha256-gXtC6O8rXBBa8VMuqxshnJieAahv3bCY2C1BXNmJxb4=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "'numpy>=2.0.0'," ""
'';
build-system = [
setuptools
setuptools-scm
@@ -87,9 +87,6 @@ buildPythonPackage rec {
--replace " --durations=20" "" \
--replace " --junit-xml=junit-results.xml" ""
substituteInPlace pyproject.toml \
--replace-fail "numpy>=2.0.0" "numpy"
# we don't need setup.py to find the macos sdk for us
sed -i '/sdk_path/d' setup.py
'';
@@ -22,11 +22,6 @@ buildPythonPackage rec {
hash = "sha256-rLimcTIy6jXAS8bkCsTkYd/MgX05XvKjyAUcGjMkndM=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "numpy>=2.0.0rc1" "numpy"
'';
build-system = [
jinja2
packaging
@@ -25,11 +25,6 @@ buildPythonPackage rec {
hash = "sha256-Osz4UulGZT45nD1Nu+EZ28bT9yz9LVqVyr8L8Mf5JP4=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-warn "numpy>=2.0.0rc1,<3" "numpy"
'';
nativeBuildInputs = [
cython
numpy
@@ -43,11 +43,6 @@ buildPythonPackage rec {
hash = "sha256-o76bGItldcLfgZ5KDw2uL0GJvyljQJEwISR0topVR44=";
};
prePatch = ''
# Upstream switched to building against numpy2 but should still be compatible with numpy1
substituteInPlace pyproject.toml --replace-fail "numpy>=2.1.0" "numpy>=1.26.0"
'';
build-system = [ setuptools ];
nativeBuildInputs = [
@@ -23,11 +23,6 @@ buildPythonPackage rec {
hash = "sha256-oWAF8YDvb0SdlRzSjG2BNEekBkvR3U6KQ+e2FoIs+tw=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "numpy>=2.0.0" "numpy"
'';
build-system = [
meson-python
cython
@@ -45,12 +45,6 @@ buildPythonPackage rec {
hash = "sha256-A8o8FYuhlzL6Wl6sfB7D2KRAKZl28E6K2AdUik9zmgs=";
};
postPatch = ''
# relax numpy dependency
substituteInPlace pyproject.toml \
--replace-fail "numpy>=2" "numpy"
'';
nativeBuildInputs = [
cython
gdal
@@ -32,8 +32,7 @@ buildPythonPackage rec {
postPatch = ''
substituteInPlace pyproject.toml \
--replace "cython==" "cython>=" \
--replace "numpy>=2.0.0rc1" "numpy"
--replace "cython==" "cython>="
'';
nativeBuildInputs = [
@@ -49,9 +49,6 @@ let
postPatch = ''
patchShebangs skimage/_build_utils/{version,cythoner}.py
substituteInPlace pyproject.toml \
--replace "numpy>=2.0.0rc1" "numpy"
'';
nativeBuildInputs = [
@@ -36,9 +36,6 @@ buildPythonPackage rec {
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "numpy>=2" "numpy"
substituteInPlace meson.build --replace-fail \
"run_command('sklearn/_build_utils/version.py', check: true).stdout().strip()," \
"'${version}',"
@@ -92,13 +92,8 @@ buildPythonPackage {
})
];
# Upstream says in a comment in their pyproject.toml that building against
# both numpy 2 and numpy 1 should work, but they seem to worry about numpy
# incompatibilities that we here with Nixpkgs' Python ecosystem, shouldn't
# experience.
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail 'numpy>=2.0.0rc1,' 'numpy' \
--replace-fail "pybind11>=2.12.0,<2.13.0" "pybind11>=2.12.0" \
'';
@@ -46,12 +46,6 @@ buildPythonPackage rec {
hash = "sha256-Szfr0lraQFmw3J4Ik+cN3l34NIUymgaO8EWA5wiSpl0=";
};
postPatch = ''
# spaCy is compatible with NumPy v1 and v2
substituteInPlace pyproject.toml setup.cfg \
--replace-fail "numpy>=2.0.0,<2.1.0" numpy
'';
build-system = [
cymem
cython_0
@@ -26,11 +26,6 @@ buildPythonPackage rec {
hash = "sha256-7PNQJkP6k6q+XwvfI477WWCVF8TWCoEWMtMfzc6GwtI=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "numpy>=2.0.0,<3" "numpy"
'';
build-system = [
cython
numpy
@@ -31,13 +31,6 @@ buildPythonPackage rec {
hash = "sha256-77u4R6kIuvfnFpq5vylhOKOTZPNn5ssKjsA61xaZ0x0=";
};
postPatch = ''
# https://numpy.org/devdocs/dev/depending_on_numpy.html#numpy-2-0-specific-advice
# upstream enforce builds with numpy 2+, which is backward compat with 1.xx
substituteInPlace pyproject.toml \
--replace-fail "numpy>=2.0.0rc2" "numpy"
'';
patches = lib.optionals (!stdenv.hostPlatform.isDarwin) [
(substituteAll {
src = ./library-paths.patch;
+1 -1
View File
@@ -9257,7 +9257,7 @@ self: super: with self; {
numpy_1 = callPackage ../development/python-modules/numpy/1.nix { };
numpy_2 = callPackage ../development/python-modules/numpy/2.nix { };
numpy = if self.pythonOlder "3.13" then numpy_1 else numpy_2;
numpy = numpy_2;
numpy-groupies = callPackage ../development/python-modules/numpy-groupies { };