2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
2023-07-15 17:15:38 +00:00
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
2021-12-06 16:07:01 +00:00
|
|
|
, fetchFromGitHub
|
2021-03-09 03:18:52 +00:00
|
|
|
, pythonOlder
|
2020-04-24 23:36:52 +00:00
|
|
|
, mpmath
|
|
|
|
, numpy
|
|
|
|
, pybind11
|
|
|
|
, pyfma
|
|
|
|
, eigen
|
2021-03-09 03:18:52 +00:00
|
|
|
, importlib-metadata
|
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
|
2021-12-06 16:07:01 +00:00
|
|
|
, 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";
|
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "nschloe";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
|
|
|
sha256 = "0sxkwpp2xy2jgakhdxr4nh1cspqv8l89kz6s832h05pbpyc0n767";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pybind11
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [
|
2021-03-09 03:18:52 +00:00
|
|
|
eigen
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
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 = ''
|
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace "/usr/include/eigen3/" "${eigen}/include/eigen3/"
|
|
|
|
'';
|
|
|
|
|
|
|
|
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
|
|
|
|
substituteInPlace $f --replace 'import perfplot' ""
|
|
|
|
done
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
2020-10-07 09:15:18 +00:00
|
|
|
disabledTests = [ "test_speed_comparison1" "test_speed_comparison2" ];
|
|
|
|
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;
|
|
|
|
maintainers = [ maintainers.costrouc ];
|
|
|
|
};
|
|
|
|
}
|