wandb 0.17.0rc2__py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl → 0.17.1__py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. wandb/__init__.py +1 -2
  2. wandb/apis/importers/internals/internal.py +0 -1
  3. wandb/apis/importers/wandb.py +12 -7
  4. wandb/apis/internal.py +0 -3
  5. wandb/apis/public/api.py +213 -79
  6. wandb/apis/public/artifacts.py +335 -100
  7. wandb/apis/public/files.py +9 -9
  8. wandb/apis/public/jobs.py +16 -4
  9. wandb/apis/public/projects.py +26 -28
  10. wandb/apis/public/query_generator.py +1 -1
  11. wandb/apis/public/runs.py +163 -65
  12. wandb/apis/public/sweeps.py +2 -2
  13. wandb/apis/reports/__init__.py +1 -7
  14. wandb/apis/reports/v1/__init__.py +5 -27
  15. wandb/apis/reports/v2/__init__.py +7 -19
  16. wandb/apis/workspaces/__init__.py +8 -0
  17. wandb/beta/workflows.py +8 -3
  18. wandb/bin/wandb-core +0 -0
  19. wandb/cli/cli.py +131 -59
  20. wandb/docker/__init__.py +1 -1
  21. wandb/errors/term.py +10 -2
  22. wandb/filesync/step_checksum.py +1 -4
  23. wandb/filesync/step_prepare.py +4 -24
  24. wandb/filesync/step_upload.py +5 -107
  25. wandb/filesync/upload_job.py +0 -76
  26. wandb/integration/gym/__init__.py +35 -15
  27. wandb/integration/openai/fine_tuning.py +21 -3
  28. wandb/integration/prodigy/prodigy.py +1 -1
  29. wandb/jupyter.py +16 -17
  30. wandb/plot/pr_curve.py +2 -1
  31. wandb/plot/roc_curve.py +2 -1
  32. wandb/{plots → plot}/utils.py +13 -25
  33. wandb/proto/v3/wandb_internal_pb2.py +54 -54
  34. wandb/proto/v3/wandb_settings_pb2.py +2 -2
  35. wandb/proto/v3/wandb_telemetry_pb2.py +10 -10
  36. wandb/proto/v4/wandb_internal_pb2.py +54 -54
  37. wandb/proto/v4/wandb_settings_pb2.py +2 -2
  38. wandb/proto/v4/wandb_telemetry_pb2.py +10 -10
  39. wandb/proto/v5/wandb_base_pb2.py +30 -0
  40. wandb/proto/v5/wandb_internal_pb2.py +355 -0
  41. wandb/proto/v5/wandb_server_pb2.py +63 -0
  42. wandb/proto/v5/wandb_settings_pb2.py +45 -0
  43. wandb/proto/v5/wandb_telemetry_pb2.py +41 -0
  44. wandb/proto/wandb_base_pb2.py +2 -0
  45. wandb/proto/wandb_deprecated.py +9 -1
  46. wandb/proto/wandb_generate_deprecated.py +34 -0
  47. wandb/proto/{wandb_internal_codegen.py → wandb_generate_proto.py} +1 -35
  48. wandb/proto/wandb_internal_pb2.py +2 -0
  49. wandb/proto/wandb_server_pb2.py +2 -0
  50. wandb/proto/wandb_settings_pb2.py +2 -0
  51. wandb/proto/wandb_telemetry_pb2.py +2 -0
  52. wandb/sdk/artifacts/artifact.py +68 -22
  53. wandb/sdk/artifacts/artifact_manifest.py +1 -1
  54. wandb/sdk/artifacts/artifact_manifest_entry.py +6 -3
  55. wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +1 -1
  56. wandb/sdk/artifacts/artifact_saver.py +1 -10
  57. wandb/sdk/artifacts/storage_handlers/local_file_handler.py +6 -2
  58. wandb/sdk/artifacts/storage_handlers/multi_handler.py +1 -1
  59. wandb/sdk/artifacts/storage_handlers/tracking_handler.py +6 -4
  60. wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +2 -42
  61. wandb/sdk/artifacts/storage_policy.py +1 -12
  62. wandb/sdk/data_types/image.py +1 -1
  63. wandb/sdk/data_types/video.py +4 -2
  64. wandb/sdk/interface/interface.py +13 -0
  65. wandb/sdk/interface/interface_shared.py +1 -1
  66. wandb/sdk/internal/file_pusher.py +2 -5
  67. wandb/sdk/internal/file_stream.py +6 -19
  68. wandb/sdk/internal/internal_api.py +148 -136
  69. wandb/sdk/internal/job_builder.py +207 -135
  70. wandb/sdk/internal/progress.py +0 -28
  71. wandb/sdk/internal/sender.py +102 -39
  72. wandb/sdk/internal/settings_static.py +8 -1
  73. wandb/sdk/internal/system/assets/trainium.py +3 -3
  74. wandb/sdk/internal/system/system_info.py +4 -2
  75. wandb/sdk/internal/update.py +1 -1
  76. wandb/sdk/launch/__init__.py +9 -1
  77. wandb/sdk/launch/_launch.py +4 -24
  78. wandb/sdk/launch/_launch_add.py +1 -3
  79. wandb/sdk/launch/_project_spec.py +184 -224
  80. wandb/sdk/launch/agent/agent.py +58 -18
  81. wandb/sdk/launch/agent/config.py +0 -3
  82. wandb/sdk/launch/builder/abstract.py +67 -0
  83. wandb/sdk/launch/builder/build.py +165 -576
  84. wandb/sdk/launch/builder/context_manager.py +235 -0
  85. wandb/sdk/launch/builder/docker_builder.py +7 -23
  86. wandb/sdk/launch/builder/kaniko_builder.py +10 -23
  87. wandb/sdk/launch/builder/templates/dockerfile.py +92 -0
  88. wandb/sdk/launch/create_job.py +51 -45
  89. wandb/sdk/launch/environment/aws_environment.py +26 -1
  90. wandb/sdk/launch/inputs/files.py +148 -0
  91. wandb/sdk/launch/inputs/internal.py +224 -0
  92. wandb/sdk/launch/inputs/manage.py +95 -0
  93. wandb/sdk/launch/runner/abstract.py +2 -2
  94. wandb/sdk/launch/runner/kubernetes_monitor.py +45 -12
  95. wandb/sdk/launch/runner/kubernetes_runner.py +6 -8
  96. wandb/sdk/launch/runner/local_container.py +2 -3
  97. wandb/sdk/launch/runner/local_process.py +8 -29
  98. wandb/sdk/launch/runner/sagemaker_runner.py +20 -14
  99. wandb/sdk/launch/runner/vertex_runner.py +8 -7
  100. wandb/sdk/launch/sweeps/scheduler.py +2 -0
  101. wandb/sdk/launch/sweeps/utils.py +2 -2
  102. wandb/sdk/launch/utils.py +16 -138
  103. wandb/sdk/lib/_settings_toposort_generated.py +2 -5
  104. wandb/sdk/lib/apikey.py +4 -2
  105. wandb/sdk/lib/config_util.py +3 -3
  106. wandb/sdk/lib/proto_util.py +22 -1
  107. wandb/sdk/lib/redirect.py +1 -1
  108. wandb/sdk/service/service.py +2 -1
  109. wandb/sdk/service/streams.py +5 -5
  110. wandb/sdk/wandb_init.py +25 -59
  111. wandb/sdk/wandb_login.py +28 -25
  112. wandb/sdk/wandb_run.py +112 -45
  113. wandb/sdk/wandb_settings.py +33 -64
  114. wandb/sdk/wandb_watch.py +1 -1
  115. wandb/sklearn/plot/classifier.py +4 -6
  116. wandb/sync/sync.py +2 -2
  117. wandb/testing/relay.py +32 -17
  118. wandb/util.py +36 -37
  119. wandb/wandb_agent.py +3 -3
  120. wandb/wandb_controller.py +3 -2
  121. {wandb-0.17.0rc2.dist-info → wandb-0.17.1.dist-info}/METADATA +7 -9
  122. {wandb-0.17.0rc2.dist-info → wandb-0.17.1.dist-info}/RECORD +710 -732
  123. wandb/apis/reports/v1/_blocks.py +0 -1406
  124. wandb/apis/reports/v1/_helpers.py +0 -70
  125. wandb/apis/reports/v1/_panels.py +0 -1282
  126. wandb/apis/reports/v1/_templates.py +0 -478
  127. wandb/apis/reports/v1/blocks.py +0 -27
  128. wandb/apis/reports/v1/helpers.py +0 -2
  129. wandb/apis/reports/v1/mutations.py +0 -66
  130. wandb/apis/reports/v1/panels.py +0 -17
  131. wandb/apis/reports/v1/report.py +0 -268
  132. wandb/apis/reports/v1/runset.py +0 -144
  133. wandb/apis/reports/v1/templates.py +0 -7
  134. wandb/apis/reports/v1/util.py +0 -406
  135. wandb/apis/reports/v1/validators.py +0 -131
  136. wandb/apis/reports/v2/blocks.py +0 -25
  137. wandb/apis/reports/v2/expr_parsing.py +0 -257
  138. wandb/apis/reports/v2/gql.py +0 -68
  139. wandb/apis/reports/v2/interface.py +0 -1911
  140. wandb/apis/reports/v2/internal.py +0 -867
  141. wandb/apis/reports/v2/metrics.py +0 -6
  142. wandb/apis/reports/v2/panels.py +0 -15
  143. wandb/catboost/__init__.py +0 -9
  144. wandb/fastai/__init__.py +0 -9
  145. wandb/keras/__init__.py +0 -19
  146. wandb/lightgbm/__init__.py +0 -9
  147. wandb/plots/__init__.py +0 -6
  148. wandb/plots/explain_text.py +0 -36
  149. wandb/plots/heatmap.py +0 -81
  150. wandb/plots/named_entity.py +0 -43
  151. wandb/plots/part_of_speech.py +0 -50
  152. wandb/plots/plot_definitions.py +0 -768
  153. wandb/plots/precision_recall.py +0 -121
  154. wandb/plots/roc.py +0 -103
  155. wandb/sacred/__init__.py +0 -3
  156. wandb/xgboost/__init__.py +0 -9
  157. {wandb-0.17.0rc2.dist-info → wandb-0.17.1.dist-info}/WHEEL +0 -0
  158. {wandb-0.17.0rc2.dist-info → wandb-0.17.1.dist-info}/entry_points.txt +0 -0
  159. {wandb-0.17.0rc2.dist-info → wandb-0.17.1.dist-info}/licenses/LICENSE +0 -0
