wandb 0.18.3__py3-none-win32.whl → 0.18.5__py3-none-win32.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. wandb/__init__.py +16 -7
  2. wandb/__init__.pyi +96 -63
  3. wandb/analytics/sentry.py +91 -88
  4. wandb/apis/public/api.py +18 -4
  5. wandb/apis/public/runs.py +53 -2
  6. wandb/bin/gpu_stats.exe +0 -0
  7. wandb/bin/wandb-core +0 -0
  8. wandb/cli/beta.py +178 -0
  9. wandb/cli/cli.py +5 -171
  10. wandb/data_types.py +3 -0
  11. wandb/env.py +74 -73
  12. wandb/errors/term.py +300 -43
  13. wandb/proto/v3/wandb_internal_pb2.py +263 -223
  14. wandb/proto/v3/wandb_server_pb2.py +57 -37
  15. wandb/proto/v3/wandb_settings_pb2.py +2 -2
  16. wandb/proto/v4/wandb_internal_pb2.py +226 -218
  17. wandb/proto/v4/wandb_server_pb2.py +41 -37
  18. wandb/proto/v4/wandb_settings_pb2.py +2 -2
  19. wandb/proto/v5/wandb_internal_pb2.py +226 -218
  20. wandb/proto/v5/wandb_server_pb2.py +41 -37
  21. wandb/proto/v5/wandb_settings_pb2.py +2 -2
  22. wandb/sdk/__init__.py +3 -3
  23. wandb/sdk/artifacts/_validators.py +41 -8
  24. wandb/sdk/artifacts/artifact.py +32 -1
  25. wandb/sdk/artifacts/artifact_file_cache.py +1 -2
  26. wandb/sdk/data_types/_dtypes.py +7 -3
  27. wandb/sdk/data_types/video.py +15 -6
  28. wandb/sdk/interface/interface.py +2 -0
  29. wandb/sdk/internal/internal_api.py +126 -5
  30. wandb/sdk/internal/sender.py +16 -3
  31. wandb/sdk/launch/inputs/internal.py +1 -1
  32. wandb/sdk/lib/module.py +12 -0
  33. wandb/sdk/lib/printer.py +291 -105
  34. wandb/sdk/lib/progress.py +274 -0
  35. wandb/sdk/service/streams.py +21 -11
  36. wandb/sdk/wandb_init.py +58 -54
  37. wandb/sdk/wandb_run.py +380 -454
  38. wandb/sdk/wandb_settings.py +2 -0
  39. wandb/sdk/wandb_watch.py +17 -11
  40. wandb/util.py +6 -2
  41. {wandb-0.18.3.dist-info → wandb-0.18.5.dist-info}/METADATA +4 -3
  42. {wandb-0.18.3.dist-info → wandb-0.18.5.dist-info}/RECORD +45 -43
  43. wandb/bin/nvidia_gpu_stats.exe +0 -0
  44. {wandb-0.18.3.dist-info → wandb-0.18.5.dist-info}/WHEEL +0 -0
  45. {wandb-0.18.3.dist-info → wandb-0.18.5.dist-info}/entry_points.txt +0 -0
  46. {wandb-0.18.3.dist-info → wandb-0.18.5.dist-info}/licenses/LICENSE +0 -0
wandb/env.py CHANGED
@@ -1,24 +1,21 @@
1
- #!/usr/bin/env python
2
-
3
1
  """All of W&B's environment variables.
4
2
 
5
- Getters and putters for all of them should go here. That
6
- way it'll be easier to avoid typos with names and be
7
- consistent about environment variables' semantics.
3
+ Getters and putters for all of them should go here. That way it'll be easier to
4
+ avoid typos with names and be consistent about environment variables' semantics.
8
5
 
9
- Environment variables are not the authoritative source for
10
- these values in many cases.
6
+ Environment variables are not the authoritative source for these values in many
7
+ cases.
11
8
  """
12
9
 
10
+ from __future__ import annotations
11
+
13
12
  import json
14
13
  import os
15
14
  import sys
16
15
  from pathlib import Path
17
- from typing import List, MutableMapping, Optional, Union
18
-
19
- import platformdirs # type: ignore
16
+ from typing import MutableMapping
20
17
 
21
- Env = Optional[MutableMapping]
18
+ import platformdirs
22
19
 
