about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/wandb/default.nix
blob: b2f22092638b99849e4a0722b6393ccbe9891529 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
{ lib
, stdenv
, appdirs
, azure-containerregistry
, azure-core
, azure-identity
, azure-storage-blob
, bokeh
, boto3
, buildPythonPackage
, click
, docker-pycreds
, fetchFromGitHub
, flask
, git
, gitpython
, google-cloud-artifact-registry
, google-cloud-compute
, google-cloud-storage
, hypothesis
, imageio
, jsonref
, jsonschema
, keras
, kubernetes
, matplotlib
, mlflow
, moviepy
, nbclient
, nbformat
, pandas
, parameterized
, pathtools
, protobuf
, psutil
, pydantic
, pyfakefs
, pytest-mock
, pytest-xdist
, pytestCheckHook
, pythonOlder
, pythonRelaxDepsHook
, pyyaml
, requests
, responses
, scikit-learn
, sentry-sdk
, setproctitle
, setuptools
, soundfile
, substituteAll
, torch
, tqdm
}:

buildPythonPackage rec {
  pname = "wandb";
  version = "0.16.4";
  format = "pyproject";

  disabled = pythonOlder "3.6";

  src = fetchFromGitHub {
    owner = pname;
    repo = pname;
    rev = "refs/tags/v${version}";
    hash = "sha256-Q4NHUHay1/xb+V494n96jxE1VyAP7uVyQbIbS0/E85c=";
  };

  patches = [
    # Replace git paths
    (substituteAll {
      src = ./hardcode-git-path.patch;
      git = "${lib.getBin git}/bin/git";
    })
  ];

  nativeBuildInputs = [
    pythonRelaxDepsHook
    setuptools
  ];

  # setuptools is necessary since pkg_resources is required at runtime.
  propagatedBuildInputs = [
    appdirs
    click
    docker-pycreds
    gitpython
    pathtools
    protobuf
    psutil
    pyyaml
    requests
    sentry-sdk
    setproctitle
    setuptools
  ];

  __darwinAllowLocalNetworking = true;

  nativeCheckInputs = [
    azure-containerregistry
    azure-core
    azure-identity
    azure-storage-blob
    bokeh
    boto3
    flask
    google-cloud-artifact-registry
    google-cloud-compute
    google-cloud-storage
    hypothesis
    imageio
    jsonref
    jsonschema
    keras
    kubernetes
    matplotlib
    mlflow
    moviepy
    nbclient
    nbformat
    pandas
    parameterized
    pydantic
    pyfakefs
    pytest-mock
    pytest-xdist
    pytestCheckHook
    responses
    scikit-learn
    soundfile
    torch
    tqdm
  ];

  # Set BOKEH_CDN_VERSION to stop bokeh throwing an exception in tests
  preCheck = ''
    export HOME=$(mktemp -d)
    export BOKEH_CDN_VERSION=${bokeh.version}
  '';

  pythonRelaxDeps = [ "protobuf" ];

  pytestFlagsArray = [
    # We want to run only unit tests
    "tests/pytest_tests"
  ];

  disabledTestPaths = [
    # Tests that try to get chatty over sockets or spin up servers, not possible in the nix build environment.
    "tests/pytest_tests/system_tests/test_notebooks/test_notebooks.py"
    "tests/pytest_tests/unit_tests_old/test_cli.py"
    "tests/pytest_tests/unit_tests_old/test_data_types.py"
    "tests/pytest_tests/unit_tests_old/test_file_stream.py"
    "tests/pytest_tests/unit_tests_old/test_file_upload.py"
    "tests/pytest_tests/unit_tests_old/test_footer.py"
    "tests/pytest_tests/unit_tests_old/test_internal_api.py"
    "tests/pytest_tests/unit_tests_old/test_metric_internal.py"
    "tests/pytest_tests/unit_tests_old/test_public_api.py"
    "tests/pytest_tests/unit_tests_old/test_runtime.py"
    "tests/pytest_tests/unit_tests_old/test_sender.py"
    "tests/pytest_tests/unit_tests_old/test_summary.py"
    "tests/pytest_tests/unit_tests_old/test_tb_watcher.py"
    "tests/pytest_tests/unit_tests_old/test_time_resolution.py"
    "tests/pytest_tests/unit_tests_old/test_wandb_agent.py"
    "tests/pytest_tests/unit_tests_old/test_wandb_integration.py"
    "tests/pytest_tests/unit_tests_old/test_wandb_run.py"
    "tests/pytest_tests/unit_tests_old/test_wandb.py"
    "tests/pytest_tests/unit_tests_old/tests_launch/test_launch_aws.py"
    "tests/pytest_tests/unit_tests_old/tests_launch/test_launch_cli.py"
    "tests/pytest_tests/unit_tests_old/tests_launch/test_launch_docker.py"
    "tests/pytest_tests/unit_tests_old/tests_launch/test_launch.py"
    "tests/pytest_tests/unit_tests/test_cli.py"
    "tests/pytest_tests/unit_tests/test_data_types.py"
    "tests/pytest_tests/unit_tests/test_internal_api.py"
    "tests/pytest_tests/unit_tests/test_mode_disabled.py"
    "tests/pytest_tests/unit_tests/test_model_workflows.py"
    "tests/pytest_tests/unit_tests/test_plots.py"
    "tests/pytest_tests/unit_tests/test_public_api.py"
    "tests/pytest_tests/unit_tests/test_sender.py"
    "tests/pytest_tests/unit_tests/test_util.py"
    "tests/pytest_tests/unit_tests/test_wandb_verify.py"

    # Requires docker access
    "tests/pytest_tests/system_tests/test_artifacts/test_artifact_saver.py"
    "tests/pytest_tests/system_tests/test_artifacts/test_misc.py"
    "tests/pytest_tests/system_tests/test_artifacts/test_misc2.py"
    "tests/pytest_tests/system_tests/test_artifacts/test_object_references.py"
    "tests/pytest_tests/system_tests/test_artifacts/test_wandb_artifacts_full.py"
    "tests/pytest_tests/system_tests/test_artifacts/test_wandb_artifacts.py"
    "tests/pytest_tests/system_tests/test_core/test_cli_full.py"
    "tests/pytest_tests/system_tests/test_core/test_data_types_full.py"
    "tests/pytest_tests/system_tests/test_core/test_file_stream_internal.py"
    "tests/pytest_tests/system_tests/test_core/test_file_upload.py"
    "tests/pytest_tests/system_tests/test_core/test_footer.py"
    "tests/pytest_tests/system_tests/test_core/test_keras_full.py"
    "tests/pytest_tests/system_tests/test_core/test_label_full.py"
    "tests/pytest_tests/system_tests/test_core/test_metric_full.py"
    "tests/pytest_tests/system_tests/test_core/test_metric_internal.py"
    "tests/pytest_tests/system_tests/test_core/test_mode_disabled_full.py"
    "tests/pytest_tests/system_tests/test_core/test_model_workflow.py"
    "tests/pytest_tests/system_tests/test_core/test_mp_full.py"
    "tests/pytest_tests/system_tests/test_core/test_public_api.py"
    "tests/pytest_tests/system_tests/test_core/test_redir_full.py"
    "tests/pytest_tests/system_tests/test_core/test_report_api.py"
    "tests/pytest_tests/system_tests/test_core/test_save_policies.py"
    "tests/pytest_tests/system_tests/test_core/test_sender.py"
    "tests/pytest_tests/system_tests/test_core/test_start_method.py"
    "tests/pytest_tests/system_tests/test_core/test_system_info.py"
    "tests/pytest_tests/system_tests/test_core/test_tb_watcher.py"
    "tests/pytest_tests/system_tests/test_core/test_telemetry_full.py"
    "tests/pytest_tests/system_tests/test_core/test_time_resolution.py"
    "tests/pytest_tests/system_tests/test_core/test_torch_full.py"
    "tests/pytest_tests/system_tests/test_core/test_validation_data_logger.py"
    "tests/pytest_tests/system_tests/test_core/test_wandb_init.py"
    "tests/pytest_tests/system_tests/test_core/test_wandb_integration.py"
    "tests/pytest_tests/system_tests/test_core/test_wandb_run.py"
    "tests/pytest_tests/system_tests/test_core/test_wandb_settings.py"
    "tests/pytest_tests/system_tests/test_core/test_wandb_tensorflow.py"
    "tests/pytest_tests/system_tests/test_core/test_wandb_verify.py"
    "tests/pytest_tests/system_tests/test_core/test_wandb.py"
    "tests/pytest_tests/system_tests/test_importers/test_import_mlflow.py"
    "tests/pytest_tests/system_tests/test_launch/test_github_reference.py"
    "tests/pytest_tests/system_tests/test_launch/test_job_status_tracker.py"
    "tests/pytest_tests/system_tests/test_launch/test_job.py"
    "tests/pytest_tests/system_tests/test_launch/test_launch_add.py"
    "tests/pytest_tests/system_tests/test_launch/test_launch_cli.py"
    "tests/pytest_tests/system_tests/test_launch/test_launch_kubernetes.py"
    "tests/pytest_tests/system_tests/test_launch/test_launch_local_container.py"
    "tests/pytest_tests/system_tests/test_launch/test_launch_run.py"
    "tests/pytest_tests/system_tests/test_launch/test_launch_sagemaker.py"
    "tests/pytest_tests/system_tests/test_launch/test_launch_sweep_cli.py"
    "tests/pytest_tests/system_tests/test_launch/test_launch_sweep.py"
    "tests/pytest_tests/system_tests/test_launch/test_launch_vertex.py"
    "tests/pytest_tests/system_tests/test_launch/test_launch.py"
    "tests/pytest_tests/system_tests/test_launch/test_wandb_reference.py"
    "tests/pytest_tests/system_tests/test_nexus/test_nexus.py"
    "tests/pytest_tests/system_tests/test_sweep/test_public_api.py"
    "tests/pytest_tests/system_tests/test_sweep/test_sweep_scheduler.py"
    "tests/pytest_tests/system_tests/test_sweep/test_sweep_utils.py"
    "tests/pytest_tests/system_tests/test_sweep/test_wandb_agent_full.py"
    "tests/pytest_tests/system_tests/test_sweep/test_wandb_agent.py"
    "tests/pytest_tests/system_tests/test_sweep/test_wandb_sweep.py"
    "tests/pytest_tests/system_tests/test_system_metrics/test_open_metrics.py"
    "tests/pytest_tests/system_tests/test_system_metrics/test_system_monitor.py"

    # Tries to access /homeless-shelter
    "tests/pytest_tests/unit_tests/test_tables.py"

    # 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'
    # 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
    "tests/pytest_tests/unit_tests_old/tests_launch/test_launch_jobs.py"

    # Requires google-cloud-aiplatform which is not packaged as of 2023-04-25.
    "tests/pytest_tests/unit_tests/test_launch/test_runner/test_vertex.py"

    # Requires google-cloud-artifact-registry which is not packaged as of 2023-04-25.
    "tests/pytest_tests/unit_tests/test_launch/test_registry/test_gcp_artifact_registry.py"

    # Requires kfp which is not packaged as of 2023-04-25.
    "tests/pytest_tests/system_tests/test_core/test_kfp.py"

    # Requires kubernetes_asyncio which is not packaged as of 2024-01-14.
    "tests/pytest_tests/unit_tests/test_launch/test_builder/test_kaniko.py"
    "tests/pytest_tests/unit_tests/test_launch/test_runner/test_kubernetes.py"
    "tests/pytest_tests/unit_tests/test_launch/test_runner/test_safe_watch.py"

    # Requires metaflow which is not packaged as of 2023-04-25.
    "tests/pytest_tests/unit_tests/test_metaflow.py"

    # Requires tensorflow which is broken as of 2023-09-03
    "tests/pytest_tests/unit_tests/test_keras.py"

    # Try to get hardware information, not possible in the nix build environment
    "tests/pytest_tests/unit_tests/test_system_metrics/test_disk.py"

    # See https://github.com/wandb/wandb/issues/5423
    "tests/pytest_tests/unit_tests/test_docker.py"
    "tests/pytest_tests/unit_tests/test_library_public.py"

    # See https://github.com/wandb/wandb/issues/6836
    "tests/pytest_tests/unit_tests_old/test_logging.py"
  ] ++ lib.optionals stdenv.isLinux [
    # Same as above
    "tests/pytest_tests/unit_tests/test_artifacts/test_storage.py"
  ] ++ lib.optionals stdenv.isDarwin [
    # Same as above
    "tests/pytest_tests/unit_tests/test_lib/test_filesystem.py"
  ];

  disabledTests = [
    # Timing sensitive
    "test_login_timeout"
  ] ++ lib.optionals stdenv.isDarwin [
    # Disable test that fails on darwin due to issue with python3Packages.psutil:
    # https://github.com/giampaolo/psutil/issues/1219
    "test_tpu_system_stats"
  ];

  pythonImportsCheck = [
    "wandb"
  ];

  meta = with lib; {
    description = "A CLI and library for interacting with the Weights and Biases API";
    homepage = "https://github.com/wandb/wandb";
    changelog = "https://github.com/wandb/wandb/raw/v${version}/CHANGELOG.md";
    license = licenses.mit;
    maintainers = with maintainers; [ samuela ];
  };
}