wandb/__init__.py CHANGED
@@ -11,7 +11,7 @@ For scripts and interactive notebooks, see https://github.com/wandb/examples.
11
11
 
12
12
  For reference documentation, see https://docs.wandb.com/ref/python.
13
13
  """
14
- __version__ = "0.17.0rc2"
14
+ __version__ = "0.17.1"
15
15
 
16
16
 
17
17
  # Used with pypi checks and other messages related to pip
@@ -85,7 +85,6 @@ from wandb.wandb_agent import agent
85
85
  # from wandb.core import *
86
86
  from wandb.viz import visualize
87
87
  from wandb import plot
88
- from wandb import plots # deprecating this
89
88
  from wandb.integration.sagemaker import sagemaker_auth
90
89
  from wandb.sdk.internal import profiler
91
90
 
@@ -323,7 +323,6 @@ def _make_settings(
323
323
  "_sync": True,
324
324
  "_live_policy_rate_limit": 15, # matches dir_watcher
325
325
  "_live_policy_wait_time": 600, # matches dir_watcher
326
- "_async_upload_concurrency_limit": None,
327
326
  "_file_stream_timeout_seconds": 60,
328
327
  }
329
328
 
@@ -17,14 +17,14 @@ import filelock
17
17
  import polars as pl
18
18
  import requests
19
19
  import urllib3
20
+ import wandb_workspaces.reports.v1 as wr
20
21
  import yaml
21
22
  from wandb_gql import gql
23
+ from wandb_workspaces.reports.v1 import Report
22
24
 
23
25
  import wandb
24
- import wandb.apis.reports as wr
25
26
  from wandb.apis.public import ArtifactCollection, Run
26
27
  from wandb.apis.public.files import File
27
- from wandb.apis.reports import Report
28
28
  from wandb.util import coalesce, remove_keys_with_none_values
29
29
 
30
30
  from . import validation
@@ -266,11 +266,10 @@ class WandbRun:
266
266
  yield from self._files
267
267
 
268
268
  def logs(self) -> Optional[Iterable[str]]:
269
- if (fname := self._find_in_files("output.log")) is None:
270
- return
271
-
272
- with open(fname) as f:
273
- yield from f.readlines()
269
+ log_files = self._find_all_in_files_regex(r"^.*output\.log$")
270
+ for path in log_files:
271
+ with open(path) as f:
272
+ yield from f.readlines()
274
273
 
275
274
  def _metadata_file(self) -> Dict[str, Any]:
276
275
  if (fname := self._find_in_files("wandb-metadata.json")) is None:
@@ -323,6 +322,12 @@ class WandbRun:
323
322
  return path
324
323
  return None
325
324
 
325
+ def _find_all_in_files_regex(self, regex: str) -> Iterable[str]:
326
+ if files := self.files():
327
+ for path, _ in files:
328
+ if re.match(regex, path):
329
+ yield path
330
+
326
331
 
327
332
  class WandbImporter:
328
333
  """Transfers runs, reports, and artifact sequences between W&B instances."""
wandb/apis/internal.py CHANGED
@@ -170,9 +170,6 @@ class Api:
170
170
  def upload_multipart_file_chunk_retry(self, *args, **kwargs):
171
171
  return self.api.upload_multipart_file_chunk_retry(*args, **kwargs)
172
172
 
173
- async def upload_file_retry_async(self, *args, **kwargs):
174
- return await self.api.upload_file_retry_async(*args, **kwargs)
175
-
176
173
  def get_run_info(self, *args, **kwargs):
177
174
  return self.api.get_run_info(*args, **kwargs)
178
175
 
wandb/apis/public/api.py CHANGED
@@ -15,7 +15,7 @@ import json
15
15
  import logging
16
16
  import os
17
17
  import urllib
18
- from typing import TYPE_CHECKING, Any, Dict, Optional
18
+ from typing import Any, Dict, List, Optional
19
19
 
20
20
  import requests
21
21
  from wandb_gql import Client, gql
@@ -30,13 +30,9 @@ from wandb.apis.public.const import RETRY_TIMEDELTA
30
30
  from wandb.sdk.internal.thread_local_settings import _thread_local_api_settings
31
31
  from wandb.sdk.launch.utils import LAUNCH_DEFAULT_PROJECT
32
32
  from wandb.sdk.lib import retry, runid
33
+ from wandb.sdk.lib.deprecate import Deprecated, deprecate
33
34
  from wandb.sdk.lib.gql_request import GraphQLSession
34
35
 
35
- if TYPE_CHECKING:
36
- import wandb.apis.reports
37
- import wandb.apis.reports.util
38
-
39
-
40
36
  logger = logging.getLogger(__name__)
41
37
 
42
38
 
@@ -69,7 +65,7 @@ class RetryingClient:
69
65
  check_retry_fn=util.no_retry_auth,
70
66
  retryable_exceptions=(RetryError, requests.RequestException),
71
67
  )
72
- def execute(self, *args, **kwargs):
68
+ def execute(self, *args, **kwargs): # noqa: D102 # User not encouraged to use this class directly
73
69
  try:
74
70
  return self._client.execute(*args, **kwargs)
75
71
  except requests.exceptions.ReadTimeout:
@@ -88,7 +84,7 @@ class RetryingClient:
88
84
  self._server_info = self.execute(self.INFO_QUERY).get("serverInfo")
89
85
  return self._server_info
90
86
 
91
- def version_supported(self, min_version):
87
+ def version_supported(self, min_version: str) -> bool: # noqa: D102 # User not encouraged to use this class directly
92
88
  from wandb.util import parse_version
93
89
 
94
90
  return parse_version(min_version) <= parse_version(
@@ -110,6 +106,17 @@ class Api:
110
106
  """
