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.7.0";
42 pyproject = true;
43
44 src = fetchFromGitHub {
45 owner = "dask";
46 repo = "dask";
47 tag = version;
48 hash = "sha256-bwM4Q95YTEp9pDz6LmBLOeYjmi8nH8Cc/srZlXfEIlg=";
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 pyarrow
81 lz4
82 ]
83 ++ self.array
84 ++ self.dataframe
85 ++ self.distributed
86 ++ self.diagnostics;
87 dataframe = [
88 pandas
89 pyarrow
90 ]
91 ++ self.array;
92 distributed = [ distributed ];
93 diagnostics = [
94 bokeh
95 jinja2
96 ];
97 });
98
99 nativeCheckInputs = [
100 hypothesis
101 pyarrow
102 pytest-asyncio
103 pytest-cov-stub
104 pytest-mock
105 pytest-rerunfailures
106 pytest-xdist
107 pytestCheckHook
108 versionCheckHook
109 ]
110 ++ optional-dependencies.array
111 ++ optional-dependencies.dataframe;
112 versionCheckProgramArg = "--version";
113
114 pytestFlags = [
115 # Rerun failed tests up to three times
116 "--reruns=3"
117 ];
118
119 disabledTestMarks = [
120 # Don't run tests that require network access
121 "network"
122 ];
123
124 disabledTests = [
125 # UserWarning: Insufficient elements for `head`. 10 elements requested, only 5 elements available. Try passing larger `npartitions` to `head`.
126 "test_set_index_head_nlargest_string"
127 ];
128
129 __darwinAllowLocalNetworking = true;
130
131 pythonImportsCheck = [
132 "dask"
133 "dask.bag"
134 "dask.bytes"
135 "dask.diagnostics"
136
137 # Requires the `dask.optional-dependencies.array` that are only in `nativeCheckInputs`
138 "dask.array"
139 # Requires the `dask.optional-dependencies.dataframe` that are only in `nativeCheckInputs`
140 "dask.dataframe"
141 "dask.dataframe.io"
142 "dask.dataframe.tseries"
143 ];
144
145 meta = {
146 description = "Minimal task scheduling abstraction";
147 mainProgram = "dask";
148 homepage = "https://dask.org/";
149 changelog = "https://docs.dask.org/en/latest/changelog.html";
150 license = lib.licenses.bsd3;
151 maintainers = with lib.maintainers; [ GaetanLepage ];
152 };
153}