about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/hdbscan/default.nix
blob: 89f01e29d46d70afd64302f308bf44b6fb5d1691 (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
{ lib
, buildPythonPackage
, fetchpatch
, cython
, numpy
, pytestCheckHook
, scipy
, scikit-learn
, fetchPypi
, joblib
, six
, pythonRelaxDepsHook
}:

buildPythonPackage rec {
  pname = "hdbscan";
  version = "0.8.33";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-V/q8Xw5F9I0kB7NccxGSq8iWN2QR/n5LuDb/oD04+Q0=";
  };
  patches = [
    # should be included in next release
    (fetchpatch {
      name = "joblib-1.2.0-compat.patch";
      url = "https://github.com/scikit-learn-contrib/hdbscan/commit/d829c639923f6866e1917e46ddbde45b513913f3.patch";
      excludes = [
        "docs/basic_hdbscan.rst"
        "docs/how_hdbscan_works.rst"
      ];
      hash = "sha256-t0D4OsHEcMwmBZM8Mk1N0uAKi6ra+TOzEks9/efsvWI=";
    })
  ];

  pythonRemoveDeps = [ "cython" ];
  nativeBuildInputs = [ pythonRelaxDepsHook cython ];
  propagatedBuildInputs = [ numpy scipy scikit-learn joblib six ];
  preCheck = ''
    cd hdbscan/tests
    rm __init__.py
  '';
  nativeCheckInputs = [ pytestCheckHook ];
  disabledTests = [
    # known flaky tests: https://github.com/scikit-learn-contrib/hdbscan/issues/420
    "test_mem_vec_diff_clusters"
    "test_all_points_mem_vec_diff_clusters"
    "test_approx_predict_diff_clusters"
    # another flaky test https://github.com/scikit-learn-contrib/hdbscan/issues/421
    "test_hdbscan_boruvka_balltree_matches"
    # more flaky tests https://github.com/scikit-learn-contrib/hdbscan/issues/570
    "test_hdbscan_boruvka_balltree"
    "test_hdbscan_best_balltree_metric"
  ];

  pythonImportsCheck = [ "hdbscan" ];

  meta = with lib; {
    description = "Hierarchical Density-Based Spatial Clustering of Applications with Noise, a clustering algorithm with a scikit-learn compatible API";
    homepage =  "https://github.com/scikit-learn-contrib/hdbscan";
    license = licenses.bsd3;
  };
}