111
107
 
112
108
  _HTTP_TIMEOUT = env.get_http_timeout(19)
109
+ DEFAULT_ENTITY_QUERY = gql(
110
+ """
111
+ query Viewer{
112
+ viewer {
113
+ id
114
+ entity
115
+ }
116
+ }
117
+ """
118
+ )
119
+
113
120
  VIEWER_QUERY = gql(
114
121
  """
115
122
  query Viewer{
@@ -222,7 +229,7 @@ class Api:
222
229
 
223
230
  def __init__(
224
231
  self,
225
- overrides=None,
232
+ overrides: Optional[Dict[str, Any]] = None,
226
233
  timeout: Optional[int] = None,
227
234
  api_key: Optional[str] = None,
228
235
  ) -> None:
@@ -264,38 +271,43 @@ class Api:
264
271
  # https://bugs.python.org/issue22889
265
272
  timeout=self._timeout,
266
273
  auth=auth,
267
- url="%s/graphql" % self.settings["base_url"],
274
+ url="{}/graphql".format(self.settings["base_url"]),
268
275
  cookies=_thread_local_api_settings.cookies,
269
276
  proxies=proxies,
270
277
  )
271
278
  )
272
279
  self._client = RetryingClient(self._base_client)
273
280
 
274
- def create_project(self, name: str, entity: str):
275
- self.client.execute(self.CREATE_PROJECT, {"entityName": entity, "name": name})
281
+ def create_project(self, name: str, entity: str) -> None:
282
+ """Create a new project.
276
283
 
277
- def create_run(self, **kwargs):
278
- """Create a new run."""
279
- if kwargs.get("entity") is None:
280
- kwargs["entity"] = self.default_entity
281
- return public.Run.create(self, **kwargs)
284
+ Arguments:
285
+ name: (str) The name of the new project.
286
+ entity: (str) The entity of the new project.
287
+ """
288
+ self.client.execute(self.CREATE_PROJECT, {"entityName": entity, "name": name})
282
289
 
283
- def create_report(
290
+ def create_run(
284
291
  self,
285
- project: str,
286
- entity: str = "",
287
- title: Optional[str] = "Untitled Report",
288
- description: Optional[str] = "",
289
- width: Optional[str] = "readable",
290
- blocks: Optional["wandb.apis.reports.util.Block"] = None,
291
- ) -> "wandb.apis.reports.Report":
292
- if entity == "":
293
- entity = self.default_entity or ""
294
- if blocks is None:
295
- blocks = []
296
- return wandb.apis.reports.Report(
297
- project, entity, title, description, width, blocks
298
- ).save()
292
+ *,
293
+ run_id: Optional[str] = None,
294
+ project: Optional[str] = None,
295
+ entity: Optional[str] = None,
296
+ ) -> "public.Run":
297
+ """Create a new run.
298
+
299
+ Arguments:
300
+ run_id: (str, optional) The ID to assign to the run, if given. The run ID is automatically generated by
301
+ default, so in general, you do not need to specify this and should only do so at your own risk.
302
+ project: (str, optional) If given, the project of the new run.
303
+ entity: (str, optional) If given, the entity of the new run.
304
+
305
+ Returns:
306
+ The newly created `Run`.
307
+ """
308
+ if entity is None:
309
+ entity = self.default_entity
310
+ return public.Run.create(self, run_id=run_id, project=project, entity=entity)
299
311
 
300
312
  def create_run_queue(
301
313
  self,
@@ -409,22 +421,6 @@ class Api:
409
421
  _default_resource_config=config,
410
422
  )
411
423
 
412
- def load_report(self, path: str) -> "wandb.apis.reports.Report":
413
- """Get report at a given path.
414
-
415
- Arguments:
416
- path: (str) Path to the target report in the form `entity/project/reports/reportId`.
417
- You can get this by copy-pasting the URL after your wandb url. For example:
418
- `megatruong/report-editing/reports/My-fabulous-report-title--VmlldzoxOTc1Njk0`
419
-
420
- Returns:
421
- A `BetaReport` object which represents the report at `path`
422
-
423
- Raises:
424
- wandb.Error if path is invalid
425
- """
426
- return wandb.apis.reports.Report.from_url(path)
427
-
428
424
  def create_user(self, email, admin=False):
429
425
  """Create a new user.
430
426
 
@@ -462,15 +458,15 @@ class Api:
462
458
  return self.run("/".join([entity, project, run_id]))
463
459
 
464
460
  @property
465
- def client(self):
461
+ def client(self) -> RetryingClient:
466
462
  return self._client
467
463
 
468
464
  @property
469
- def user_agent(self):
470
- return "W&B Public Client %s" % wandb.__version__
465
+ def user_agent(self) -> str:
466
+ return "W&B Public Client {}".format(wandb.__version__)
471
467
 
472
468
  @property
473
- def api_key(self):
469
+ def api_key(self) -> Optional[str]:
474
470
  # just use thread local api key if it's set
475
471
  if _thread_local_api_settings.api_key:
476
472
  return _thread_local_api_settings.api_key
@@ -487,14 +483,14 @@ class Api:
487
483
  return key
488
484
 
489
485
  @property
490
- def default_entity(self):
486
+ def default_entity(self) -> Optional[str]:
491
487
  if self._default_entity is None:
492
- res = self._client.execute(self.VIEWER_QUERY)
488
+ res = self._client.execute(self.DEFAULT_ENTITY_QUERY)
493
489
  self._default_entity = (res.get("viewer") or {}).get("entity")
494
490
  return self._default_entity
495
491
 
496
492
  @property
497
- def viewer(self):
493
+ def viewer(self) -> "public.User":
498
494
  if self._viewer is None:
499
495
  self._viewer = public.User(
500
496
  self._client, self._client.execute(self.VIEWER_QUERY).get("viewer")
@@ -618,27 +614,33 @@ class Api:
618
614
  entity = self.settings["entity"] or self.default_entity
619
615
  if path is None:
620
616
  return entity, project
617
+
618
+ path, colon, alias = path.partition(":")
619
+ full_alias = colon + alias
620
+
621
621
  parts = path.split("/")
622
622
  if len(parts) > 3:
623
- raise ValueError("Invalid artifact path: %s" % path)
623
+ raise ValueError("Invalid artifact path: {}".format(path))
624
624
  elif len(parts) == 1:
625
- return entity, project, path
625
+ return entity, project, path + full_alias
626
626
  elif len(parts) == 2:
627
- return entity, parts[0], parts[1]
627
+ return entity, parts[0], parts[1] + full_alias
628
+ parts[-1] += full_alias
628
629
  return parts
629
630
 
630
- def projects(self, entity=None, per_page=200):
631
+ def projects(
632
+ self, entity: Optional[str] = None, per_page: Optional[int] = 200
633
+ ) -> "public.Projects":
631
634
  """Get projects for a given entity.
632
635
 
633
636
  Arguments:
634
- entity: (str) Name of the entity requested. If None, will fall back to
637
+ entity: (str) Name of the entity requested. If None, will fall back to the
635
638
  default entity passed to `Api`. If no default entity, will raise a `ValueError`.
636
639
  per_page: (int) Sets the page size for query pagination. None will use the default size.
637
640
  Usually there is no reason to change this.
638
641
 
639
642
  Returns:
640
643
  A `Projects` object which is an iterable collection of `Project` objects.
641
-
642
644
  """
643
645
  if entity is None:
644
646
  entity = self.settings["entity"] or self.default_entity
@@ -652,19 +654,31 @@ class Api:
652
654
  )
653
655
  return self._projects[entity]
654
656
 
655
- def project(self, name, entity=None):
657
+ def project(self, name: str, entity: Optional[str] = None) -> "public.Project":
658
+ """Return the `Project` with the given name (and entity, if given).
659
+
660
+ Arguments:
661
+ name: (str) The project name.
662
+ entity: (str) Name of the entity requested. If None, will fall back to the
663
+ default entity passed to `Api`. If no default entity, will raise a `ValueError`.
664
+
665
+ Returns:
666
+ A `Project` object.
667
+ """
656
668
  if entity is None:
657
669
  entity = self.settings["entity"] or self.default_entity
658
670
  return public.Project(self.client, entity, name, {})
659
671
 
660
- def reports(self, path="", name=None, per_page=50):
672
+ def reports(
673
+ self, path: str = "", name: Optional[str] = None, per_page: Optional[int] = 50
674
+ ) -> "public.Reports":
661
675
  """Get reports for a given project path.
662
676
 
663
677
  WARNING: This api is in beta and will likely change in a future release
664
678
 
665
679
  Arguments:
666
680
  path: (str) path to project the report resides in, should be in the form: "entity/project"
667
- name: (str) optional name of the report requested.
681
+ name: (str, optional) optional name of the report requested.
668
682
  per_page: (int) Sets the page size for query pagination. None will use the default size.
669
683
  Usually there is no reason to change this.
670
684
 
@@ -700,10 +714,18 @@ class Api:
700
714
  """
701
715
  return public.Team.create(self, team, admin_username)
702
716
 
703
- def team(self, team):
717
+ def team(self, team: str) -> "public.Team":
718
+ """Return the matching `Team` with the given name.
719
+
720
+ Arguments:
721
+ team: (str) The name of the team.
722
+
723
+ Returns:
724
+ A `Team` object.
725
+ """
704
726
  return public.Team(self.client, team)
705
727
 
706
- def user(self, username_or_email):
728
+ def user(self, username_or_email: str) -> Optional["public.User"]:
707
729
  """Return a user from a username or email address.
708
730
 
709
731
  Note: This function only works for Local Admins, if you are trying to get your own user object, please use `api.viewer`.
@@ -725,7 +747,7 @@ class Api:
725
747
  )
726
748
  return public.User(self._client, res["users"]["edges"][0]["node"])
727
749
 
728
- def users(self, username_or_email):
750
+ def users(self, username_or_email: str) -> List["public.User"]:
729
751
  """Return all users from a partial username or email address query.
730
752
 
731
753
  Note: This function only works for Local Admins, if you are trying to get your own user object, please use `api.viewer`.
@@ -745,7 +767,7 @@ class Api:
745
767
  self,
746
768
  path: Optional[str] = None,
747
769
  filters: Optional[Dict[str, Any]] = None,
748
- order: str = "-created_at",
770
+ order: str = "+created_at",
749
771
  per_page: int = 50,
750
772
  include_sweeps: bool = True,
751
773
  ):
