0c096610cd
and install pytest-run-parallel for pytest thread-unsafe mark.
74 lines
1.6 KiB
Nix
74 lines
1.6 KiB
Nix
{
|
|
lib,
|
|
buildPythonPackage,
|
|
fetchPypi,
|
|
numpy,
|
|
pytest-run-parallel,
|
|
pytestCheckHook,
|
|
setuptools,
|
|
# sets NUMEXPR_NUM_THREADS and OMP_NUM_THREADS for packages
|
|
# invoking numexpr during checkPhase/installCheckPhase to
|
|
# avoid overloading builders with excessive parallelism
|
|
# See also: https://numexpr.readthedocs.io/en/latest/user_guide.html#threadpool-configuration
|
|
checkPhaseThreadLimitHook,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "numexpr";
|
|
version = "2.14.1";
|
|
pyproject = true;
|
|
|
|
src = fetchPypi {
|
|
inherit pname version;
|
|
hash = "sha256-S+ALEIbHt6XDLjFVgSK3uAJD/gmFebFwln2oPzFStIs=";
|
|
};
|
|
|
|
build-system = [
|
|
setuptools
|
|
numpy
|
|
];
|
|
|
|
dependencies = [ numpy ];
|
|
|
|
preBuild = ''
|
|
# Remove existing site.cfg, use the one we built for numpy
|
|
ln -s ${numpy.cfg} site.cfg
|
|
'';
|
|
|
|
nativeCheckInputs = [
|
|
pytest-run-parallel
|
|
pytestCheckHook
|
|
];
|
|
|
|
propagatedNativeBuildInputs = [
|
|
checkPhaseThreadLimitHook
|
|
];
|
|
|
|
# tests check for OMP_NUM_THREADS application and complete quick enough
|
|
env.dontLimitCheckPhaseThreads = 1;
|
|
|
|
preCheck = ''
|
|
pushd $out
|
|
'';
|
|
|
|
postCheck = ''
|
|
popd
|
|
'';
|
|
|
|
disabledTests = [
|
|
# fails on computers with more than 8 threads
|
|
# https://github.com/pydata/numexpr/issues/479
|
|
"test_numexpr_max_threads_empty_string"
|
|
"test_omp_num_threads_empty_string"
|
|
];
|
|
|
|
pythonImportsCheck = [ "numexpr" ];
|
|
|
|
meta = {
|
|
description = "Fast numerical array expression evaluator for NumPy";
|
|
homepage = "https://github.com/pydata/numexpr";
|
|
license = lib.licenses.mit;
|
|
maintainers = [ ];
|
|
};
|
|
}
|