1{ stdenv
2, lib
3, buildPythonPackage
4, fetchPypi
5, deprecated
6, hopcroftkarp
7, joblib
8, matplotlib
9, numpy
10, scikit-learn
11, scipy
12, pytestCheckHook
13, pythonAtLeast
14, pythonOlder
15}:
16
17buildPythonPackage rec {
18 pname = "persim";
19 version = "0.3.2";
20 format = "setuptools";
21
22 disabled = pythonOlder "3.7";
23
24 src = fetchPypi {
25 inherit pname version;
26 hash = "sha256-p6Vumfr+vRDr0D9PnEZItp9vNlCLIb59HpBg1KdyHGE=";
27 };
28
29 propagatedBuildInputs = [
30 deprecated
31 hopcroftkarp
32 joblib
33 matplotlib
34 numpy
35 scikit-learn
36 scipy
37 ];
38
39 nativeCheckInputs = [
40 pytestCheckHook
41 ];
42
43 preCheck = ''
44 # specifically needed for darwin
45 export HOME=$(mktemp -d)
46 mkdir -p $HOME/.matplotlib
47 echo "backend: ps" > $HOME/.matplotlib/matplotlibrc
48 '';
49
50 pythonImportsCheck = [
51 "persim"
52 ];
53
54 disabledTests = lib.optionals (pythonAtLeast "3.10") [
55 # AttributeError: module 'collections' has no attribute 'Iterable'
56 "test_empyt_diagram_list"
57 "test_empty_diagram_list"
58 "test_fit_diagram"
59 "test_integer_diagrams"
60 "test_lists_of_lists"
61 "test_mixed_pairs"
62 "test_multiple_diagrams"
63 "test_n_pixels"
64 # https://github.com/scikit-tda/persim/issues/67
65 "test_persistenceimager"
66 # ValueError: setting an array element with a sequence
67 "test_exact_critical_pairs"
68 ];
69
70 meta = with lib; {
71 description = "Distances and representations of persistence diagrams";
72 homepage = "https://persim.scikit-tda.org";
73 changelog = "https://github.com/scikit-tda/persim/releases/tag/v${version}";
74 license = licenses.mit;
75 maintainers = with maintainers; [ ];
76 broken = stdenv.isDarwin;
77 };
78}