1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8
9 # dependencies
10 click,
11 cloudpickle,
12 fsspec,
13 importlib-metadata,
14 packaging,
15 partd,
16 pyyaml,
17 toolz,
18
19 # optional-dependencies
20 numpy,
21 pyarrow,
22 lz4,
23 pandas,
24 distributed,
25 bokeh,
26 jinja2,
27
28 # tests
29 hypothesis,
30 pytest-asyncio,
31 pytest-cov-stub,
32 pytest-mock,
33 pytest-rerunfailures,
34 pytest-xdist,
35 pytestCheckHook,
36 versionCheckHook,
37}:
38
39buildPythonPackage rec {
40 pname = "dask";
41 version = "2025.3.0";
42 pyproject = true;
43
44 src = fetchFromGitHub {
45 owner = "dask";
46 repo = "dask";
47 tag = version;
48 hash = "sha256-j25+DfWReonXKqxkX9OVHjKo+Indh13rlBE5PyGe69c=";
49 };
50
51 postPatch = ''
52 # versioneer hack to set version of GitHub package
53 echo "def get_versions(): return {'dirty': False, 'error': None, 'full-revisionid': None, 'version': '${version}'}" > dask/_version.py
54
55 substituteInPlace setup.py \
56 --replace-fail "import versioneer" "" \
57 --replace-fail "version=versioneer.get_version()," "version='${version}'," \
58 --replace-fail "cmdclass=versioneer.get_cmdclass()," ""
59
60 substituteInPlace pyproject.toml \
61 --replace-fail ', "versioneer[toml]==0.29"' ""
62 '';
63
64 build-system = [ setuptools ];
65
66 dependencies = [
67 click
68 cloudpickle
69 fsspec
70 importlib-metadata
71 packaging
72 partd
73 pyyaml
74 toolz
75 ];
76
77 optional-dependencies = lib.fix (self: {
78 array = [ numpy ];
79 complete =
80 [
81 pyarrow
82 lz4
83 ]
84 ++ self.array
85 ++ self.dataframe
86 ++ self.distributed
87 ++ self.diagnostics;
88 dataframe = [
89 pandas
90 pyarrow
91 ] ++ self.array;
92 distributed = [ distributed ];
93 diagnostics = [
94 bokeh
95 jinja2
96 ];
97 });
98
99 nativeCheckInputs =
100 [
101 hypothesis
102 pyarrow
103 pytest-asyncio
104 pytest-cov-stub
105 pytest-mock
106 pytest-rerunfailures
107 pytest-xdist
108 pytestCheckHook
109 versionCheckHook
110 ]
111 ++ optional-dependencies.array
112 ++ optional-dependencies.dataframe;
113 versionCheckProgramArg = "--version";
114
115 pytestFlagsArray = [
116 # Rerun failed tests up to three times
117 "--reruns 3"
118 # Don't run tests that require network access
119 "-m 'not network'"
120 ];
121
122 disabledTests = [
123 # UserWarning: Insufficient elements for `head`. 10 elements requested, only 5 elements available. Try passing larger `npartitions` to `head`.
124 "test_set_index_head_nlargest_string"
125 ];
126
127 __darwinAllowLocalNetworking = true;
128
129 pythonImportsCheck = [
130 "dask"
131 "dask.bag"
132 "dask.bytes"
133 "dask.diagnostics"
134
135 # Requires the `dask.optional-dependencies.array` that are only in `nativeCheckInputs`
136 "dask.array"
137 # Requires the `dask.optional-dependencies.dataframe` that are only in `nativeCheckInputs`
138 "dask.dataframe"
139 "dask.dataframe.io"
140 "dask.dataframe.tseries"
141 ];
142
143 meta = {
144 description = "Minimal task scheduling abstraction";
145 mainProgram = "dask";
146 homepage = "https://dask.org/";
147 changelog = "https://docs.dask.org/en/latest/changelog.html";
148 license = lib.licenses.bsd3;
149 maintainers = with lib.maintainers; [ GaetanLepage ];
150 };
151}