1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonOlder
5, mpmath
6, numpy
7, pybind11
8, pyfma
9, eigen
10, importlib-metadata
11, pytestCheckHook
12, matplotlib
13, dufte
14, perfplot
15}:
16
17buildPythonPackage rec {
18 pname = "accupy";
19 version = "0.3.6";
20 disabled = pythonOlder "3.7";
21
22 src = fetchFromGitHub {
23 owner = "nschloe";
24 repo = pname;
25 rev = version;
26 sha256 = "0sxkwpp2xy2jgakhdxr4nh1cspqv8l89kz6s832h05pbpyc0n767";
27 };
28
29 nativeBuildInputs = [
30 pybind11
31 ];
32
33 buildInputs = [
34 eigen
35 ];
36
37 propagatedBuildInputs = [
38 mpmath
39 numpy
40 pyfma
41 ] ++ lib.optional (pythonOlder "3.8") importlib-metadata;
42
43 nativeCheckInputs = [
44 perfplot
45 pytestCheckHook
46 matplotlib
47 dufte
48 ];
49
50 postConfigure = ''
51 substituteInPlace setup.py \
52 --replace "/usr/include/eigen3/" "${eigen}/include/eigen3/"
53 '';
54
55 preBuild = ''
56 export HOME=$(mktemp -d)
57 '';
58
59 # performance tests aren't useful to us and disabling them allows us to
60 # decouple ourselves from an unnecessary build dep
61 preCheck = ''
62 for f in test/test*.py ; do
63 substituteInPlace $f --replace 'import perfplot' ""
64 done
65 '';
66 disabledTests = [ "test_speed_comparison1" "test_speed_comparison2" ];
67 pythonImportsCheck = [ "accupy" ];
68
69 meta = with lib; {
70 description = "Accurate sums and dot products for Python";
71 homepage = "https://github.com/nschloe/accupy";
72 license = licenses.mit;
73 maintainers = [ maintainers.costrouc ];
74 };
75}