···77 python,
88 buildPythonPackage,
99 setuptools,
1010- numpy,
1110 numpy_2,
1211 llvmlite,
1312 libcxx,
···1716 runCommand,
1817 writers,
1918 numba,
1919+ pytestCheckHook,
20202121 config,
2222···27272828 # CUDA flags:
2929 cudaSupport ? config.cudaSupport,
3030+ testsWithoutSandbox ? false,
3131+ doFullCheck ? false,
3032}:
31333234let
3335 cudatoolkit = cudaPackages.cuda_nvcc;
3436in
3537buildPythonPackage rec {
3636- version = "0.60.0";
3838+ version = "0.61.0dev0";
3739 pname = "numba";
3840 pyproject = true;
3941···5456 # that upstream relies on those strings to be valid, that's why we don't
5557 # use `forceFetchGit = true;`.` If in the future we'll observe the hash
5658 # changes too often, we can always use forceFetchGit, and inject the
5757- # relevant strings ourselves, using `sed` commands, in extraPostFetch.
5858- hash = "sha256-hUL281wHLA7wo8umzBNhiGJikyIF2loCzjLECuC+pO0=";
5959+ # relevant strings ourselves, using `substituteInPlace`, in postFetch.
6060+ hash = "sha256-KF9YQ6/FIfUQTJCAMgfIqnb/D8mdMbCC/tJvfYlSkgI=";
6161+ # TEMPORARY: The way upstream knows it's source version is explained above,
6262+ # and without this upstream sets the version in ${python.sitePackages} as
6363+ # 0.61.0dev0, which causes dependent packages fail to find a valid
6464+ # version of numba.
6565+ postFetch = ''
6666+ substituteInPlace $out/numba/_version.py \
6767+ --replace-fail \
6868+ 'git_refnames = " (tag: ${version})"' \
6969+ 'git_refnames = " (tag: 0.61.0, release0.61)"'
7070+ '';
5971 };
60726173 postPatch = ''
···69817082 build-system = [
7183 setuptools
7272- numpy_2
7384 ];
74857586 nativeBuildInputs = lib.optionals cudaSupport [
···7788 cudaPackages.cuda_nvcc
7889 ];
79908080- buildInputs = lib.optionals cudaSupport [ cudaPackages.cuda_cudart ];
9191+ buildInputs = [
9292+ # Not propagating it, because it numba can work with either numpy_2 or numpy_1
9393+ numpy_2
9494+ ] ++ lib.optionals cudaSupport [ cudaPackages.cuda_cudart ];
81958296 dependencies = [
8383- numpy
8497 llvmlite
8598 setuptools
8699 ] ++ lib.optionals (pythonOlder "3.9") [ importlib-metadata ];
···103116 })
104117 ];
105118106106- # run a smoke test in a temporary directory so that
107107- # a) Python picks up the installed library in $out instead of the build files
108108- # b) we have somewhere to put $HOME so some caching tests work
109109- # c) it doesn't take 6 CPU hours for the full suite
110110- checkPhase = ''
111111- runHook preCheck
112112-113113- pushd $(mktemp -d)
114114- HOME=. ${python.interpreter} -m numba.runtests -m $NIX_BUILD_CORES numba.tests.test_usecases
115115- popd
119119+ nativeCheckInputs = [
120120+ pytestCheckHook
121121+ ];
116122117117- runHook postCheck
123123+ preCheck = ''
124124+ export HOME="$(mktemp -d)"
125125+ # https://github.com/NixOS/nixpkgs/issues/255262
126126+ cd $out
118127 '';
119128129129+ pytestFlagsArray = lib.optionals (!doFullCheck) [
130130+ # These are the most basic tests. Running all tests is too expensive, and
131131+ # some of them fail (also differently on different platforms), so it will
132132+ # be too hard to maintain such a `disabledTests` list.
133133+ "${python.sitePackages}/numba/tests/test_usecases.py"
134134+ ];
135135+136136+ disabledTestPaths = lib.optionals (!testsWithoutSandbox) [
137137+ # See NOTE near passthru.tests.withoutSandbox
138138+ "${python.sitePackages}/numba/cuda/tests"
139139+ ];
140140+120141 pythonImportsCheck = [ "numba" ];
121142122143 passthru.testers.cuda-detect =
···128149 '';
129150 passthru.tests = {
130151 # CONTRIBUTOR NOTE: numba also contains CUDA tests, though these cannot be run in
131131- # this sandbox environment. Consider running similar commands to those below outside the
132132- # sandbox manually if you have the appropriate hardware; support will be detected
133133- # and the corresponding tests enabled automatically.
134134- # Also, the full suite currently does not complete on anything but x86_64-linux.
135135- fullSuite = runCommand "${pname}-test" { } ''
136136- pushd $(mktemp -d)
137137- # pip and python in $PATH is needed for the test suite to pass fully
138138- PATH=${
139139- python.withPackages (p: [
140140- p.numba
141141- p.pip
142142- ])
143143- }/bin:$PATH
144144- HOME=$PWD python -m numba.runtests -m $NIX_BUILD_CORES
145145- popd
146146- touch $out # stop Nix from complaining no output was generated and failing the build
147147- '';
152152+ # this sandbox environment. Consider building the derivation below with
153153+ # --no-sandbox to get a view of how many tests succeed outside the sandbox.
154154+ withoutSandbox = numba.override {
155155+ doFullCheck = true;
156156+ cudaSupport = true;
157157+ testsWithoutSandbox = true;
158158+ };
159159+ withSandbox = numba.override {
160160+ cudaSupport = false;
161161+ doFullCheck = true;
162162+ testsWithoutSandbox = false;
163163+ };
148164 };
149165150166 meta = with lib; {