nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 setuptools,
7 mpmath,
8 numpy,
9 pybind11,
10 pyfma,
11 eigen,
12 pytestCheckHook,
13 matplotlib,
14 dufte,
15 perfplot,
16}:
17
18buildPythonPackage rec {
19 pname = "accupy";
20 version = "0.3.6";
21 pyproject = true;
22
23 src = fetchFromGitHub {
24 owner = "nschloe";
25 repo = "accupy";
26 rev = version;
27 hash = "sha256-xxwLmL/rFgDFQNr8mRBFG1/NArQk9wanelL4Lu7ls2s=";
28 };
29
30 build-system = [
31 setuptools
32 pybind11
33 ];
34
35 buildInputs = [ eigen ];
36
37 dependencies = [
38 mpmath
39 numpy
40 pyfma
41 ];
42
43 nativeCheckInputs = [
44 perfplot
45 pytestCheckHook
46 matplotlib
47 dufte
48 ];
49
50 postConfigure = ''
51 substituteInPlace setup.py \
52 --replace-fail "/usr/include/eigen3/" "${eigen}/include/eigen3/"
53 '';
54
55 preBuild = ''
56 export HOME=$(mktemp -d)
57 '';
58
59 # This variable is needed to suppress the "Trace/BPT trap: 5" error in Darwin's checkPhase.
60 # Not sure of the details, but we can avoid it by changing the matplotlib backend during testing.
61 env.MPLBACKEND = lib.optionalString stdenv.hostPlatform.isDarwin "Agg";
62
63 # performance tests aren't useful to us and disabling them allows us to
64 # decouple ourselves from an unnecessary build dep
65 preCheck = ''
66 for f in test/test*.py ; do
67 substituteInPlace $f --replace-quiet 'import perfplot' ""
68 done
69 '';
70
71 disabledTests = [
72 "test_speed_comparison1"
73 "test_speed_comparison2"
74 ];
75
76 pythonImportsCheck = [ "accupy" ];
77
78 meta = {
79 description = "Accurate sums and dot products for Python";
80 homepage = "https://github.com/nschloe/accupy";
81 license = lib.licenses.mit;
82 maintainers = [ ];
83 };
84}