1{ lib
2, buildPythonPackage
3, fetchpatch
4, cython
5, numpy
6, pytestCheckHook
7, scipy
8, scikit-learn
9, fetchPypi
10, joblib
11, six
12}:
13
14buildPythonPackage rec {
15 pname = "hdbscan";
16 version = "0.8.27";
17
18 src = fetchPypi {
19 inherit pname version;
20 sha256 = "e3a418d0d36874f7b6a1bf0b7461f3857fc13a525fd48ba34caed2fe8973aa26";
21 };
22 patches = [
23 # This patch fixes compatibility with numpy 1.20. It will be in the next release
24 # after 0.8.27
25 (fetchpatch {
26 url = "https://github.com/scikit-learn-contrib/hdbscan/commit/5b67a4fba39c5aebe8187a6a418da677f89a63e0.patch";
27 sha256 = "07d7jdwk0b8kgaqkifd529sarji01j1jiih7cfccc5kxmlb5py9h";
28 })
29 ];
30
31 nativeBuildInputs = [ cython ];
32 propagatedBuildInputs = [ numpy scipy scikit-learn joblib six ];
33 preCheck = ''
34 cd hdbscan/tests
35 rm __init__.py
36 '';
37 checkInputs = [ pytestCheckHook ];
38 disabledTests = [
39 # known flaky tests: https://github.com/scikit-learn-contrib/hdbscan/issues/420
40 "test_mem_vec_diff_clusters"
41 "test_all_points_mem_vec_diff_clusters"
42 "test_approx_predict_diff_clusters"
43 # another flaky test https://github.com/scikit-learn-contrib/hdbscan/issues/421
44 "test_hdbscan_boruvka_balltree_matches"
45 ];
46
47 pythonImportsCheck = [ "hdbscan" ];
48
49 meta = with lib; {
50 description = "Hierarchical Density-Based Spatial Clustering of Applications with Noise, a clustering algorithm with a scikit-learn compatible API";
51 homepage = "https://github.com/scikit-learn-contrib/hdbscan";
52 license = licenses.bsd3;
53 maintainers = with maintainers; [ ixxie ];
54 };
55}