1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 setuptools-scm,
9
10 # dependencies
11 cloudpickle,
12 distributed,
13 multipledispatch,
14 scikit-learn,
15 scipy,
16 sparse,
17 dask,
18
19 # tests
20 pytest-xdist,
21 pytestCheckHook,
22}:
23
24buildPythonPackage rec {
25 pname = "dask-glm";
26 version = "0.3.2";
27 pyproject = true;
28
29 src = fetchFromGitHub {
30 owner = "dask";
31 repo = "dask-glm";
32 tag = version;
33 hash = "sha256-q98QMmw1toashimS16of54cgZgIPqkua3xGD1FZ1nTc=";
34 };
35
36 # ValueError: The truth value of an empty array is ambiguous. Use `array.size > 0` to check that an array is not empty.
37 postPatch = ''
38 substituteInPlace dask_glm/utils.py \
39 --replace-fail "if arr:" "if (arr is not None) and (arr.size > 0):"
40 '';
41
42 build-system = [ setuptools-scm ];
43
44 dependencies = [
45 cloudpickle
46 distributed
47 multipledispatch
48 scikit-learn
49 scipy
50 sparse
51 ]
52 ++ dask.optional-dependencies.array;
53
54 nativeCheckInputs = [
55 pytest-xdist
56 pytestCheckHook
57 ];
58
59 pythonImportsCheck = [ "dask_glm" ];
60
61 disabledTests = [
62 # ValueError: <class 'bool'> can be computed for one-element arrays only.
63 "test_dot_with_sparse"
64
65 # ValueError: `shape` was not provided.
66 "test_sparse"
67 ];
68
69 # On darwin, tests saturate the entire system, even when constrained to run single-threaded
70 # Removing pytest-xdist AND setting --cores to one does not prevent the load from exploding
71 doCheck = !stdenv.hostPlatform.isDarwin;
72
73 meta = {
74 description = "Generalized Linear Models with Dask";
75 homepage = "https://github.com/dask/dask-glm/";
76 changelog = "https://github.com/dask/dask-glm/releases/tag/${version}";
77 license = lib.licenses.bsd3;
78 maintainers = with lib.maintainers; [ GaetanLepage ];
79 };
80}