1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6
7 cython,
8 numpy,
9 scipy,
10 scikit-learn,
11 joblib,
12 six,
13
14 # test
15 pytestCheckHook,
16}:
17
18buildPythonPackage rec {
19 pname = "hdbscan";
20 version = "0.8.40";
21 format = "setuptools";
22
23 src = fetchFromGitHub {
24 owner = "scikit-learn-contrib";
25 repo = "hdbscan";
26 tag = "release-${version}";
27 hash = "sha256-xsBlmSQU47e+M+nRqUXdWKS7Rtj2QZ1UWLAvjSQOJ0Q=";
28 };
29
30 patches = [
31 (fetchpatch {
32 # Replace obsolete use of assert_raises with pytest.raises
33 name = "replace-assert_raises";
34 url = "https://github.com/scikit-learn-contrib/hdbscan/pull/667/commits/04d6a4dcdcd2bb2597419b8aa981d7620765809f.patch";
35 hash = "sha256-z/u5b2rNPKOCe+3/GVE8rMB5ajeU5PrvLVesjEgj9TA=";
36 })
37 ];
38
39 pythonRemoveDeps = [ "cython" ];
40
41 nativeBuildInputs = [
42 cython
43 joblib
44 numpy
45 scikit-learn
46 scipy
47 six
48 ];
49
50 preCheck = ''
51 cd hdbscan/tests
52 rm __init__.py
53 '';
54
55 nativeCheckInputs = [ pytestCheckHook ];
56
57 disabledTests = [
58 # known flaky tests: https://github.com/scikit-learn-contrib/hdbscan/issues/420
59 "test_mem_vec_diff_clusters"
60 "test_all_points_mem_vec_diff_clusters"
61 "test_approx_predict_diff_clusters"
62 # another flaky test https://github.com/scikit-learn-contrib/hdbscan/issues/421
63 "test_hdbscan_boruvka_balltree_matches"
64 # more flaky tests https://github.com/scikit-learn-contrib/hdbscan/issues/570
65 "test_hdbscan_boruvka_balltree"
66 "test_hdbscan_best_balltree_metric"
67 # "got an unexpected keyword argument"
68 "test_hdbscan_badargs"
69 ];
70
71 disabledTestPaths = [
72 # joblib.externals.loky.process_executor.BrokenProcessPool:
73 "test_branches.py"
74 ];
75
76 pythonImportsCheck = [ "hdbscan" ];
77
78 meta = {
79 description = "Hierarchical Density-Based Spatial Clustering of Applications with Noise, a clustering algorithm with a scikit-learn compatible API";
80 homepage = "https://github.com/scikit-learn-contrib/hdbscan";
81 changelog = "https://github.com/scikit-learn-contrib/hdbscan/releases/tag/release-${version}";
82 license = lib.licenses.bsd3;
83 maintainers = [ ];
84 };
85}