2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
pythonOlder,
|
|
|
|
setuptools,
|
|
|
|
mpmath,
|
|
|
|
numpy,
|
|
|
|
pybind11,
|
|
|
|
pyfma,
|
|
|
|
eigen,
|
|
|
|
importlib-metadata,
|
|
|
|
pytestCheckHook,
|
|
|
|
matplotlib,
|
|
|
|
dufte,
|
|
|
|
perfplot,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "accupy";
|
2021-12-06 16:07:01 +00:00
|
|
|
version = "0.3.6";
|
2024-05-15 15:35:15 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "nschloe";
|
2024-05-15 15:35:15 +00:00
|
|
|
repo = "accupy";
|
2021-12-06 16:07:01 +00:00
|
|
|
rev = version;
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-xxwLmL/rFgDFQNr8mRBFG1/NArQk9wanelL4Lu7ls2s=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
build-system = [
|
|
|
|
setuptools
|
2021-03-09 03:18:52 +00:00
|
|
|
pybind11
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
buildInputs = [ eigen ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
dependencies = [
|
2020-04-24 23:36:52 +00:00
|
|
|
mpmath
|
|
|
|
numpy
|
|
|
|
pyfma
|
2021-03-09 03:18:52 +00:00
|
|
|
] ++ lib.optional (pythonOlder "3.8") importlib-metadata;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-12-06 16:07:01 +00:00
|
|
|
perfplot
|
2020-10-07 09:15:18 +00:00
|
|
|
pytestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
matplotlib
|
2021-03-09 03:18:52 +00:00
|
|
|
dufte
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postConfigure = ''
|
2024-06-05 15:53:02 +00:00
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace-fail "/usr/include/eigen3/" "${eigen}/include/eigen3/"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
'';
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
# This variable is needed to suppress the "Trace/BPT trap: 5" error in Darwin's checkPhase.
|
|
|
|
# Not sure of the details, but we can avoid it by changing the matplotlib backend during testing.
|
|
|
|
env.MPLBACKEND = lib.optionalString stdenv.isDarwin "Agg";
|
|
|
|
|
2020-10-07 09:15:18 +00:00
|
|
|
# performance tests aren't useful to us and disabling them allows us to
|
|
|
|
# decouple ourselves from an unnecessary build dep
|
|
|
|
preCheck = ''
|
|
|
|
for f in test/test*.py ; do
|
2024-05-15 15:35:15 +00:00
|
|
|
substituteInPlace $f --replace-quiet 'import perfplot' ""
|
2020-10-07 09:15:18 +00:00
|
|
|
done
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
2024-05-15 15:35:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
disabledTests = [
|
|
|
|
"test_speed_comparison1"
|
|
|
|
"test_speed_comparison2"
|
|
|
|
];
|
2024-05-15 15:35:15 +00:00
|
|
|
|
2020-10-07 09:15:18 +00:00
|
|
|
pythonImportsCheck = [ "accupy" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Accurate sums and dot products for Python";
|
|
|
|
homepage = "https://github.com/nschloe/accupy";
|
|
|
|
license = licenses.mit;
|
2023-08-04 22:07:22 +00:00
|
|
|
maintainers = [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|