@@ -800,6 +822,8 @@ class Api:
800
822
  If you prepend order with a + order is ascending.
801
823
  If you prepend order with a - order is descending (default).
802
824
  The default order is run.created_at from newest to oldest.
825
+ per_page: (int) Sets the page size for query pagination.
826
+ include_sweeps: (bool) Whether to include the sweep runs in the results.
803
827
 
804
828
  Returns:
805
829
  A `Runs` object, which is an iterable collection of `Run` objects.
@@ -892,29 +916,63 @@ class Api:
892
916
  return self._sweeps[path]
893
917
 
894
918
  @normalize_exceptions
895
- def artifact_types(self, project=None):
919
+ def artifact_types(self, project: Optional[str] = None) -> "public.ArtifactTypes":
920
+ """Return a collection of matching artifact types.
921
+
922
+ Arguments:
923
+ project: (str, optional) If given, a project name or path to filter on.
924
+
925
+ Returns:
926
+ An iterable `ArtifactTypes` object.
927
+ """
896
928
  entity, project = self._parse_project_path(project)
897
929
  return public.ArtifactTypes(self.client, entity, project)
898
930
 
899
931
  @normalize_exceptions
900
- def artifact_type(self, type_name, project=None):
932
+ def artifact_type(
933
+ self, type_name: str, project: Optional[str] = None
934
+ ) -> "public.ArtifactType":
935
+ """Return the matching `ArtifactType`.
936
+
937
+ Arguments:
938
+ type_name: (str) The name of the artifact type to retrieve.
939
+ project: (str, optional) If given, a project name or path to filter on.
940
+
941
+ Returns:
942
+ An `ArtifactType` object.
943
+ """
901
944
  entity, project = self._parse_project_path(project)
