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