1{ lib
2, buildPythonPackage
3, fetchpatch
4, cython
5, numpy
6, pytestCheckHook
7, scipy
8, scikit-learn
9, fetchPypi
10, joblib
11, six
12, pythonRelaxDepsHook
13}:
14
15buildPythonPackage rec {
16 pname = "hdbscan";
17 version = "0.8.28";
18
19 src = fetchPypi {
20 inherit pname version;
21 sha256 = "sha256-7tr3Hy87vt/Ew42hrUiXRUzl69R5LhponJecKFPtwFo=";
22 };
23 patches = [
24 # should be included in next release
25 (fetchpatch {
26 name = "joblib-1.2.0-compat.patch";
27 url = "https://github.com/scikit-learn-contrib/hdbscan/commit/d829c639923f6866e1917e46ddbde45b513913f3.patch";
28 excludes = [
29 "docs/basic_hdbscan.rst"
30 "docs/how_hdbscan_works.rst"
31 ];
32 sha256 = "sha256-t0D4OsHEcMwmBZM8Mk1N0uAKi6ra+TOzEks9/efsvWI=";
33 })
34 ];
35
36 pythonRemoveDeps = [ "cython" ];
37 nativeBuildInputs = [ pythonRelaxDepsHook cython ];
38 propagatedBuildInputs = [ numpy scipy scikit-learn joblib six ];
39 preCheck = ''
40 cd hdbscan/tests
41 rm __init__.py
42 '';
43 checkInputs = [ pytestCheckHook ];
44 disabledTests = [
45 # known flaky tests: https://github.com/scikit-learn-contrib/hdbscan/issues/420
46 "test_mem_vec_diff_clusters"
47 "test_all_points_mem_vec_diff_clusters"
48 "test_approx_predict_diff_clusters"
49 # another flaky test https://github.com/scikit-learn-contrib/hdbscan/issues/421
50 "test_hdbscan_boruvka_balltree_matches"
51 # more flaky tests https://github.com/scikit-learn-contrib/hdbscan/issues/570
52 "test_hdbscan_boruvka_balltree"
53 "test_hdbscan_best_balltree_metric"
54 ];
55
56 pythonImportsCheck = [ "hdbscan" ];
57
58 meta = with lib; {
59 description = "Hierarchical Density-Based Spatial Clustering of Applications with Noise, a clustering algorithm with a scikit-learn compatible API";
60 homepage = "https://github.com/scikit-learn-contrib/hdbscan";
61 license = licenses.bsd3;
62 maintainers = with maintainers; [ ixxie ];
63 };
64}