2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
, numpy
|
2024-05-15 15:35:15 +00:00
|
|
|
, pytestCheckHook
|
|
|
|
, setuptools
|
|
|
|
, wheel
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "numexpr";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "2.10.0";
|
|
|
|
pyproject = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-yJ6TB1JjnfBAU5FgMm2PmahBWbvqQZQ6uOlgWR7arvA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
# 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.0rc1" "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
|
|
|
|
'';
|
|
|
|
|
|
|
|
build-system = [
|
|
|
|
setuptools
|
|
|
|
wheel
|
2020-12-03 08:41:04 +00:00
|
|
|
numpy
|
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
dependencies = [
|
2020-12-03 08:41:04 +00:00
|
|
|
numpy
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
preBuild = ''
|
|
|
|
# Remove existing site.cfg, use the one we built for numpy
|
|
|
|
ln -s ${numpy.cfg} site.cfg
|
|
|
|
'';
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
pushd $out
|
|
|
|
'';
|
|
|
|
|
|
|
|
postCheck = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
popd
|
|
|
|
'';
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
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"
|
|
|
|
];
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"numexpr"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Fast numerical array expression evaluator for NumPy";
|
|
|
|
homepage = "https://github.com/pydata/numexpr";
|
2022-02-10 20:34:41 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|