902
945
  return public.ArtifactType(self.client, entity, project, type_name)
903
946
 
904
947
  @normalize_exceptions
905
- def artifact_collections(self, project_name: str, type_name: str, per_page=50):
948
+ def artifact_collections(
949
+ self, project_name: str, type_name: str, per_page: Optional[int] = 50
950
+ ) -> "public.ArtifactCollections":
951
+ """Return a collection of matching artifact collections.
952
+
953
+ Arguments:
954
+ project_name: (str) The name of the project to filter on.
955
+ type_name: (str) The name of the artifact type to filter on.
956
+ per_page: (int, optional) Sets the page size for query pagination. None will use the default size.
957
+ Usually there is no reason to change this.
958
+
959
+ Returns:
960
+ An iterable `ArtifactCollections` object.
961
+ """
906
962
  entity, project = self._parse_project_path(project_name)
907
963
  return public.ArtifactCollections(
908
964
  self.client, entity, project, type_name, per_page=per_page
909
965
  )
910
966
 
911
967
  @normalize_exceptions
912
- def artifact_collection(self, type_name: str, name: str):
968
+ def artifact_collection(
969
+ self, type_name: str, name: str
970
+ ) -> "public.ArtifactCollection":
913
971
  """Return a single artifact collection by type and parsing path in the form `entity/project/name`.
914
972
 
915
973
  Arguments:
974
+ type_name: (str) The type of artifact collection to fetch.
916
975
  name: (str) An artifact collection name. May be prefixed with entity/project.
917
- type: (str) The type of artifact collection to fetch.
918
976
 
919
977
  Returns:
920
978
  An `ArtifactCollection` object.
@@ -926,14 +984,31 @@ class Api:
926
984
 
927
985
  @normalize_exceptions
928
986
  def artifact_versions(self, type_name, name, per_page=50):
929
- """Deprecated, use artifacts(type_name, name) instead."""
930
- wandb.termwarn(
931
- "Api.artifact_versions(type_name, name) is deprecated, use Api.artifacts(type_name, name) instead."
987
+ """Deprecated, use `artifacts(type_name, name)` instead."""
988
+ deprecate(
989
+ field_name=Deprecated.api__artifact_versions,
990
+ warning_message=(
991
+ "Api.artifact_versions(type_name, name) is deprecated, "
992
+ "use Api.artifacts(type_name, name) instead."
993
+ ),
932
994
  )
933
995
  return self.artifacts(type_name, name, per_page=per_page)
934
996
 
935
997
  @normalize_exceptions
936
- def artifacts(self, type_name, name, per_page=50):
998
+ def artifacts(
999
+ self, type_name: str, name: str, per_page: Optional[int] = 50
1000
+ ) -> "public.Artifacts":
1001
+ """Return an `Artifacts` collection from the given parameters.
1002
+
1003
+ Arguments:
1004
+ type_name: (str) The type of artifacts to fetch.
1005
+ name: (str) An artifact collection name. May be prefixed with entity/project.
1006
+ per_page: (int, optional) Sets the page size for query pagination. None will use the default size.
1007
+ Usually there is no reason to change this.
1008
+
1009
+ Returns:
1010
+ An iterable `Artifacts` object.
1011
+ """
937
1012
  entity, project, collection_name = self._parse_artifact_path(name)
938
1013
  return public.Artifacts(
939
1014
  self.client, entity, project, collection_name, type_name, per_page=per_page
@@ -966,7 +1041,16 @@ class Api:
966
1041
  return artifact
967
1042
 
968
1043
  @normalize_exceptions
969
- def job(self, name, path=None):
1044
+ def job(self, name: Optional[str], path: Optional[str] = None) -> "public.Job":
1045
+ """Return a `Job` from the given parameters.
1046
+
1047
+ Arguments:
1048
+ name: (str) The job name.
1049
+ path: (str, optional) If given, the root path in which to download the job artifact.
1050
+
1051
+ Returns:
1052
+ A `Job` object.
1053
+ """
970
1054
  if name is None:
971
1055
  raise ValueError("You must specify name= to fetch a job.")
972
1056
  elif name.count("/") != 2 or ":" not in name:
@@ -976,7 +1060,16 @@ class Api:
976
1060
  return public.Job(self, name, path)
977
1061
 
978
1062
  @normalize_exceptions
979
- def list_jobs(self, entity, project):
1063
+ def list_jobs(self, entity: str, project: str) -> List[Dict[str, Any]]:
1064
+ """Return a list of jobs, if any, for the given entity and project.
1065
+
1066
+ Arguments:
1067
+ entity: (str) The entity for the listed job(s).
1068
+ project: (str) The project for the listed job(s).
1069
+
1070
+ Returns:
1071
+ A list of matching jobs.
1072
+ """
980
1073
  if entity is None:
981
1074
  raise ValueError("Specify an entity when listing jobs")
982
1075
  if project is None:
@@ -1043,3 +1136,44 @@ class Api:
1043
1136
  return [x["node"]["artifacts"] for x in artifacts]
1044
1137
  except requests.exceptions.HTTPError:
1045
1138
  return False
1139
+
1140
+ @normalize_exceptions
1141
+ def artifact_exists(self, name: str, type: Optional[str] = None) -> bool:
1142
+ """Return whether an artifact version exists within a specified project and entity.
1143
+
1144
+ Arguments:
1145
+ name: (str) An artifact name. May be prefixed with entity/project.
1146
+ If entity or project is not specified, it will be inferred from the override params if populated.
1147
+ Otherwise, entity will be pulled from the user settings and project will default to "uncategorized".
1148
+ Valid names can be in the following forms:
1149
+ name:version
1150
+ name:alias
1151
+ type: (str, optional) The type of artifact
1152
+
1153
+ Returns:
1154
+ True if the artifact version exists, False otherwise.
1155
+ """
1156
+ try:
1157
+ self.artifact(name, type)
1158
+ return True
1159
+ except wandb.errors.CommError:
1160
+ return False
1161
+
1162
+ @normalize_exceptions
1163
+ def artifact_collection_exists(self, name: str, type: str) -> bool:
1164
+ """Return whether an artifact collection exists within a specified project and entity.
1165
+
1166
+ Arguments:
1167
+ name: (str) An artifact collection name. May be prefixed with entity/project.
1168
+ If entity or project is not specified, it will be inferred from the override params if populated.
1169
+ Otherwise, entity will be pulled from the user settings and project will default to "uncategorized".
1170
+ type: (str) The type of artifact collection
1171
+
1172
+ Returns:
1173
+ True if the artifact collection exists, False otherwise.
1174
+ """
1175
+ try:
1176
+ self.artifact_collection(type, name)
1177
+ return True
1178
+ except wandb.errors.CommError:
1179
+ return False