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