diff --git a/pkgs/development/python-modules/llvmlite/default.nix b/pkgs/development/python-modules/llvmlite/default.nix index 2d92814a1835d..9fdcab6d7534e 100644 --- a/pkgs/development/python-modules/llvmlite/default.nix +++ b/pkgs/development/python-modules/llvmlite/default.nix @@ -11,7 +11,7 @@ setuptools, # tests - python, + pytestCheckHook, }: buildPythonPackage rec { @@ -33,12 +33,9 @@ buildPythonPackage rec { setuptools ]; - # Disable static linking - # https://github.com/numba/llvmlite/issues/93 postPatch = '' - substituteInPlace ffi/Makefile.linux --replace "-static-libstdc++" "" - - substituteInPlace llvmlite/tests/test_binding.py --replace "test_linux" "nope" + substituteInPlace llvmlite/tests/test_binding.py \ + --replace-fail "test_linux" "nope" ''; # Set directory containing llvm-config binary @@ -46,21 +43,23 @@ buildPythonPackage rec { export LLVM_CONFIG=${llvm.dev}/bin/llvm-config ''; - checkPhase = '' - runHook preCheck - ${python.executable} runtests.py - runHook postCheck + nativeCheckInputs = [ + pytestCheckHook + ]; + # https://github.com/NixOS/nixpkgs/issues/255262 + preCheck = '' + cd $out ''; __impureHostDeps = lib.optionals stdenv.isDarwin [ "/usr/lib/libm.dylib" ]; passthru.llvm = llvm; - meta = with lib; { + meta = { changelog = "https://github.com/numba/llvmlite/blob/v${version}/CHANGE_LOG"; description = "Lightweight LLVM python binding for writing JIT compilers"; downloadPage = "https://github.com/numba/llvmlite"; homepage = "http://llvmlite.pydata.org/"; - license = licenses.bsd2; + license = lib.licenses.bsd2; }; } diff --git a/pkgs/development/python-modules/numba/default.nix b/pkgs/development/python-modules/numba/default.nix index 66d1aa36c4b48..eec0c6a83a289 100644 --- a/pkgs/development/python-modules/numba/default.nix +++ b/pkgs/development/python-modules/numba/default.nix @@ -7,7 +7,6 @@ python, buildPythonPackage, setuptools, - numpy, numpy_2, llvmlite, libcxx, @@ -17,6 +16,7 @@ runCommand, writers, numba, + pytestCheckHook, config, @@ -27,13 +27,15 @@ # CUDA flags: cudaSupport ? config.cudaSupport, + testsWithoutSandbox ? false, + doFullCheck ? false, }: let cudatoolkit = cudaPackages.cuda_nvcc; in buildPythonPackage rec { - version = "0.60.0"; + version = "0.61.0dev0"; pname = "numba"; pyproject = true; @@ -54,8 +56,18 @@ buildPythonPackage rec { # that upstream relies on those strings to be valid, that's why we don't # use `forceFetchGit = true;`.` If in the future we'll observe the hash # changes too often, we can always use forceFetchGit, and inject the - # relevant strings ourselves, using `sed` commands, in extraPostFetch. - hash = "sha256-hUL281wHLA7wo8umzBNhiGJikyIF2loCzjLECuC+pO0="; + # relevant strings ourselves, using `substituteInPlace`, in postFetch. + hash = "sha256-KF9YQ6/FIfUQTJCAMgfIqnb/D8mdMbCC/tJvfYlSkgI="; + # TEMPORARY: The way upstream knows it's source version is explained above, + # and without this upstream sets the version in ${python.sitePackages} as + # 0.61.0dev0, which causes dependent packages fail to find a valid + # version of numba. + postFetch = '' + substituteInPlace $out/numba/_version.py \ + --replace-fail \ + 'git_refnames = " (tag: ${version})"' \ + 'git_refnames = " (tag: 0.61.0, release0.61)"' + ''; }; postPatch = '' @@ -69,7 +81,6 @@ buildPythonPackage rec { build-system = [ setuptools - numpy_2 ]; nativeBuildInputs = lib.optionals cudaSupport [ @@ -77,10 +88,12 @@ buildPythonPackage rec { cudaPackages.cuda_nvcc ]; - buildInputs = lib.optionals cudaSupport [ cudaPackages.cuda_cudart ]; + buildInputs = [ + # Not propagating it, because it numba can work with either numpy_2 or numpy_1 + numpy_2 + ] ++ lib.optionals cudaSupport [ cudaPackages.cuda_cudart ]; dependencies = [ - numpy llvmlite setuptools ] ++ lib.optionals (pythonOlder "3.9") [ importlib-metadata ]; @@ -103,20 +116,28 @@ buildPythonPackage rec { }) ]; - # run a smoke test in a temporary directory so that - # a) Python picks up the installed library in $out instead of the build files - # b) we have somewhere to put $HOME so some caching tests work - # c) it doesn't take 6 CPU hours for the full suite - checkPhase = '' - runHook preCheck - - pushd $(mktemp -d) - HOME=. ${python.interpreter} -m numba.runtests -m $NIX_BUILD_CORES numba.tests.test_usecases - popd + nativeCheckInputs = [ + pytestCheckHook + ]; - runHook postCheck + preCheck = '' + export HOME="$(mktemp -d)" + # https://github.com/NixOS/nixpkgs/issues/255262 + cd $out ''; + pytestFlagsArray = lib.optionals (!doFullCheck) [ + # These are the most basic tests. Running all tests is too expensive, and + # some of them fail (also differently on different platforms), so it will + # be too hard to maintain such a `disabledTests` list. + "${python.sitePackages}/numba/tests/test_usecases.py" + ]; + + disabledTestPaths = lib.optionals (!testsWithoutSandbox) [ + # See NOTE near passthru.tests.withoutSandbox + "${python.sitePackages}/numba/cuda/tests" + ]; + pythonImportsCheck = [ "numba" ]; passthru.testers.cuda-detect = @@ -128,23 +149,18 @@ buildPythonPackage rec { ''; passthru.tests = { # CONTRIBUTOR NOTE: numba also contains CUDA tests, though these cannot be run in - # this sandbox environment. Consider running similar commands to those below outside the - # sandbox manually if you have the appropriate hardware; support will be detected - # and the corresponding tests enabled automatically. - # Also, the full suite currently does not complete on anything but x86_64-linux. - fullSuite = runCommand "${pname}-test" { } '' - pushd $(mktemp -d) - # pip and python in $PATH is needed for the test suite to pass fully - PATH=${ - python.withPackages (p: [ - p.numba - p.pip - ]) - }/bin:$PATH - HOME=$PWD python -m numba.runtests -m $NIX_BUILD_CORES - popd - touch $out # stop Nix from complaining no output was generated and failing the build - ''; + # this sandbox environment. Consider building the derivation below with + # --no-sandbox to get a view of how many tests succeed outside the sandbox. + withoutSandbox = numba.override { + doFullCheck = true; + cudaSupport = true; + testsWithoutSandbox = true; + }; + withSandbox = numba.override { + cudaSupport = false; + doFullCheck = true; + testsWithoutSandbox = false; + }; }; meta = with lib; { diff --git a/pkgs/development/python-modules/numpy/2.nix b/pkgs/development/python-modules/numpy/2.nix index a94badd18c6f9..4164b7c80a93c 100644 --- a/pkgs/development/python-modules/numpy/2.nix +++ b/pkgs/development/python-modules/numpy/2.nix @@ -58,7 +58,7 @@ let in buildPythonPackage rec { pname = "numpy"; - version = "2.0.1"; + version = "2.1.0"; pyproject = true; disabled = pythonOlder "3.10"; @@ -66,7 +66,7 @@ buildPythonPackage rec { src = fetchPypi { inherit pname version; extension = "tar.gz"; - hash = "sha256-SFuHI1eWQQw1GaaZz+H6qwl+UJ6Q67BdzQmNsq6H57M="; + hash = "sha256-fckNoAgffh2knsTjmO3mqOnMT16+X54GtEPtiJ7pqqI="; }; patches = lib.optionals python.hasDistutilsCxxPatch [