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 ] ++ dask.optional-dependencies.array;
52
53 nativeCheckInputs = [
54 pytest-xdist
55 pytestCheckHook
56 ];
57
58 pythonImportsCheck = [ "dask_glm" ];
59
60 disabledTests = [
61 # ValueError: <class 'bool'> can be computed for one-element arrays only.
62 "test_dot_with_sparse"
63
64 # ValueError: `shape` was not provided.
65 "test_sparse"
66 ];
67
68 # On darwin, tests saturate the entire system, even when constrained to run single-threaded
69 # Removing pytest-xdist AND setting --cores to one does not prevent the load from exploding
70 doCheck = !stdenv.hostPlatform.isDarwin;
71
72 meta = {
73 description = "Generalized Linear Models with Dask";
74 homepage = "https://github.com/dask/dask-glm/";
75 changelog = "https://github.com/dask/dask-glm/releases/tag/${version}";
76 license = lib.licenses.bsd3;
77 maintainers = with lib.maintainers; [ GaetanLepage ];
78 };
79}