23
20
  CONFIG_PATHS = "WANDB_CONFIG_PATHS"
24
21
  SWEEP_PARAM_PATH = "WANDB_SWEEP_PARAM_PATH"
@@ -95,7 +92,7 @@ _REQUIRE_LEGACY_SERVICE = "WANDB__REQUIRE_LEGACY_SERVICE"
95
92
  USE_V1_ARTIFACTS = "_WANDB_USE_V1_ARTIFACTS"
96
93
 
97
94
 
98
- def immutable_keys() -> List[str]:
95
+ def immutable_keys() -> list[str]:
99
96
  """These are env keys that shouldn't change within a single process.
100
97
 
101
98
  We use this to maintain certain values between multiple calls to wandb.init within a single process.
@@ -139,7 +136,7 @@ def immutable_keys() -> List[str]:
139
136
 
140
137
 
141
138
  def _env_as_bool(
142
- var: str, default: Optional[str] = None, env: Optional[Env] = None
139
+ var: str, default: str | None = None, env: MutableMapping | None = None
143
140
  ) -> bool:
144
141
  if env is None:
145
142
  env = os.environ
@@ -152,16 +149,16 @@ def _env_as_bool(
152
149
  return False
153
150
 
154
151
 
155
- def is_require_legacy_service(env: Optional[Env] = None) -> bool:
152
+ def is_require_legacy_service(env: MutableMapping | None = None) -> bool:
156
153
  """Return whether wandb.require("legacy-service") was used."""
157
154
  return _env_as_bool(_REQUIRE_LEGACY_SERVICE, default="False", env=env)
158
155
 
159
156
 
160
- def is_debug(default: Optional[str] = None, env: Optional[Env] = None) -> bool:
157
+ def is_debug(default: str | None = None, env: MutableMapping | None = None) -> bool:
161
158
  return _env_as_bool(DEBUG, default=default, env=env)
162
159
 
163
160
 
164
- def is_offline(env: Optional[Env] = None) -> bool:
161
+ def is_offline(env: MutableMapping | None = None) -> bool:
165
162
  if env is None:
166
163
  env = os.environ
167
164
  return env.get(MODE) == "offline"
@@ -171,7 +168,7 @@ def error_reporting_enabled() -> bool:
171
168
  return _env_as_bool(ERROR_REPORTING, default="True")
172
169
 
173
170
 
174
- def core_debug(default: Optional[str] = None) -> bool:
171
+ def core_debug(default: str | None = None) -> bool:
175
172
  return _env_as_bool(CORE_DEBUG, default=default)
176
173
 
177
174
 
@@ -180,16 +177,18 @@ def ssl_disabled() -> bool:
180
177
 
181
178
 
182
179
  def get_error_reporting(
183
- default: Union[bool, str] = True,
184
- env: Optional[Env] = None,
185
- ) -> Union[bool, str]:
180
+ default: bool | str = True,
181
+ env: MutableMapping | None = None,
182
+ ) -> bool | str:
186
183
  if env is None:
187
184
  env = os.environ
188
185
 
189
186
  return env.get(ERROR_REPORTING, default)
190
187
 
191
188
 
192
- def get_run(default: Optional[str] = None, env: Optional[Env] = None) -> Optional[str]:
189
+ def get_run(
190
+ default: str | None = None, env: MutableMapping | None = None
191
+ ) -> str | None:
193
192
  if env is None:
194
193
  env = os.environ
195
194
 
@@ -197,8 +196,8 @@ def get_run(default: Optional[str] = None, env: Optional[Env] = None) -> Optiona
197
196
 
198
197
 
199
198
  def get_args(
200
- default: Optional[List[str]] = None, env: Optional[Env] = None
201
- ) -> Optional[List[str]]:
199
+ default: list[str] | None = None, env: MutableMapping | None = None
200
+ ) -> list[str] | None:
202
201
  if env is None:
203
202
  env = os.environ
204
203
  if env.get(ARGS):
@@ -211,15 +210,15 @@ def get_args(
211
210
 
212
211
 
213
212
  def get_docker(
214
- default: Optional[str] = None, env: Optional[Env] = None
215
- ) -> Optional[str]:
213
+ default: str | None = None, env: MutableMapping | None = None
214
+ ) -> str | None:
216
215
  if env is None:
217
216
  env = os.environ
218
217
 
219
218
  return env.get(DOCKER, default)
220
219
 
221
220
 
222
- def get_http_timeout(default: int = 20, env: Optional[Env] = None) -> int:
221
+ def get_http_timeout(default: int = 20, env: MutableMapping | None = None) -> int:
223
222
  if env is None:
224
223
  env = os.environ
225
224
 
@@ -227,9 +226,9 @@ def get_http_timeout(default: int = 20, env: Optional[Env] = None) -> int:
227
226
 
228
227
 
229
228
  def get_file_pusher_timeout(
230
- default: Optional[int] = None,
231
- env: Optional[Env] = None,
232
- ) -> Optional[int]:
229
+ default: int | None = None,
230
+ env: MutableMapping | None = None,
231
+ ) -> int | None:
233
232
  if env is None:
234
233
  env = os.environ
235
234
 
@@ -238,8 +237,8 @@ def get_file_pusher_timeout(
238
237
 
239
238
 
240
239
  def get_ignore(
241
- default: Optional[List[str]] = None, env: Optional[Env] = None
242
- ) -> Optional[List[str]]:
240
+ default: list[str] | None = None, env: MutableMapping | None = None
241
+ ) -> list[str] | None:
243
242
  if env is None:
244
243
  env = os.environ
245
244
  ignore = env.get(IGNORE)
@@ -250,8 +249,8 @@ def get_ignore(
250
249
 
251
250
 
252
251
  def get_project(
253
- default: Optional[str] = None, env: Optional[Env] = None
254
- ) -> Optional[str]:
252
+ default: str | None = None, env: MutableMapping | None = None
253
+ ) -> str | None:
255
254
  if env is None:
256
255
  env = os.environ
257
256
 
@@ -259,8 +258,8 @@ def get_project(
259
258
 
260
259
 
261
260
  def get_username(
262
- default: Optional[str] = None, env: Optional[Env] = None
263
- ) -> Optional[str]:
261
+ default: str | None = None, env: MutableMapping | None = None
262
+ ) -> str | None:
264
263
  if env is None:
265
264
  env = os.environ
266
265
 
@@ -268,8 +267,8 @@ def get_username(
268
267
 
269
268
 
270
269
  def get_user_email(
271
- default: Optional[str] = None, env: Optional[Env] = None
272
- ) -> Optional[str]:
270
+ default: str | None = None, env: MutableMapping | None = None
271
+ ) -> str | None:
273
272
  if env is None:
274
273
  env = os.environ
275
274
 
@@ -277,8 +276,8 @@ def get_user_email(
277
276
 
278
277
 
279
278
  def get_entity(
280
- default: Optional[str] = None, env: Optional[Env] = None
281
- ) -> Optional[str]:
279
+ default: str | None = None, env: MutableMapping | None = None
280
+ ) -> str | None:
282
281
  if env is None:
283
282
  env = os.environ
284
283
 
@@ -286,8 +285,8 @@ def get_entity(
286
285
 
287
286
 
288
287
  def get_base_url(
289
- default: Optional[str] = None, env: Optional[Env] = None
290
- ) -> Optional[str]:
288
+ default: str | None = None, env: MutableMapping | None = None
289
+ ) -> str | None:
291
290
  if env is None:
292
291
  env = os.environ
293
292
 
@@ -297,15 +296,15 @@ def get_base_url(
297
296
 
298
297
 
299
298
  def get_app_url(
300
- default: Optional[str] = None, env: Optional[Env] = None
301
- ) -> Optional[str]:
299
+ default: str | None = None, env: MutableMapping | None = None
300
+ ) -> str | None:
302
301
  if env is None:
303
302
  env = os.environ
304
303
 
305
304
  return env.get(APP_URL, default)
306
305
 
307
306
 
308
- def get_show_run(default: Optional[str] = None, env: Optional[Env] = None) -> bool:
307
+ def get_show_run(default: str | None = None, env: MutableMapping | None = None) -> bool:
309
308
  if env is None:
310
309
  env = os.environ
311
310
 
@@ -313,38 +312,40 @@ def get_show_run(default: Optional[str] = None, env: Optional[Env] = None) -> bo
313
312
 
314
313
 
315
314
  def get_description(
316
- default: Optional[str] = None, env: Optional[Env] = None
317
- ) -> Optional[str]:
315
+ default: str | None = None, env: MutableMapping | None = None
316
+ ) -> str | None:
318
317
  if env is None:
319
318
  env = os.environ
320
319
 
321
320
  return env.get(DESCRIPTION, default)
322
321
 
323
322
 
324
- def get_tags(default: str = "", env: Optional[Env] = None) -> List[str]:
323
+ def get_tags(default: str = "", env: MutableMapping | None = None) -> list[str]:
325
324
  if env is None:
326
325
  env = os.environ
327
326
 
328
327
  return [tag for tag in env.get(TAGS, default).split(",") if tag]
329
328
 
330
329
 
331
- def get_dir(default: Optional[str] = None, env: Optional[Env] = None) -> Optional[str]:
330
+ def get_dir(
331
+ default: str | None = None, env: MutableMapping | None = None
332
+ ) -> str | None:
332
333
  if env is None:
333
334
  env = os.environ
334
335
  return env.get(DIR, default)
335
336
 
336
337
 
337
338
  def get_config_paths(
338
- default: Optional[str] = None, env: Optional[Env] = None
339
- ) -> Optional[str]:
339
+ default: str | None = None, env: MutableMapping | None = None
340
+ ) -> str | None:
340
341
  if env is None:
341
342
  env = os.environ
342
343
  return env.get(CONFIG_PATHS, default)
343
344
 
344
345
 
345
346
  def get_agent_report_interval(
346
- default: Optional[str] = None, env: Optional[Env] = None
347
- ) -> Optional[int]:
347
+ default: str | None = None, env: MutableMapping | None = None
348
+ ) -> int | None:
348
349
  if env is None:
349
350
  env = os.environ
350
351
  val = env.get(AGENT_REPORT_INTERVAL, default)
@@ -356,8 +357,8 @@ def get_agent_report_interval(
356
357
 
357
358
 
358
359
  def get_agent_kill_delay(
359
- default: Optional[str] = None, env: Optional[Env] = None
360
- ) -> Optional[int]:
360
+ default: str | None = None, env: MutableMapping | None = None
361
+ ) -> int | None:
361
362
  if env is None:
362
363
  env = os.environ
363
364
  val = env.get(AGENT_KILL_DELAY, default)
@@ -369,8 +370,8 @@ def get_agent_kill_delay(
369
370
 
370
371
 
371
372
  def get_crash_nosync_time(
372
- default: Optional[str] = None, env: Optional[Env] = None
373
- ) -> Optional[int]:
373
+ default: str | None = None, env: MutableMapping | None = None
374
+ ) -> int | None:
374
375
  if env is None:
375
376
  env = os.environ
376
377
  val = env.get(CRASH_NOSYNC_TIME, default)
@@ -382,15 +383,15 @@ def get_crash_nosync_time(
382
383
 
383
384
 
384
385
  def get_magic(
385
- default: Optional[str] = None, env: Optional[Env] = None
386
- ) -> Optional[str]:
386
+ default: str | None = None, env: MutableMapping | None = None
387
+ ) -> str | None:
387
388
  if env is None:
388
389
  env = os.environ
389
390
  val = env.get(MAGIC, default)
390
391
  return val
391
392
 
392
393
 
393
- def get_data_dir(env: Optional[Env] = None) -> str:
394
+ def get_data_dir(env: MutableMapping | None = None) -> str:
394
395
  default_dir = platformdirs.user_data_dir("wandb")
395
396
  if env is None:
396
397
  env = os.environ
@@ -398,15 +399,15 @@ def get_data_dir(env: Optional[Env] = None) -> str:
398
399
  return val
399
400
 
400
401
 
401
- def get_artifact_dir(env: Optional[Env] = None) -> str:
402
+ def get_artifact_dir(env: MutableMapping | None = None) -> str:
402
403
  default_dir = os.path.join(".", "artifacts")
403
404
  if env is None:
404
405
  env = os.environ
405
406
  val = env.get(ARTIFACT_DIR, default_dir)
406
- return os.path.abspath(val)
407
+ return os.path.abspath(str(val))
407
408
 
408
409
 
409
- def get_artifact_fetch_file_url_batch_size(env: Optional[Env] = None) -> int:
410
+ def get_artifact_fetch_file_url_batch_size(env: MutableMapping | None = None) -> int:
410
411
  default_batch_size = 5000
411
412
  if env is None:
412
413
  env = os.environ
@@ -414,12 +415,12 @@ def get_artifact_fetch_file_url_batch_size(env: Optional[Env] = None) -> int:
414
415
  return val
415
416
 
416
417
 
417
- def get_cache_dir(env: Optional[Env] = None) -> Path:
418
+ def get_cache_dir(env: MutableMapping | None = None) -> Path:
418
419
  env = env or os.environ
419
420
  return Path(env.get(CACHE_DIR, platformdirs.user_cache_dir("wandb")))
420
421
 
421
422
 
422
- def get_use_v1_artifacts(env: Optional[Env] = None) -> bool:
423
+ def get_use_v1_artifacts(env: MutableMapping | None = None) -> bool:
423
424
  if env is None:
424
425
  env = os.environ
425
426
  val = bool(env.get(USE_V1_ARTIFACTS, False))
@@ -427,8 +428,8 @@ def get_use_v1_artifacts(env: Optional[Env] = None) -> bool:
427
428
 
428
429
 
429
430
  def get_agent_max_initial_failures(
430
- default: Optional[int] = None, env: Optional[Env] = None
431
- ) -> Optional[int]:
431
+ default: int | None = None, env: MutableMapping | None = None
432
+ ) -> int | None:
432
433
  if env is None:
433
434
  env = os.environ
434
435
  val = env.get(AGENT_MAX_INITIAL_FAILURES, default)
@@ -439,13 +440,13 @@ def get_agent_max_initial_failures(
439
440
  return val
440
441
 
441
442
 
442
- def set_entity(value: str, env: Optional[Env] = None) -> None:
443
+ def set_entity(value: str, env: MutableMapping | None = None) -> None:
443
444
  if env is None:
444
445
  env = os.environ
445
446
  env[ENTITY] = value
446
447
 
447
448
 
448
- def set_project(value: str, env: Optional[Env] = None) -> None:
449
+ def set_project(value: str, env: MutableMapping | None = None) -> None:
449
450
  if env is None:
450
451
  env = os.environ
451
452
  env[PROJECT] = value or "uncategorized"
@@ -457,7 +458,7 @@ def should_save_code() -> bool:
457
458
  return save_code and not code_disabled
458
459
 
459
460
 
460
- def disable_git(env: Optional[Env] = None) -> bool:
461
+ def disable_git(env: MutableMapping | None = None) -> bool:
461
462
  if env is None:
462
463
  env = os.environ
463
464
  val = env.get(DISABLE_GIT, default="False")
@@ -466,28 +467,28 @@ def disable_git(env: Optional[Env] = None) -> bool:
466
467
  return val
467
468
 
468
469
 
469
- def get_launch_queue_name(env: Optional[Env] = None) -> Optional[str]:
470
+ def get_launch_queue_name(env: MutableMapping | None = None) -> str | None:
470
471
  if env is None:
471
472
  env = os.environ
472
473
  val = env.get(LAUNCH_QUEUE_NAME, None)
473
474
  return val
474
475
 
475
476
 
476
- def get_launch_queue_entity(env: Optional[Env] = None) -> Optional[str]:
477
+ def get_launch_queue_entity(env: MutableMapping | None = None) -> str | None:
477
478
  if env is None:
478
479
  env = os.environ
479
480
  val = env.get(LAUNCH_QUEUE_ENTITY, None)
480
481
  return val
481
482
 
482
483
 
483
- def get_launch_trace_id(env: Optional[Env] = None) -> Optional[str]:
484
+ def get_launch_trace_id(env: MutableMapping | None = None) -> str | None:
484
485
  if env is None:
485
486
  env = os.environ
486
487
  val = env.get(LAUNCH_TRACE_ID, None)
487
488
  return val
488
489
 
489
490
 
490
- def get_credentials_file(default: str, env: Optional[Env] = None) -> Path:
491
+ def get_credentials_file(default: str, env: MutableMapping | None = None) -> Path:
491
492
  """Retrieve the path for the credentials file used to save access tokens.
492
493
 
493
494
  The credentials file path can be set via an environment variable, otherwise