1{
2 lib,
3 stdenv,
4 appdirs,
5 azure-containerregistry,
6 azure-core,
7 azure-identity,
8 azure-storage-blob,
9 bokeh,
10 boto3,
11 buildPythonPackage,
12 click,
13 docker-pycreds,
14 fetchFromGitHub,
15 flask,
16 git,
17 gitpython,
18 google-cloud-artifact-registry,
19 google-cloud-compute,
20 google-cloud-storage,
21 hypothesis,
22 imageio,
23 jsonref,
24 jsonschema,
25 keras,
26 kubernetes,
27 matplotlib,
28 mlflow,
29 moviepy,
30 nbclient,
31 nbformat,
32 pandas,
33 parameterized,
34 pathtools,
35 protobuf,
36 psutil,
37 pydantic,
38 pyfakefs,
39 pytest-mock,
40 pytest-xdist,
41 pytestCheckHook,
42 pythonOlder,
43 pythonRelaxDepsHook,
44 pyyaml,
45 requests,
46 responses,
47 scikit-learn,
48 sentry-sdk,
49 setproctitle,
50 setuptools,
51 soundfile,
52 substituteAll,
53 torch,
54 tqdm,
55}:
56
57buildPythonPackage rec {
58 pname = "wandb";
59 version = "0.16.0";
60 format = "pyproject";
61
62 disabled = pythonOlder "3.6";
63
64 src = fetchFromGitHub {
65 owner = pname;
66 repo = pname;
67 rev = "refs/tags/v${version}";
68 hash = "sha256-XXs9KjiAPzZ932r4UJ87RpM+qhg/bNDWEYsq2Ua6SRw=";
69 };
70
71 patches = [
72 # Replace git paths
73 (substituteAll {
74 src = ./hardcode-git-path.patch;
75 git = "${lib.getBin git}/bin/git";
76 })
77 ];
78
79 nativeBuildInputs = [
80 pythonRelaxDepsHook
81 setuptools
82 ];
83
84 # setuptools is necessary since pkg_resources is required at runtime.
85 propagatedBuildInputs = [
86 appdirs
87 click
88 docker-pycreds
89 gitpython
90 pathtools
91 protobuf
92 psutil
93 pyyaml
94 requests
95 sentry-sdk
96 setproctitle
97 setuptools
98 ];
99
100 __darwinAllowLocalNetworking = true;
101
102 nativeCheckInputs = [
103 azure-containerregistry
104 azure-core
105 azure-identity
106 azure-storage-blob
107 bokeh
108 boto3
109 flask
110 google-cloud-artifact-registry
111 google-cloud-compute
112 google-cloud-storage
113 hypothesis
114 imageio
115 jsonref
116 jsonschema
117 keras
118 kubernetes
119 matplotlib
120 mlflow
121 moviepy
122 nbclient
123 nbformat
124 pandas
125 parameterized
126 pydantic
127 pyfakefs
128 pytest-mock
129 pytest-xdist
130 pytestCheckHook
131 responses
132 scikit-learn
133 soundfile
134 torch
135 tqdm
136 ];
137
138 # Set BOKEH_CDN_VERSION to stop bokeh throwing an exception in tests
139 preCheck = ''
140 export HOME=$(mktemp -d)
141 export BOKEH_CDN_VERSION=${bokeh.version}
142 '';
143
144 pythonRelaxDeps = [ "protobuf" ];
145
146 pytestFlagsArray = [
147 # We want to run only unit tests
148 "tests/pytest_tests"
149 ];
150
151 disabledTestPaths =
152 [
153 # Tests that try to get chatty over sockets or spin up servers, not possible in the nix build environment.
154 "tests/pytest_tests/system_tests/test_notebooks/test_notebooks.py"
155 "tests/pytest_tests/unit_tests_old/test_cli.py"
156 "tests/pytest_tests/unit_tests_old/test_data_types.py"
157 "tests/pytest_tests/unit_tests_old/test_file_stream.py"
158 "tests/pytest_tests/unit_tests_old/test_file_upload.py"
159 "tests/pytest_tests/unit_tests_old/test_footer.py"
160 "tests/pytest_tests/unit_tests_old/test_internal_api.py"
161 "tests/pytest_tests/unit_tests_old/test_metric_internal.py"
162 "tests/pytest_tests/unit_tests_old/test_public_api.py"
163 "tests/pytest_tests/unit_tests_old/test_runtime.py"
164 "tests/pytest_tests/unit_tests_old/test_sender.py"
165 "tests/pytest_tests/unit_tests_old/test_summary.py"
166 "tests/pytest_tests/unit_tests_old/test_tb_watcher.py"
167 "tests/pytest_tests/unit_tests_old/test_time_resolution.py"
168 "tests/pytest_tests/unit_tests_old/test_wandb_agent.py"
169 "tests/pytest_tests/unit_tests_old/test_wandb_integration.py"
170 "tests/pytest_tests/unit_tests_old/test_wandb_run.py"
171 "tests/pytest_tests/unit_tests_old/test_wandb.py"
172 "tests/pytest_tests/unit_tests_old/tests_launch/test_launch_aws.py"
173 "tests/pytest_tests/unit_tests_old/tests_launch/test_launch_cli.py"
174 "tests/pytest_tests/unit_tests_old/tests_launch/test_launch_docker.py"
175 "tests/pytest_tests/unit_tests_old/tests_launch/test_launch.py"
176 "tests/pytest_tests/unit_tests/test_cli.py"
177 "tests/pytest_tests/unit_tests/test_data_types.py"
178 "tests/pytest_tests/unit_tests/test_internal_api.py"
179 "tests/pytest_tests/unit_tests/test_mode_disabled.py"
180 "tests/pytest_tests/unit_tests/test_model_workflows.py"
181 "tests/pytest_tests/unit_tests/test_plots.py"
182 "tests/pytest_tests/unit_tests/test_public_api.py"
183 "tests/pytest_tests/unit_tests/test_sender.py"
184 "tests/pytest_tests/unit_tests/test_util.py"
185 "tests/pytest_tests/unit_tests/test_wandb_verify.py"
186
187 # Requires docker access
188 "tests/pytest_tests/system_tests/test_artifacts/test_artifact_saver.py"
189 "tests/pytest_tests/system_tests/test_artifacts/test_misc.py"
190 "tests/pytest_tests/system_tests/test_artifacts/test_misc2.py"
191 "tests/pytest_tests/system_tests/test_artifacts/test_object_references.py"
192 "tests/pytest_tests/system_tests/test_artifacts/test_wandb_artifacts_full.py"
193 "tests/pytest_tests/system_tests/test_artifacts/test_wandb_artifacts.py"
194 "tests/pytest_tests/system_tests/test_core/test_cli_full.py"
195 "tests/pytest_tests/system_tests/test_core/test_data_types_full.py"
196 "tests/pytest_tests/system_tests/test_core/test_file_stream_internal.py"
197 "tests/pytest_tests/system_tests/test_core/test_file_upload.py"
198 "tests/pytest_tests/system_tests/test_core/test_footer.py"
199 "tests/pytest_tests/system_tests/test_core/test_keras_full.py"
200 "tests/pytest_tests/system_tests/test_core/test_label_full.py"
201 "tests/pytest_tests/system_tests/test_core/test_metric_full.py"
202 "tests/pytest_tests/system_tests/test_core/test_metric_internal.py"
203 "tests/pytest_tests/system_tests/test_core/test_mode_disabled_full.py"
204 "tests/pytest_tests/system_tests/test_core/test_model_workflow.py"
205 "tests/pytest_tests/system_tests/test_core/test_mp_full.py"
206 "tests/pytest_tests/system_tests/test_core/test_public_api.py"
207 "tests/pytest_tests/system_tests/test_core/test_redir_full.py"
208 "tests/pytest_tests/system_tests/test_core/test_report_api.py"
209 "tests/pytest_tests/system_tests/test_core/test_save_policies.py"
210 "tests/pytest_tests/system_tests/test_core/test_sender.py"
211 "tests/pytest_tests/system_tests/test_core/test_start_method.py"
212 "tests/pytest_tests/system_tests/test_core/test_system_info.py"
213 "tests/pytest_tests/system_tests/test_core/test_tb_watcher.py"
214 "tests/pytest_tests/system_tests/test_core/test_telemetry_full.py"
215 "tests/pytest_tests/system_tests/test_core/test_time_resolution.py"
216 "tests/pytest_tests/system_tests/test_core/test_torch_full.py"
217 "tests/pytest_tests/system_tests/test_core/test_validation_data_logger.py"
218 "tests/pytest_tests/system_tests/test_core/test_wandb_init.py"
219 "tests/pytest_tests/system_tests/test_core/test_wandb_integration.py"
220 "tests/pytest_tests/system_tests/test_core/test_wandb_run.py"
221 "tests/pytest_tests/system_tests/test_core/test_wandb_settings.py"
222 "tests/pytest_tests/system_tests/test_core/test_wandb_tensorflow.py"
223 "tests/pytest_tests/system_tests/test_core/test_wandb_verify.py"
224 "tests/pytest_tests/system_tests/test_core/test_wandb.py"
225 "tests/pytest_tests/system_tests/test_importers/test_import_mlflow.py"
226 "tests/pytest_tests/system_tests/test_launch/test_github_reference.py"
227 "tests/pytest_tests/system_tests/test_launch/test_job_status_tracker.py"
228 "tests/pytest_tests/system_tests/test_launch/test_job.py"
229 "tests/pytest_tests/system_tests/test_launch/test_launch_add.py"
230 "tests/pytest_tests/system_tests/test_launch/test_launch_cli.py"
231 "tests/pytest_tests/system_tests/test_launch/test_launch_kubernetes.py"
232 "tests/pytest_tests/system_tests/test_launch/test_launch_local_container.py"
233 "tests/pytest_tests/system_tests/test_launch/test_launch_run.py"
234 "tests/pytest_tests/system_tests/test_launch/test_launch_sagemaker.py"
235 "tests/pytest_tests/system_tests/test_launch/test_launch_sweep_cli.py"
236 "tests/pytest_tests/system_tests/test_launch/test_launch_sweep.py"
237 "tests/pytest_tests/system_tests/test_launch/test_launch_vertex.py"
238 "tests/pytest_tests/system_tests/test_launch/test_launch.py"
239 "tests/pytest_tests/system_tests/test_launch/test_wandb_reference.py"
240 "tests/pytest_tests/system_tests/test_nexus/test_nexus.py"
241 "tests/pytest_tests/system_tests/test_sweep/test_public_api.py"
242 "tests/pytest_tests/system_tests/test_sweep/test_sweep_scheduler.py"
243 "tests/pytest_tests/system_tests/test_sweep/test_sweep_utils.py"
244 "tests/pytest_tests/system_tests/test_sweep/test_wandb_agent_full.py"
245 "tests/pytest_tests/system_tests/test_sweep/test_wandb_agent.py"
246 "tests/pytest_tests/system_tests/test_sweep/test_wandb_sweep.py"
247 "tests/pytest_tests/system_tests/test_system_metrics/test_open_metrics.py"
248 "tests/pytest_tests/system_tests/test_system_metrics/test_system_monitor.py"
249
250 # Tries to access /homeless-shelter
251 "tests/pytest_tests/unit_tests/test_tables.py"
252
253 # E AssertionError: assert 'Cannot use both --async and --queue with wandb launch' in 'wandb: ERROR Find detailed error logs at: /build/source/wandb/debug-cli.nixbld.log\nError: The wandb service process exited with 1. Ensure that `sys.executable` is a valid python interpreter. You can override it with the `_executable` setting or with the `WANDB__EXECUTABLE` environment variable.\n'
254 # E + where 'wandb: ERROR Find detailed error logs at: /build/source/wandb/debug-cli.nixbld.log\nError: The wandb service process exited with 1. Ensure that `sys.executable` is a valid python interpreter. You can override it with the `_executable` setting or with the `WANDB__EXECUTABLE` environment variable.\n' = <Result SystemExit(1)>.output
255 "tests/pytest_tests/unit_tests_old/tests_launch/test_launch_jobs.py"
256
257 # Requires google-cloud-aiplatform which is not packaged as of 2023-04-25.
258 "tests/pytest_tests/unit_tests/test_launch/test_runner/test_vertex.py"
259
260 # Requires google-cloud-artifact-registry which is not packaged as of 2023-04-25.
261 "tests/pytest_tests/unit_tests/test_launch/test_registry/test_gcp_artifact_registry.py"
262
263 # Requires kfp which is not packaged as of 2023-04-25.
264 "tests/pytest_tests/system_tests/test_core/test_kfp.py"
265
266 # Requires kubernetes_asyncio which is not packaged as of 2024-01-14.
267 "tests/pytest_tests/unit_tests/test_launch/test_builder/test_kaniko.py"
268 "tests/pytest_tests/unit_tests/test_launch/test_runner/test_kubernetes.py"
269 "tests/pytest_tests/unit_tests/test_launch/test_runner/test_safe_watch.py"
270
271 # Requires metaflow which is not packaged as of 2023-04-25.
272 "tests/pytest_tests/unit_tests/test_metaflow.py"
273
274 # Requires tensorflow which is broken as of 2023-09-03
275 "tests/pytest_tests/unit_tests/test_keras.py"
276
277 # Try to get hardware information, not possible in the nix build environment
278 "tests/pytest_tests/unit_tests/test_system_metrics/test_disk.py"
279
280 # See https://github.com/wandb/wandb/issues/5423
281 "tests/pytest_tests/unit_tests/test_docker.py"
282 "tests/pytest_tests/unit_tests/test_library_public.py"
283
284 # See https://github.com/wandb/wandb/issues/6836
285 "tests/pytest_tests/unit_tests_old/test_logging.py"
286 ]
287 ++ lib.optionals stdenv.isLinux [
288 # Same as above
289 "tests/pytest_tests/unit_tests/test_artifacts/test_storage.py"
290 ]
291 ++ lib.optionals stdenv.isDarwin [
292 # Same as above
293 "tests/pytest_tests/unit_tests/test_lib/test_filesystem.py"
294 ];
295
296 disabledTests =
297 [
298 # Timing sensitive
299 "test_login_timeout"
300 ]
301 ++ lib.optionals stdenv.isDarwin [
302 # Disable test that fails on darwin due to issue with python3Packages.psutil:
303 # https://github.com/giampaolo/psutil/issues/1219
304 "test_tpu_system_stats"
305 ];
306
307 pythonImportsCheck = [ "wandb" ];
308
309 # unmaintainable list of disabled tests
310 passthru.skipBulkUpdate = true;
311
312 meta = with lib; {
313 description = "A CLI and library for interacting with the Weights and Biases API";
314 homepage = "https://github.com/wandb/wandb";
315 changelog = "https://github.com/wandb/wandb/raw/v${version}/CHANGELOG.md";
316 license = licenses.mit;
317 maintainers = with maintainers; [ samuela ];
318 };
319}