summary refs log tree commit diff
path: root/pkgs/development/python-modules/persim/default.nix
blob: 869fb6146f2e95364246c0e7a74263fa89fe9d1c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{ stdenv
, lib
, buildPythonPackage
, fetchPypi
, deprecated
, hopcroftkarp
, joblib
, matplotlib
, numpy
, scikit-learn
, scipy
, pytestCheckHook
, pythonAtLeast
, pythonOlder
}:

buildPythonPackage rec {
  pname = "persim";
  version = "0.3.2";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-p6Vumfr+vRDr0D9PnEZItp9vNlCLIb59HpBg1KdyHGE=";
  };

  propagatedBuildInputs = [
    deprecated
    hopcroftkarp
    joblib
    matplotlib
    numpy
    scikit-learn
    scipy
  ];

  nativeCheckInputs = [
    pytestCheckHook
  ];

  preCheck = ''
    # specifically needed for darwin
    export HOME=$(mktemp -d)
    mkdir -p $HOME/.matplotlib
    echo "backend: ps" > $HOME/.matplotlib/matplotlibrc
  '';

  pythonImportsCheck = [
    "persim"
  ];

  disabledTests = lib.optionals (pythonAtLeast "3.10") [
    # AttributeError: module 'collections' has no attribute 'Iterable'
    "test_empyt_diagram_list"
    "test_empty_diagram_list"
    "test_fit_diagram"
    "test_integer_diagrams"
    "test_lists_of_lists"
    "test_mixed_pairs"
    "test_multiple_diagrams"
    "test_n_pixels"
    # https://github.com/scikit-tda/persim/issues/67
    "test_persistenceimager"
    # ValueError: setting an array element with a sequence
    "test_exact_critical_pairs"
  ];

  meta = with lib; {
    description = "Distances and representations of persistence diagrams";
    homepage = "https://persim.scikit-tda.org";
    changelog = "https://github.com/scikit-tda/persim/releases/tag/v${version}";
    license = licenses.mit;
    maintainers = with maintainers; [ ];
    broken = stdenv.isDarwin;
  };
}