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.1";
20 format = "setuptools";
21
22 disabled = pythonOlder "3.7";
23
24 src = fetchPypi {
25 inherit pname version;
26 sha256 = "sha256-7w8KJHrc9hBOysFBF9sLJFgXEOqKjZZIFoBTlXALSXU=";
27 };
28
29 propagatedBuildInputs = [
30 deprecated
31 hopcroftkarp
32 joblib
33 matplotlib
34 numpy
35 scikit-learn
36 scipy
37 ];
38
39 checkInputs = [
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 ];
65
66 meta = with lib; {
67 broken = stdenv.isDarwin;
68 description = "Distances and representations of persistence diagrams";
69 homepage = "https://persim.scikit-tda.org";
70 license = licenses.mit;
71 maintainers = with maintainers; [ costrouc ];
72 };
73}