wandb 0.20.2rc20250616__py3-none-win_amd64.whl → 0.21.1__py3-none-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. wandb/__init__.py +16 -14
  2. wandb/__init__.pyi +450 -472
  3. wandb/agents/pyagent.py +41 -12
  4. wandb/analytics/sentry.py +7 -2
  5. wandb/apis/importers/mlflow.py +1 -1
  6. wandb/apis/internal.py +3 -0
  7. wandb/apis/paginator.py +17 -4
  8. wandb/apis/public/__init__.py +1 -1
  9. wandb/apis/public/api.py +606 -359
  10. wandb/apis/public/artifacts.py +214 -16
  11. wandb/apis/public/automations.py +19 -3
  12. wandb/apis/public/files.py +177 -38
  13. wandb/apis/public/history.py +67 -15
  14. wandb/apis/public/integrations.py +25 -2
  15. wandb/apis/public/jobs.py +90 -2
  16. wandb/apis/public/projects.py +161 -69
  17. wandb/apis/public/query_generator.py +11 -1
  18. wandb/apis/public/registries/registries_search.py +7 -15
  19. wandb/apis/public/reports.py +147 -13
  20. wandb/apis/public/runs.py +315 -128
  21. wandb/apis/public/sweeps.py +222 -22
  22. wandb/apis/public/teams.py +41 -4
  23. wandb/apis/public/users.py +45 -4
  24. wandb/automations/__init__.py +10 -10
  25. wandb/automations/_filters/run_metrics.py +0 -2
  26. wandb/automations/_utils.py +0 -2
  27. wandb/automations/actions.py +0 -2
  28. wandb/automations/automations.py +0 -2
  29. wandb/automations/events.py +0 -2
  30. wandb/beta/workflows.py +66 -30
  31. wandb/bin/gpu_stats.exe +0 -0
  32. wandb/bin/wandb-core +0 -0
  33. wandb/cli/cli.py +80 -1
  34. wandb/env.py +8 -0
  35. wandb/errors/errors.py +4 -1
  36. wandb/integration/catboost/catboost.py +6 -2
  37. wandb/integration/kfp/kfp_patch.py +3 -1
  38. wandb/integration/lightning/fabric/logger.py +3 -4
  39. wandb/integration/metaflow/__init__.py +6 -0
  40. wandb/integration/metaflow/data_pandas.py +74 -0
  41. wandb/integration/metaflow/errors.py +13 -0
  42. wandb/integration/metaflow/metaflow.py +205 -190
  43. wandb/integration/openai/fine_tuning.py +1 -2
  44. wandb/integration/sb3/sb3.py +3 -3
  45. wandb/integration/ultralytics/callback.py +6 -2
  46. wandb/jupyter.py +5 -5
  47. wandb/plot/__init__.py +2 -0
  48. wandb/plot/bar.py +30 -29
  49. wandb/plot/confusion_matrix.py +75 -71
  50. wandb/plot/custom_chart.py +30 -7
  51. wandb/plot/histogram.py +26 -25
  52. wandb/plot/line.py +33 -32
  53. wandb/plot/line_series.py +100 -103
  54. wandb/plot/pr_curve.py +33 -32
  55. wandb/plot/roc_curve.py +38 -38
  56. wandb/plot/scatter.py +27 -27
  57. wandb/proto/v3/wandb_internal_pb2.py +366 -385
  58. wandb/proto/v3/wandb_settings_pb2.py +2 -2
  59. wandb/proto/v3/wandb_telemetry_pb2.py +4 -4
  60. wandb/proto/v4/wandb_internal_pb2.py +352 -356
  61. wandb/proto/v4/wandb_settings_pb2.py +2 -2
  62. wandb/proto/v4/wandb_telemetry_pb2.py +4 -4
  63. wandb/proto/v5/wandb_internal_pb2.py +352 -356
  64. wandb/proto/v5/wandb_settings_pb2.py +2 -2
  65. wandb/proto/v5/wandb_telemetry_pb2.py +4 -4
  66. wandb/proto/v6/wandb_internal_pb2.py +352 -356
  67. wandb/proto/v6/wandb_settings_pb2.py +2 -2
  68. wandb/proto/v6/wandb_telemetry_pb2.py +4 -4
  69. wandb/proto/wandb_deprecated.py +6 -0
  70. wandb/sdk/artifacts/_generated/__init__.py +12 -1
  71. wandb/sdk/artifacts/_generated/input_types.py +20 -2
  72. wandb/sdk/artifacts/_generated/link_artifact.py +21 -0
  73. wandb/sdk/artifacts/_generated/operations.py +9 -0
  74. wandb/sdk/artifacts/_internal_artifact.py +19 -8
  75. wandb/sdk/artifacts/_validators.py +48 -2
  76. wandb/sdk/artifacts/artifact.py +269 -96
  77. wandb/sdk/data_types/audio.py +38 -10
  78. wandb/sdk/data_types/base_types/media.py +15 -63
  79. wandb/sdk/data_types/base_types/wb_value.py +6 -6
  80. wandb/sdk/data_types/graph.py +48 -14
  81. wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +1 -3
  82. wandb/sdk/data_types/helper_types/image_mask.py +1 -3
  83. wandb/sdk/data_types/histogram.py +34 -21
  84. wandb/sdk/data_types/html.py +35 -12
  85. wandb/sdk/data_types/image.py +104 -68
  86. wandb/sdk/data_types/molecule.py +32 -19
  87. wandb/sdk/data_types/object_3d.py +36 -17
  88. wandb/sdk/data_types/plotly.py +18 -5
  89. wandb/sdk/data_types/saved_model.py +7 -9
  90. wandb/sdk/data_types/table.py +99 -70
  91. wandb/sdk/data_types/trace_tree.py +12 -12
  92. wandb/sdk/data_types/video.py +53 -26
  93. wandb/sdk/integration_utils/auto_logging.py +2 -2
  94. wandb/sdk/interface/interface.py +8 -19
  95. wandb/sdk/interface/interface_shared.py +7 -16
  96. wandb/sdk/internal/datastore.py +18 -18
  97. wandb/sdk/internal/handler.py +3 -5
  98. wandb/sdk/internal/internal_api.py +60 -0
  99. wandb/sdk/internal/job_builder.py +6 -0
  100. wandb/sdk/internal/sender.py +23 -3
  101. wandb/sdk/internal/sender_config.py +9 -0
  102. wandb/sdk/launch/_project_spec.py +3 -3
  103. wandb/sdk/launch/agent/agent.py +11 -4
  104. wandb/sdk/launch/agent/job_status_tracker.py +3 -1
  105. wandb/sdk/launch/agent/run_queue_item_file_saver.py +2 -2
  106. wandb/sdk/launch/create_job.py +3 -1
  107. wandb/sdk/launch/inputs/internal.py +3 -4
  108. wandb/sdk/launch/inputs/schema.py +1 -0
  109. wandb/sdk/launch/runner/kubernetes_monitor.py +1 -0
  110. wandb/sdk/launch/runner/kubernetes_runner.py +328 -1
  111. wandb/sdk/launch/sweeps/scheduler.py +2 -3
  112. wandb/sdk/launch/utils.py +3 -3
  113. wandb/sdk/lib/asyncio_compat.py +3 -0
  114. wandb/sdk/lib/console_capture.py +66 -19
  115. wandb/sdk/lib/deprecate.py +1 -7
  116. wandb/sdk/lib/disabled.py +1 -1
  117. wandb/sdk/lib/hashutil.py +14 -1
  118. wandb/sdk/lib/module.py +7 -13
  119. wandb/sdk/lib/progress.py +0 -19
  120. wandb/sdk/lib/sock_client.py +0 -4
  121. wandb/sdk/wandb_init.py +67 -93
  122. wandb/sdk/wandb_login.py +18 -14
  123. wandb/sdk/wandb_metric.py +2 -0
  124. wandb/sdk/wandb_require.py +0 -1
  125. wandb/sdk/wandb_run.py +429 -527
  126. wandb/sdk/wandb_settings.py +364 -74
  127. wandb/sdk/wandb_setup.py +28 -28
  128. wandb/sdk/wandb_sweep.py +14 -13
  129. wandb/sdk/wandb_watch.py +4 -6
  130. wandb/sync/sync.py +10 -0
  131. wandb/util.py +57 -0
  132. wandb/wandb_run.py +1 -2
  133. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/METADATA +1 -1
  134. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/RECORD +137 -137
  135. wandb/sdk/wandb_metadata.py +0 -623
  136. wandb/vendor/pynvml/__init__.py +0 -0
  137. wandb/vendor/pynvml/pynvml.py +0 -4779
  138. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/WHEEL +0 -0
  139. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/entry_points.txt +0 -0
  140. {wandb-0.20.2rc20250616.dist-info → wandb-0.21.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,31 @@
1
- """Public API: sweeps."""
1
+ """W&B Public API for Sweeps.
2
+
3
+ This module provides classes for interacting with W&B hyperparameter
4
+ optimization sweeps.
5
+
6
+ Example:
7
+ ```python
8
+ from wandb.apis.public import Api
9
+
10
+ # Get a specific sweep
11
+ sweep = Api().sweep("entity/project/sweep_id")
12
+
13
+ # Access sweep properties
14
+ print(f"Sweep: {sweep.name}")
15
+ print(f"State: {sweep.state}")
16
+ print(f"Best Loss: {sweep.best_loss}")
17
+
18
+ # Get best performing run
19
+ best_run = sweep.best_run()
20
+ print(f"Best Run: {best_run.name}")
21
+ print(f"Metrics: {best_run.summary}")
22
+ ```
23
+
24
+ Note:
25
+ This module is part of the W&B Public API and provides read-only access
26
+ to sweep data. For creating and controlling sweeps, use the wandb.sweep()
27
+ and wandb.agent() functions from the main wandb package.
28
+ """
2
29
 
3
30
  import urllib
4
31
  from typing import Optional
@@ -9,6 +36,8 @@ import wandb
9
36
  from wandb import util
10
37
  from wandb.apis import public
11
38
  from wandb.apis.attrs import Attrs
39
+ from wandb.apis.paginator import SizedPaginator
40
+ from wandb.apis.public.api import RetryingClient
12
41
  from wandb.sdk.lib import ipython
13
42
 
14
43
  SWEEP_FRAGMENT = """fragment SweepFragment on Sweep {
@@ -27,23 +56,154 @@ SWEEP_FRAGMENT = """fragment SweepFragment on Sweep {
27
56
  """
28
57
 
29
58
 
30
- class Sweep(Attrs):
31
- """A set of runs associated with a sweep.
59
+ class Sweeps(SizedPaginator["Sweep"]):
60
+ """A lazy iterator over a collection of `Sweep` objects.
32
61
 
33
62
  Examples:
34
- Instantiate with:
35
- ```
36
- api = wandb.Api()
37
- sweep = api.sweep(path / to / sweep)
38
- ```
63
+ ```python
64
+ from wandb.apis.public import Api
65
+
66
+ sweeps = Api().project(name="project_name", entity="entity").sweeps()
67
+
68
+ # Iterate over sweeps and print details
69
+ for sweep in sweeps:
70
+ print(f"Sweep name: {sweep.name}")
71
+ print(f"Sweep ID: {sweep.id}")
72
+ print(f"Sweep URL: {sweep.url}")
73
+ print("----------")
74
+ ```
75
+ """
76
+
77
+ QUERY = gql(
78
+ f"""#graphql
79
+ query GetSweeps($project: String!, $entity: String!, $cursor: String, $perPage: Int = 50) {{
80
+ project(name: $project, entityName: $entity) {{
81
+ totalSweeps
82
+ sweeps(after: $cursor, first: $perPage) {{
83
+ edges {{
84
+ node {{
85
+ ...SweepFragment
86
+ }}
87
+ cursor
88
+ }}
89
+ pageInfo {{
90
+ endCursor
91
+ hasNextPage
92
+ }}
93
+ }}
94
+ }}
95
+ }}
96
+ {SWEEP_FRAGMENT}
97
+ """
98
+ )
99
+
100
+ def __init__(
101
+ self,
102
+ client: RetryingClient,
103
+ entity: str,
104
+ project: str,
105
+ per_page: int = 50,
106
+ ) -> "Sweeps":
107
+ """An iterable collection of `Sweep` objects.
108
+
109
+ Args:
110
+ client: The API client used to query W&B.
111
+ entity: The entity which owns the sweeps.
112
+ project: The project which contains the sweeps.
113
+ per_page: The number of sweeps to fetch per request to the API.
114
+ """
115
+ self.client = client
116
+ self.entity = entity
117
+ self.project = project
118
+ variables = {
119
+ "project": self.project,
120
+ "entity": self.entity,
121
+ }
122
+ super().__init__(client, variables, per_page)
123
+
124
+ @property
125
+ def _length(self):
126
+ """The total number of sweeps in the project.
127
+
128
+ <!-- lazydoc-ignore: internal -->
129
+ """
130
+ if not self.last_response:
131
+ self._load_page()
132
+
133
+ return (
134
+ self.last_response["project"]["totalSweeps"]
135
+ if self.last_response["project"]["totalSweeps"] is not None
136
+ else 0
137
+ )
138
+
139
+ @property
140
+ def more(self):
141
+ """Returns whether there are more sweeps to fetch.
142
+
143
+ <!-- lazydoc-ignore: internal -->
144
+ """
145
+ if self.last_response:
146
+ return bool(
147
+ self.last_response["project"]["sweeps"]["pageInfo"]["hasNextPage"]
148
+ )
149
+ else:
150
+ return True
151
+
152
+ @property
153
+ def cursor(self):
154
+ """Returns the cursor for the next page of sweeps.
155
+
156
+ <!-- lazydoc-ignore: internal -->
157
+ """
158
+ if self.last_response:
159
+ return self.last_response["project"]["sweeps"]["pageInfo"]["endCursor"]
160
+ else:
161
+ return None
162
+
163
+ def update_variables(self):
164
+ """Updates the variables for the next page of sweeps.
165
+
166
+ <!-- lazydoc-ignore: internal -->
167
+ """
168
+ self.variables.update({"perPage": self.per_page, "cursor": self.cursor})
169
+
170
+ def convert_objects(self):
171
+ """Converts the last GraphQL response into a list of `Sweep` objects.
172
+
173
+ <!-- lazydoc-ignore: internal -->
174
+ """
175
+ if self.last_response is None or self.last_response.get("project") is None:
176
+ raise ValueError("Could not find project {}".format(self.project))
177
+
178
+ if self.last_response["project"]["totalSweeps"] < 1:
179
+ return []
180
+
181
+ return [
182
+ # match format of existing public sweep apis
183
+ public.Sweep(
184
+ self.client,
185
+ self.entity,
186
+ self.project,
187
+ e["node"]["name"],
188
+ )
189
+ for e in self.last_response["project"]["sweeps"]["edges"]
190
+ ]
191
+
192
+ def __repr__(self):
193
+ return f"<Sweeps {self.entity}/{self.project}>"
194
+
195
+
196
+ class Sweep(Attrs):
197
+ """The set of runs associated with the sweep.
39
198
 
40
199
  Attributes:
41
- runs: (`Runs`) list of runs
42
- id: (str) sweep id
43
- project: (str) name of project
44
- config: (str) dictionary of sweep configuration
45
- state: (str) the state of the sweep
46
- expected_run_count: (int) number of expected runs for the sweep
200
+ runs (Runs): List of runs
201
+ id (str): Sweep ID
202
+ project (str): The name of the project the sweep belongs to
203
+ config (dict): Dictionary containing the sweep configuration
204
+ state (str): The state of the sweep. Can be "Finished", "Failed",
205
+ "Crashed", or "Running".
206
+ expected_run_count (int): The number of expected runs for the sweep
47
207
  """
48
208
 
49
209
  QUERY = gql(
@@ -53,6 +213,7 @@ class Sweep(Attrs):
53
213
  sweep(sweepName: $name) {
54
214
  id
55
215
  name
216
+ displayName
56
217
  state
57
218
  runCountExpected
58
219
  bestLoss
@@ -92,18 +253,25 @@ class Sweep(Attrs):
92
253
 
93
254
  @property
94
255
  def entity(self):
256
+ """The entity associated with the sweep."""
95
257
  return self._entity
96
258
 
97
259
  @property
98
260
  def username(self):
261
+ """Deprecated. Use `Sweep.entity` instead."""
99
262
  wandb.termwarn("Sweep.username is deprecated. please use Sweep.entity instead.")
100
263
  return self._entity
101
264
 
102
265
  @property
103
266
  def config(self):
267
+ """The sweep configuration used for the sweep."""
104
268
  return util.load_yaml(self._attrs["config"])
105
269
 
106
270
  def load(self, force: bool = False):
271
+ """Fetch and update sweep data logged to the run from GraphQL database.
272
+
273
+ <!-- lazydoc-ignore: internal -->
274
+ """
107
275
  if force or not self._attrs:
108
276
  sweep = self.get(self.client, self.entity, self.project, self.id)
109
277
  if sweep is None:
@@ -115,6 +283,7 @@ class Sweep(Attrs):
115
283
 
116
284
  @property
117
285
  def order(self):
286
+ """Return the order key for the sweep."""
118
287
  if self._attrs.get("config") and self.config.get("metric"):
119
288
  sort_order = self.config["metric"].get("goal", "minimize")
120
289
  prefix = "+" if sort_order == "minimize" else "-"
@@ -154,6 +323,9 @@ class Sweep(Attrs):
154
323
 
155
324
  @property
156
325
  def path(self):
326
+ """Returns the path of the project.
327
+
328
+ The path is a list containing the entity, project name, and sweep ID."""
157
329
  return [
158
330
  urllib.parse.quote_plus(str(self.entity)),
159
331
  urllib.parse.quote_plus(str(self.project)),
@@ -162,26 +334,54 @@ class Sweep(Attrs):
162
334
 
163
335
  @property
164
336
  def url(self):
337
+ """The URL of the sweep.
338
+
339
+ The sweep URL is generated from the entity, project, the term
340
+ "sweeps", and the sweep ID.run_id. For
341
+ SaaS users, it takes the form
342
+ of `https://wandb.ai/entity/project/sweeps/sweeps_ID`.
343
+ """
165
344
  path = self.path
166
345
  path.insert(2, "sweeps")
167
346
  return self.client.app_url + "/".join(path)
168
347
 
169
348
  @property
170
349
  def name(self):
171
- return self.config.get("name") or self.id
350
+ """The name of the sweep.
351
+
352
+ Returns the first name that exists in the following priority order:
353
+
354
+ 1. User-edited display name
355
+ 2. Name configured at creation time
356
+ 3. Sweep ID
357
+ """
358
+ return self._attrs.get("displayName") or self.config.get("name") or self.id
172
359
 
173
360
  @classmethod
174
361
  def get(
175
362
  cls,
176
- client,
177
- entity=None,
178
- project=None,
179
- sid=None,
180
- order=None,
181
- query=None,
363
+ client: "RetryingClient",
364
+ entity: Optional[str] = None,
365
+ project: Optional[str] = None,
366
+ sid: Optional[str] = None,
367
+ order: Optional[str] = None,
368
+ query: Optional[str] = None,
182
369
  **kwargs,
183
370
  ):
184
- """Execute a query against the cloud backend."""
371
+ """Execute a query against the cloud backend.
372
+
373
+ Args:
374
+ client: The client to use to execute the query.
375
+ entity: The entity (username or team) that owns the project.
376
+ project: The name of the project to fetch sweep from.
377
+ sid: The sweep ID to query.
378
+ order: The order in which the sweep's runs are returned.
379
+ query: The query to use to execute the query.
380
+ **kwargs: Additional keyword arguments to pass to the query.
381
+ """
382
+ if not order:
383
+ order = "+created_at"
384
+
185
385
  if query is None:
186
386
  query = cls.QUERY
187
387
 
@@ -1,4 +1,12 @@
1
- """Public API: teams."""
1
+ """W&B Public API for managing teams and team members.
2
+
3
+ This module provides classes for managing W&B teams and their members.
4
+
5
+ Note:
6
+ This module is part of the W&B Public API and provides methods to manage
7
+ teams and their members. Team management operations require appropriate
8
+ permissions.
9
+ """
2
10
 
3
11
  import requests
4
12
  from wandb_gql import gql
@@ -7,6 +15,14 @@ from wandb.apis.attrs import Attrs
7
15
 
8
16
 
9
17
  class Member(Attrs):
18
+ """A member of a team.
19
+
20
+ Args:
21
+ client (`wandb.apis.internal.Api`): The client instance to use
22
+ team (str): The name of the team this member belongs to
23
+ attrs (dict): The member attributes
24
+ """
25
+
10
26
  DELETE_MEMBER_MUTATION = gql(
11
27
  """
12
28
  mutation DeleteInvite($id: String, $entityName: String) {
@@ -40,6 +56,21 @@ class Member(Attrs):
40
56
 
41
57
 
42
58
  class Team(Attrs):
59
+ """A class that represents a W&B team.
60
+
61
+ This class provides methods to manage W&B teams, including creating teams,
62
+ inviting members, and managing service accounts. It inherits from Attrs
63
+ to handle team attributes.
64
+
65
+ Args:
66
+ client (`wandb.apis.public.Api`): The api instance to use
67
+ name (str): The name of the team
68
+ attrs (dict): Optional dictionary of team attributes
69
+
70
+ Note:
71
+ Team management requires appropriate permissions.
72
+ """
73
+
43
74
  CREATE_TEAM_MUTATION = gql(
44
75
  """
45
76
  mutation CreateTeam($teamName: String!, $teamAdminUserName: String) {
@@ -148,11 +179,13 @@ class Team(Attrs):
148
179
  """Invite a user to a team.
149
180
 
150
181
  Args:
151
- username_or_email: (str) The username or email address of the user you want to invite
152
- admin: (bool) Whether to make this user a team admin, defaults to False
182
+ username_or_email: (str) The username or email address of the user
183
+ you want to invite.
184
+ admin: (bool) Whether to make this user a team admin.
185
+ Defaults to `False`.
153
186
 
154
187
  Returns:
155
- True on success, False if user was already invited or didn't exist
188
+ `True` on success, `False` if user was already invited or didn't exist.
156
189
  """
157
190
  variables = {"entityName": self.name, "admin": admin}
158
191
  if "@" in username_or_email:
@@ -185,6 +218,10 @@ class Team(Attrs):
185
218
  return None
186
219
 
187
220
  def load(self, force=False):
221
+ """Return members that belong to a team.
222
+
223
+ <!-- lazydoc-ignore: internal -->
224
+ """
188
225
  if force or not self._attrs:
189
226
  response = self._client.execute(self.TEAM_QUERY, {"name": self.name})
190
227
  self._attrs = response["entity"]
@@ -1,4 +1,11 @@
1
- """Public API: users."""
1
+ """W&B Public API for managing users and API keys.
2
+
3
+ This module provides classes for managing W&B users and their API keys.
4
+
5
+ Note:
6
+ This module is part of the W&B Public API and provides methods to manage
7
+ users and their authentication. Some operations require admin privileges.
8
+ """
2
9
 
3
10
  import requests
4
11
  from wandb_gql import gql
@@ -8,6 +15,20 @@ from wandb.apis.attrs import Attrs
8
15
 
9
16
 
10
17
  class User(Attrs):
18
+ """A class representing a W&B user with authentication and management capabilities.
19
+
20
+ This class provides methods to manage W&B users, including creating users,
21
+ managing API keys, and accessing team memberships. It inherits from Attrs
22
+ to handle user attributes.
23
+
24
+ Args:
25
+ client: (`wandb.apis.internal.Api`) The client instance to use
26
+ attrs: (dict) The user attributes
27
+
28
+ Note:
29
+ Some operations require admin privileges
30
+ """
31
+
11
32
  CREATE_USER_MUTATION = gql(
12
33
  """
13
34
  mutation CreateUserFromAdmin($email: String!, $admin: Boolean) {
@@ -63,9 +84,9 @@ class User(Attrs):
63
84
  """Create a new user.
64
85
 
65
86
  Args:
66
- api: (`Api`) The api instance to use
67
- email: (str) The name of the team
68
- admin: (bool) Whether this user should be a global instance admin
87
+ api (`Api`): The api instance to use
88
+ email (str): The name of the team
89
+ admin (bool): Whether this user should be a global instance admin
69
90
 
70
91
  Returns:
71
92
  A `User` object
@@ -78,12 +99,24 @@ class User(Attrs):
78
99
 
79
100
  @property
80
101
  def api_keys(self):
102
+ """List of API key names associated with the user.
103
+
104
+ Returns:
105
+ list[str]: Names of API keys associated with the user. Empty list if user
106
+ has no API keys or if API key data hasn't been loaded.
107
+ """
81
108
  if self._attrs.get("apiKeys") is None:
82
109
  return []
83
110
  return [k["node"]["name"] for k in self._attrs["apiKeys"]["edges"]]
84
111
 
85
112
  @property
86
113
  def teams(self):
114
+ """List of team names that the user is a member of.
115
+
116
+ Returns:
117
+ list (list): Names of teams the user belongs to. Empty list if user has no
118
+ team memberships or if teams data hasn't been loaded.
119
+ """
87
120
  if self._attrs.get("teams") is None:
88
121
  return []
89
122
  return [k["node"]["name"] for k in self._attrs["teams"]["edges"]]
@@ -91,6 +124,10 @@ class User(Attrs):
91
124
  def delete_api_key(self, api_key):
92
125
  """Delete a user's api key.
93
126
 
127
+ Args:
128
+ api_key (str): The name of the API key to delete. This should be
129
+ one of the names returned by the `api_keys` property.
130
+
94
131
  Returns:
95
132
  Boolean indicating success
96
133
 
@@ -110,6 +147,10 @@ class User(Attrs):
110
147
  def generate_api_key(self, description=None):
111
148
  """Generate a new api key.
112
149
 
150
+ Args:
151
+ description (str, optional): A description for the new API key. This can be
152
+ used to identify the purpose of the API key.
153
+
113
154
  Returns:
114
155
  The new api key, or None on failure
115
156
  """
@@ -45,21 +45,21 @@ else:
45
45
 
46
46
  __all__ = [
47
47
  # Scopes
48
- "ScopeType",
49
- "ArtifactCollectionScope",
50
- "ProjectScope",
48
+ "ScopeType", # doc:exclude
49
+ "ArtifactCollectionScope", # doc:exclude
50
+ "ProjectScope", # doc:exclude
51
51
  # Events
52
- "EventType",
52
+ "EventType", # doc:exclude
53
53
  "OnAddArtifactAlias",
54
54
  "OnCreateArtifact",
55
55
  "OnLinkArtifact",
56
56
  "OnRunMetric",
57
- "ArtifactEvent",
58
- "RunEvent",
57
+ "ArtifactEvent", # doc:exclude
58
+ "RunEvent", # doc:exclude
59
59
  "MetricThresholdFilter",
60
60
  "MetricChangeFilter",
61
61
  # Actions
62
- "ActionType",
62
+ "ActionType", # doc:exclude
63
63
  "SendNotification",
64
64
  "SendWebhook",
65
65
  "DoNothing",
@@ -67,7 +67,7 @@ __all__ = [
67
67
  "Automation",
68
68
  "NewAutomation",
69
69
  # Integrations
70
- "Integration",
71
- "SlackIntegration",
72
- "WebhookIntegration",
70
+ "Integration", # doc:exclude
71
+ "SlackIntegration", # doc:exclude
72
+ "WebhookIntegration", # doc:exclude
73
73
  ]
@@ -1,5 +1,3 @@
1
- # ruff: noqa: UP007
2
-
3
1
  from __future__ import annotations
4
2
 
5
3
  from abc import ABC, abstractmethod
@@ -1,5 +1,3 @@
1
- # ruff: noqa: UP007 # Avoid using `X | Y` for union fields, as this can cause issues with pydantic < 2.6
2
-
3
1
  from __future__ import annotations
4
2
 
5
3
  from typing import Any, Collection, Final, Optional, Protocol, TypedDict
@@ -1,7 +1,5 @@
1
1
  """Actions that are triggered by W&B Automations."""
2
2
 
3
- # ruff: noqa: UP007 # Avoid using `X | Y` for union fields, as this can cause issues with pydantic < 2.6
4
-
5
3
  from __future__ import annotations
6
4
 
7
5
  from typing import Any, Literal, Optional, Union
@@ -1,5 +1,3 @@
1
- # ruff: noqa: UP007 # Avoid using `X | Y` for union fields, as this can cause issues with pydantic < 2.6
2
-
3
1
  from __future__ import annotations
4
2
 
5
3
  from datetime import datetime
@@ -1,7 +1,5 @@
1
1
  """Events that trigger W&B Automations."""
2
2
 
3
- # ruff: noqa: UP007 # Avoid using `X | Y` for union fields, as this can cause issues with pydantic < 2.6
4
-
5
3
  from __future__ import annotations
6
4
 
7
5
  from typing import TYPE_CHECKING, Any, Literal, Optional, Union