wandb 0.17.0rc2__py3-none-win32.whl → 0.17.2__py3-none-win32.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. wandb/__init__.py +4 -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 +151 -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/old/summary.py +5 -0
  31. wandb/plot/pr_curve.py +2 -1
  32. wandb/plot/roc_curve.py +2 -1
  33. wandb/{plots → plot}/utils.py +13 -25
  34. wandb/proto/v3/wandb_internal_pb2.py +54 -54
  35. wandb/proto/v3/wandb_settings_pb2.py +2 -2
  36. wandb/proto/v3/wandb_telemetry_pb2.py +10 -10
  37. wandb/proto/v4/wandb_internal_pb2.py +54 -54
  38. wandb/proto/v4/wandb_settings_pb2.py +2 -2
  39. wandb/proto/v4/wandb_telemetry_pb2.py +10 -10
  40. wandb/proto/v5/wandb_base_pb2.py +30 -0
  41. wandb/proto/v5/wandb_internal_pb2.py +355 -0
  42. wandb/proto/v5/wandb_server_pb2.py +63 -0
  43. wandb/proto/v5/wandb_settings_pb2.py +45 -0
  44. wandb/proto/v5/wandb_telemetry_pb2.py +41 -0
  45. wandb/proto/wandb_base_pb2.py +2 -0
  46. wandb/proto/wandb_deprecated.py +9 -1
  47. wandb/proto/wandb_generate_deprecated.py +34 -0
  48. wandb/proto/{wandb_internal_codegen.py → wandb_generate_proto.py} +1 -35
  49. wandb/proto/wandb_internal_pb2.py +2 -0
  50. wandb/proto/wandb_server_pb2.py +2 -0
  51. wandb/proto/wandb_settings_pb2.py +2 -0
  52. wandb/proto/wandb_telemetry_pb2.py +2 -0
  53. wandb/sdk/artifacts/artifact.py +76 -23
  54. wandb/sdk/artifacts/artifact_manifest.py +1 -1
  55. wandb/sdk/artifacts/artifact_manifest_entry.py +6 -3
  56. wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +1 -1
  57. wandb/sdk/artifacts/artifact_saver.py +1 -10
  58. wandb/sdk/artifacts/storage_handlers/local_file_handler.py +6 -2
  59. wandb/sdk/artifacts/storage_handlers/multi_handler.py +1 -1
  60. wandb/sdk/artifacts/storage_handlers/tracking_handler.py +6 -4
  61. wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +2 -42
  62. wandb/sdk/artifacts/storage_policy.py +1 -12
  63. wandb/sdk/data_types/_dtypes.py +5 -2
  64. wandb/sdk/data_types/html.py +1 -1
  65. wandb/sdk/data_types/image.py +1 -1
  66. wandb/sdk/data_types/object_3d.py +1 -1
  67. wandb/sdk/data_types/video.py +4 -2
  68. wandb/sdk/interface/interface.py +13 -0
  69. wandb/sdk/interface/interface_shared.py +1 -1
  70. wandb/sdk/internal/file_pusher.py +2 -5
  71. wandb/sdk/internal/file_stream.py +6 -19
  72. wandb/sdk/internal/internal_api.py +160 -138
  73. wandb/sdk/internal/job_builder.py +207 -135
  74. wandb/sdk/internal/progress.py +0 -28
  75. wandb/sdk/internal/sender.py +105 -42
  76. wandb/sdk/internal/settings_static.py +8 -1
  77. wandb/sdk/internal/system/assets/gpu.py +2 -0
  78. wandb/sdk/internal/system/assets/trainium.py +3 -3
  79. wandb/sdk/internal/system/system_info.py +4 -2
  80. wandb/sdk/internal/update.py +1 -1
  81. wandb/sdk/launch/__init__.py +9 -1
  82. wandb/sdk/launch/_launch.py +4 -24
  83. wandb/sdk/launch/_launch_add.py +1 -3
  84. wandb/sdk/launch/_project_spec.py +184 -224
  85. wandb/sdk/launch/agent/agent.py +58 -18
  86. wandb/sdk/launch/agent/config.py +0 -3
  87. wandb/sdk/launch/builder/abstract.py +67 -0
  88. wandb/sdk/launch/builder/build.py +165 -576
  89. wandb/sdk/launch/builder/context_manager.py +235 -0
  90. wandb/sdk/launch/builder/docker_builder.py +7 -23
  91. wandb/sdk/launch/builder/kaniko_builder.py +10 -23
  92. wandb/sdk/launch/builder/templates/dockerfile.py +92 -0
  93. wandb/sdk/launch/create_job.py +51 -45
  94. wandb/sdk/launch/environment/aws_environment.py +26 -1
  95. wandb/sdk/launch/inputs/files.py +148 -0
  96. wandb/sdk/launch/inputs/internal.py +224 -0
  97. wandb/sdk/launch/inputs/manage.py +95 -0
  98. wandb/sdk/launch/runner/abstract.py +2 -2
  99. wandb/sdk/launch/runner/kubernetes_monitor.py +45 -12
  100. wandb/sdk/launch/runner/kubernetes_runner.py +6 -8
  101. wandb/sdk/launch/runner/local_container.py +2 -3
  102. wandb/sdk/launch/runner/local_process.py +8 -29
  103. wandb/sdk/launch/runner/sagemaker_runner.py +20 -14
  104. wandb/sdk/launch/runner/vertex_runner.py +8 -7
  105. wandb/sdk/launch/sweeps/scheduler.py +2 -0
  106. wandb/sdk/launch/sweeps/utils.py +2 -2
  107. wandb/sdk/launch/utils.py +16 -138
  108. wandb/sdk/lib/_settings_toposort_generated.py +2 -5
  109. wandb/sdk/lib/apikey.py +4 -2
  110. wandb/sdk/lib/config_util.py +3 -3
  111. wandb/sdk/lib/proto_util.py +22 -1
  112. wandb/sdk/lib/redirect.py +1 -1
  113. wandb/sdk/service/service.py +2 -1
  114. wandb/sdk/service/streams.py +5 -5
  115. wandb/sdk/wandb_init.py +25 -59
  116. wandb/sdk/wandb_login.py +28 -25
  117. wandb/sdk/wandb_run.py +135 -70
  118. wandb/sdk/wandb_settings.py +33 -64
  119. wandb/sdk/wandb_watch.py +1 -1
  120. wandb/sklearn/plot/classifier.py +4 -6
  121. wandb/sync/sync.py +2 -2
  122. wandb/testing/relay.py +32 -17
  123. wandb/util.py +39 -37
  124. wandb/wandb_agent.py +3 -3
  125. wandb/wandb_controller.py +3 -2
  126. {wandb-0.17.0rc2.dist-info → wandb-0.17.2.dist-info}/METADATA +7 -9
  127. {wandb-0.17.0rc2.dist-info → wandb-0.17.2.dist-info}/RECORD +130 -152
  128. wandb/apis/reports/v1/_blocks.py +0 -1406
  129. wandb/apis/reports/v1/_helpers.py +0 -70
  130. wandb/apis/reports/v1/_panels.py +0 -1282
  131. wandb/apis/reports/v1/_templates.py +0 -478
  132. wandb/apis/reports/v1/blocks.py +0 -27
  133. wandb/apis/reports/v1/helpers.py +0 -2
  134. wandb/apis/reports/v1/mutations.py +0 -66
  135. wandb/apis/reports/v1/panels.py +0 -17
  136. wandb/apis/reports/v1/report.py +0 -268
  137. wandb/apis/reports/v1/runset.py +0 -144
  138. wandb/apis/reports/v1/templates.py +0 -7
  139. wandb/apis/reports/v1/util.py +0 -406
  140. wandb/apis/reports/v1/validators.py +0 -131
  141. wandb/apis/reports/v2/blocks.py +0 -25
  142. wandb/apis/reports/v2/expr_parsing.py +0 -257
  143. wandb/apis/reports/v2/gql.py +0 -68
  144. wandb/apis/reports/v2/interface.py +0 -1911
  145. wandb/apis/reports/v2/internal.py +0 -867
  146. wandb/apis/reports/v2/metrics.py +0 -6
  147. wandb/apis/reports/v2/panels.py +0 -15
  148. wandb/catboost/__init__.py +0 -9
  149. wandb/fastai/__init__.py +0 -9
  150. wandb/keras/__init__.py +0 -19
  151. wandb/lightgbm/__init__.py +0 -9
  152. wandb/plots/__init__.py +0 -6
  153. wandb/plots/explain_text.py +0 -36
  154. wandb/plots/heatmap.py +0 -81
  155. wandb/plots/named_entity.py +0 -43
  156. wandb/plots/part_of_speech.py +0 -50
  157. wandb/plots/plot_definitions.py +0 -768
  158. wandb/plots/precision_recall.py +0 -121
  159. wandb/plots/roc.py +0 -103
  160. wandb/sacred/__init__.py +0 -3
  161. wandb/xgboost/__init__.py +0 -9
  162. {wandb-0.17.0rc2.dist-info → wandb-0.17.2.dist-info}/WHEEL +0 -0
  163. {wandb-0.17.0rc2.dist-info → wandb-0.17.2.dist-info}/entry_points.txt +0 -0
  164. {wandb-0.17.0rc2.dist-info → wandb-0.17.2.dist-info}/licenses/LICENSE +0 -0
@@ -1,867 +0,0 @@
1
- """JSONSchema for internal types. Hopefully this is auto-generated one day!"""
2
-
3
- import json
4
- import random
5
- from copy import deepcopy
6
- from datetime import datetime
7
- from typing import Any, Dict, Optional, Tuple, Union
8
- from typing import List as LList
9
-
10
- from annotated_types import Annotated, Ge, Le
11
-
12
- try:
13
- from typing import Literal
14
- except ImportError:
15
- from typing_extensions import Literal
16
-
17
- from pydantic import BaseModel, ConfigDict, Field, StringConstraints, validator
18
- from pydantic.alias_generators import to_camel
19
-
20
-
21
- def _generate_name(length: int = 12) -> str:
22
- """Generate a random name.
23
-
24
- This implementation roughly based the following snippet in core:
25
- https://github.com/wandb/core/blob/master/lib/js/cg/src/utils/string.ts#L39-L44.
26
- """
27
-
28
- # Borrowed from numpy: https://github.com/numpy/numpy/blob/v1.23.0/numpy/core/numeric.py#L2069-L2123
29
- def base_repr(number: int, base: int, padding: int = 0) -> str:
30
- digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
31
- if base > len(digits):
32
- raise ValueError("Bases greater than 36 not handled in base_repr.")
33
- elif base < 2:
34
- raise ValueError("Bases less than 2 not handled in base_repr.")
35
-
36
- num = abs(number)
37
- res = []
38
- while num:
39
- res.append(digits[num % base])
40
- num //= base
41
- if padding:
42
- res.append("0" * padding)
43
- if number < 0:
44
- res.append("-")
45
- return "".join(reversed(res or "0"))
46
-
47
- rand = random.random()
48
- rand = int(float(str(rand)[2:]))
49
- rand36 = base_repr(rand, 36)
50
- return rand36.lower()[:length]
51
-
52
-
53
- hex_pattern = r"^#(?:[0-9a-fA-F]{3}){1,2}$"
54
- rgb_pattern = r"^rgb\(\s*(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\s*,\s*(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\s*,\s*(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\s*\)$"
55
- rgba_pattern = r"^rgba\(\s*(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\s*,\s*(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\s*,\s*(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\s*,\s*(1|0|0?\.\d+)\s*\)$"
56
- ColorStrConstraints = StringConstraints(
57
- pattern=f"{hex_pattern}|{rgb_pattern}|{rgba_pattern}"
58
- )
59
-
60
- LinePlotStyle = Literal["line", "stacked-area", "pct-area"]
61
- BarPlotStyle = Literal["bar", "boxplot", "violin"]
62
- FontSize = Literal["small", "medium", "large", "auto"]
63
- LegendPosition = Literal["north", "south", "east", "west"]
64
- LegendOrientation = Literal["horizontal", "vertical"]
65
- GroupAgg = Literal["mean", "min", "max", "median", "sum", "samples"]
66
- GroupArea = Literal["minmax", "stddev", "stderr", "none", "samples"]
67
- Mark = Literal["solid", "dashed", "dotted", "dotdash", "dotdotdash"]
68
- Timestep = Literal["seconds", "minutes", "hours", "days"]
69
- SmoothingType = Literal["exponential", "gaussian", "average", "none"]
70
- CodeCompareDiff = Literal["split", "unified"]
71
- Range = Tuple[Optional[float], Optional[float]]
72
- Language = Literal["javascript", "python", "css", "json", "html", "markdown", "yaml"]
73
- Ops = Literal["OR", "AND", "=", "!=", "<=", ">=", "IN", "NIN", "=="]
74
- TextLikeInternal = Union["InlineLatex", "InlineLink", "Paragraph", "Text"]
75
- GalleryLink = Union["GalleryLinkReport", "GalleryLinkURL"]
76
- ReportWidth = Literal["readable", "fixed", "fluid"]
77
-
78
-
79
- class TextLikeMixin:
80
- def model_dump(self, **kwargs):
81
- data = super().model_dump(**kwargs)
82
- data["children"] = [c.model_dump() for c in self.children]
83
- return data
84
-
85
- @classmethod
86
- def model_validate(cls, data):
87
- d = deepcopy(data)
88
- children = []
89
- for c in d.get("children"):
90
- _type = c.get("type")
91
- if _type == "link":
92
- child = InlineLink.model_validate(c)
93
- elif _type == "latex":
94
- child = InlineLatex.model_validate(c)
95
- elif _type == "paragraph":
96
- child = Paragraph.model_validate(c)
97
- else:
98
- child = Text.model_validate(c)
99
- children.append(child)
100
-
101
- d["children"] = children
102
- obj = cls(**d)
103
- return obj
104
-
105
-
106
- class Sentinel(BaseModel): ...
107
-
108
-
109
- class ReportEntity(Sentinel): ...
110
-
111
-
112
- class ReportProject(Sentinel): ...
113
-
114
-
115
- class ReportAPIBaseModel(BaseModel):
116
- model_config = ConfigDict(
117
- alias_generator=to_camel,
118
- use_enum_values=True,
119
- validate_assignment=True,
120
- populate_by_name=True,
121
- arbitrary_types_allowed=True,
122
- )
123
-
124
-
125
- class UnknownBlock(ReportAPIBaseModel):
126
- model_config = ConfigDict(
127
- alias_generator=to_camel,
128
- use_enum_values=True,
129
- validate_assignment=True,
130
- populate_by_name=True,
131
- arbitrary_types_allowed=True,
132
- extra="allow",
133
- )
134
-
135
-
136
- class InlineModel(BaseModel):
137
- model_config = ConfigDict(
138
- alias_generator=to_camel,
139
- use_enum_values=True,
140
- validate_assignment=True,
141
- populate_by_name=True,
142
- arbitrary_types_allowed=True,
143
- extra="forbid",
144
- )
145
-
146
-
147
- class Ref(ReportAPIBaseModel):
148
- type: str = ""
149
- view_id: str = ""
150
- id: str = ""
151
-
152
-
153
- class Text(ReportAPIBaseModel):
154
- text: str = ""
155
- inline_code: Optional[bool] = None
156
-
157
- inline_comments: Optional[LList["InlineComment"]] = None
158
-
159
- def model_dump(self, **kwargs):
160
- data = super().model_dump(**kwargs)
161
- comments = self.inline_comments
162
- if comments is None:
163
- comments = []
164
- for comment in comments:
165
- ref_id = comment.ref_id
166
- data[f"inlineComment_{ref_id}"] = comment.model_dump()
167
- data.pop("inline_comments", None)
168
- return data
169
-
170
- @classmethod
171
- def model_validate(cls, data):
172
- d = deepcopy(data)
173
- obj = cls(**d)
174
-
175
- inline_comments = []
176
- for k, v in d.items():
177
- if k.startswith("inlineComment"):
178
- comment = InlineComment.model_validate(v)
179
- inline_comments.append(comment)
180
- obj.inline_comments = inline_comments
181
- return obj
182
-
183
-
184
- class Project(ReportAPIBaseModel):
185
- name: Optional[str] = None
186
- # name: str = ""
187
- entity_name: str = ""
188
-
189
-
190
- class PanelBankConfigSettings(ReportAPIBaseModel):
191
- auto_organize_prefix: int = 2
192
- show_empty_sections: bool = False
193
- sort_alphabetically: bool = False
194
-
195
-
196
- class FlowConfig(ReportAPIBaseModel):
197
- snap_to_columns: bool = True
198
- columns_per_page: int = 3
199
- rows_per_page: int = 2
200
- gutter_width: int = 16
201
- box_width: int = 460
202
- box_height: int = 300
203
-
204
-
205
- class LocalPanelSettings(ReportAPIBaseModel):
206
- x_axis: str = "_step"
207
- smoothing_weight: int = 0
208
- smoothing_type: str = "exponential"
209
- ignore_outliers: bool = False
210
- x_axis_active: bool = False
211
- smoothing_active: bool = False
212
- ref: Optional[Ref] = None
213
-
214
-
215
- class PanelBankConfigSectionsItem(ReportAPIBaseModel):
216
- name: str = "Hidden Panels"
217
- is_open: bool = False
218
- type: str = "flow"
219
- flow_config: FlowConfig = Field(default_factory=FlowConfig)
220
- sorted: int = 0
221
- local_panel_settings: LocalPanelSettings = Field(default_factory=LocalPanelSettings)
222
- panels: list = Field(default_factory=list)
223
- ref: Optional[Ref] = None
224
-
225
-
226
- class PanelBankConfig(ReportAPIBaseModel):
227
- state: int = 0
228
- settings: PanelBankConfigSettings = Field(default_factory=PanelBankConfigSettings)
229
- sections: LList[PanelBankConfigSectionsItem] = Field(
230
- default_factory=lambda: [PanelBankConfigSectionsItem()]
231
- )
232
-
233
-
234
- class PanelBankSectionConfig(ReportAPIBaseModel):
235
- name: Literal["Report Panels"] = "Report Panels"
236
- is_open: bool = False
237
- panels: LList["PanelTypes"] = Field(default_factory=list)
238
- type: Literal["grid"] = "grid"
239
- flow_config: FlowConfig = Field(default_factory=FlowConfig)
240
- sorted: int = 0
241
- local_panel_settings: LocalPanelSettings = Field(default_factory=LocalPanelSettings)
242
-
243
-
244
- class PanelGridCustomRunColors(ReportAPIBaseModel):
245
- ref: Ref
246
-
247
-
248
- class PanelGridMetadataPanels(ReportAPIBaseModel):
249
- views: dict = Field(
250
- default_factory=lambda: {"0": {"name": "Panels", "defaults": [], "config": []}}
251
- )
252
- tabs: list = Field(default_factory=lambda: ["0"])
253
- ref: Optional[Ref] = None
254
-
255
-
256
- class PanelGridMetadata(ReportAPIBaseModel):
257
- open_viz: bool = True
258
- open_run_set: Optional[int] = 0 # none is closed
259
- name: Literal["unused-name"] = "unused-name"
260
- run_sets: LList["Runset"] = Field(default_factory=lambda: [Runset()])
261
- panels: PanelGridMetadataPanels = Field(default_factory=PanelGridMetadataPanels)
262
- panel_bank_config: PanelBankConfig = Field(default_factory=PanelBankConfig)
263
- panel_bank_section_config: PanelBankSectionConfig = Field(
264
- default_factory=PanelBankSectionConfig
265
- )
266
- custom_run_colors: Dict[str, str] = Field(default_factory=dict)
267
- # custom_run_colors: PanelGridCustomRunColors = Field(
268
- # default_factory=PanelGridCustomRunColors
269
- # )
270
-
271
-
272
- class Block(ReportAPIBaseModel): ...
273
-
274
-
275
- class PanelGrid(Block):
276
- type: Literal["panel-grid"] = "panel-grid"
277
- children: LList[Text] = Field(default_factory=lambda: [Text()])
278
- metadata: PanelGridMetadata = Field(default_factory=PanelGridMetadata)
279
-
280
-
281
- class RunsetSearch(ReportAPIBaseModel):
282
- query: str = ""
283
-
284
-
285
- class RunFeed(ReportAPIBaseModel):
286
- version: int = 2
287
- column_visible: Dict[str, bool] = Field(default_factory=lambda: {"run:name": False})
288
- column_pinned: Dict[str, bool] = Field(default_factory=dict)
289
- column_widths: Dict[str, int] = Field(default_factory=dict)
290
- column_order: LList[str] = Field(default_factory=list)
291
- page_size: int = 10
292
- only_show_selected: bool = False
293
-
294
-
295
- class Key(ReportAPIBaseModel):
296
- section: str = "summary"
297
- name: str = ""
298
-
299
-
300
- class Filters(ReportAPIBaseModel):
301
- op: Ops = "OR"
302
- key: Optional[Key] = None
303
- filters: Optional[LList["Filters"]] = None
304
- value: Optional[Any] = None
305
- disabled: Optional[bool] = None
306
-
307
-
308
- class SortKeyKey(ReportAPIBaseModel):
309
- section: str = "run"
310
- name: str = "createdAt"
311
-
312
-
313
- class SortKey(ReportAPIBaseModel):
314
- key: SortKeyKey = Field(default_factory=SortKeyKey)
315
- ascending: bool = False
316
-
317
-
318
- class Sort(ReportAPIBaseModel):
319
- keys: LList[SortKey] = Field(default_factory=lambda: [SortKey()])
320
- ref: Optional[Ref] = None
321
-
322
-
323
- class Runset(ReportAPIBaseModel):
324
- id: str = _generate_name()
325
- run_feed: RunFeed = Field(default_factory=RunFeed)
326
- enabled: bool = True
327
- project: Optional[Project] = None
328
- name: str = "Run set"
329
- search: RunsetSearch = Field(default_factory=RunsetSearch)
330
- filters: Filters = Field(
331
- default_factory=lambda: Filters(filters=[Filters(op="AND")])
332
- )
333
- grouping: LList[Key] = Field(default_factory=list)
334
- sort: Sort = Field(default_factory=Sort)
335
- selections: dict = Field(
336
- default_factory=lambda: {"root": 1, "bounds": [], "tree": []}
337
- )
338
- expanded_row_addresses: list = Field(default_factory=list)
339
- ref: Optional[Ref] = None
340
-
341
-
342
- class CodeLine(ReportAPIBaseModel):
343
- type: Literal["code-line"] = "code-line"
344
- children: LList[TextLikeInternal] = Field(default_factory=lambda: [Text()])
345
- language: Optional[Language] = "python"
346
-
347
-
348
- class Heading(TextLikeMixin, Block):
349
- type: Literal["heading"] = "heading"
350
- children: LList[TextLikeInternal] = Field(default_factory=lambda: [Text()])
351
- collapsed_children: Optional[LList["BlockTypes"]] = None
352
- level: int = 1
353
-
354
-
355
- class InlineLatex(InlineModel):
356
- type: Literal["latex"] = "latex"
357
- children: LList[Text] = Field(default_factory=lambda: [Text()])
358
- content: str = ""
359
-
360
-
361
- class InlineLink(TextLikeMixin, InlineModel):
362
- type: Literal["link"] = "link"
363
- url: str = "https://"
364
- children: LList[Text] = Field(default_factory=lambda: [Text()])
365
-
366
-
367
- class Paragraph(TextLikeMixin, Block):
368
- type: Literal["paragraph"] = "paragraph"
369
- children: LList[TextLikeInternal] = Field(default_factory=lambda: [Text()])
370
-
371
- model_config = ConfigDict(
372
- alias_generator=to_camel,
373
- use_enum_values=True,
374
- validate_assignment=True,
375
- populate_by_name=True,
376
- arbitrary_types_allowed=True,
377
- extra="forbid",
378
- )
379
-
380
- @validator("children", pre=True, each_item=True)
381
- def parse_children(cls, v): # noqa: N805
382
- if isinstance(v, BaseModel):
383
- v = v.model_dump()
384
- if isinstance(v, dict):
385
- if v.get("type") == "latex":
386
- return InlineLatex(**v)
387
- elif v.get("type") == "link":
388
- return InlineLink(**v)
389
- return Text(**v)
390
-
391
-
392
- class BlockQuote(Block):
393
- type: Literal["block-quote"] = "block-quote"
394
- children: LList[TextLikeInternal] = Field(default_factory=lambda: [Text()])
395
-
396
-
397
- class CodeBlock(Block):
398
- type: Literal["code-block"] = "code-block"
399
- children: LList[CodeLine] = Field(default_factory=lambda: [CodeLine()])
400
- language: Optional[Language] = "python"
401
-
402
-
403
- class MarkdownBlock(Block):
404
- type: Literal["markdown-block"] = "markdown-block"
405
- children: LList[Text] = Field(default_factory=lambda: [Text()])
406
- content: str = ""
407
-
408
-
409
- class LatexBlock(Block):
410
- type: Literal["latex"] = "latex"
411
- children: LList[Text] = Field(default_factory=lambda: [Text()])
412
- content: str = ""
413
- block: bool = True
414
-
415
-
416
- class Image(Block):
417
- type: Literal["image"] = "image"
418
- children: LList[TextLikeInternal] = Field(default_factory=lambda: [Text()])
419
- url: str
420
- has_caption: bool
421
-
422
-
423
- class ListItem(ReportAPIBaseModel):
424
- type: Literal["list-item"] = "list-item"
425
- children: LList[TextLikeInternal]
426
- ordered: Optional[bool] = None
427
- checked: Optional[bool] = None
428
-
429
-
430
- class List(Block):
431
- type: Literal["list"] = "list"
432
- children: LList[ListItem] = Field(default_factory=lambda: [ListItem()])
433
- ordered: Optional[bool] = None
434
-
435
-
436
- class CalloutLine(ReportAPIBaseModel):
437
- type: Literal["callout-line"] = "callout-line"
438
- children: LList[TextLikeInternal] = Field(default_factory=lambda: [Text()])
439
-
440
-
441
- class CalloutBlock(Block):
442
- type: Literal["callout-block"] = "callout-block"
443
- children: LList[CalloutLine] = Field(default_factory=lambda: list)
444
-
445
-
446
- class HorizontalRule(Block):
447
- type: Literal["horizontal-rule"] = "horizontal-rule"
448
- children: LList[Text] = Field(default_factory=lambda: [Text()])
449
-
450
-
451
- class Video(Block):
452
- type: Literal["video"] = "video"
453
- url: str
454
- children: LList[Text] = Field(default_factory=lambda: [Text()])
455
-
456
-
457
- class Spotify(Block):
458
- type: Literal["spotify"] = "spotify"
459
- spotify_type: Literal["track"] = "track"
460
- spotify_id: str = Field(..., alias="spotifyID")
461
- children: LList[Text] = Field(default_factory=lambda: [Text()])
462
-
463
-
464
- class SoundCloud(Block):
465
- type: Literal["soundcloud"] = "soundcloud"
466
- html: str
467
- children: LList[Text] = Field(default_factory=lambda: [Text()])
468
-
469
-
470
- class GalleryLinkReport(ReportAPIBaseModel):
471
- type: Literal["report"] = "report"
472
- id: str = ""
473
-
474
-
475
- class GalleryLinkURL(ReportAPIBaseModel):
476
- type: Literal["url"] = "url"
477
- url: str = ""
478
- title: Optional[str] = None
479
- description: Optional[str] = None
480
- image_url: Optional[str] = Field(..., alias="imageURL")
481
-
482
-
483
- class Gallery(Block):
484
- type: Literal["gallery"] = "gallery"
485
- children: LList[Text] = Field(default_factory=lambda: [Text()])
486
- links: Optional[LList[GalleryLink]] = None
487
- ids: Optional[LList[str]] = None
488
-
489
-
490
- class TableOfContents(ReportAPIBaseModel):
491
- type: Literal["table-of-contents"] = "table-of-contents"
492
- children: LList[Text] = Field(default_factory=lambda: [Text()])
493
-
494
-
495
- class Twitter(ReportAPIBaseModel):
496
- type: Literal["twitter"] = "twitter"
497
- children: LList[Text] = Field(default_factory=lambda: [Text()])
498
- html: str
499
-
500
-
501
- class WeaveBlock(ReportAPIBaseModel):
502
- type: Literal["weave-panel"] = "weave-panel"
503
- children: LList[Text] = Field(default_factory=lambda: [Text()])
504
- config: dict = Field(default_factory=dict)
505
-
506
-
507
- class InlineComment(ReportAPIBaseModel):
508
- ref_id: str = Field(..., alias="refID")
509
- thread_id: str = Field(..., alias="threadID")
510
- comment_id: str = Field(..., alias="commentID")
511
-
512
-
513
- class Spec(ReportAPIBaseModel):
514
- version: int = 5
515
- panel_settings: dict = Field(default_factory=dict)
516
- blocks: LList["BlockTypes"] = Field(default_factory=list)
517
- width: str = "readable"
518
- authors: list = Field(default_factory=list)
519
- discussion_threads: list = Field(default_factory=list)
520
- ref: dict = Field(default_factory=dict)
521
-
522
-
523
- class ReportViewspec(ReportAPIBaseModel):
524
- id: str = ""
525
- name: str = ""
526
- display_name: str = ""
527
- description: str = ""
528
- project: Project = Field(default_factory=Project)
529
- created_at: Optional[datetime] = None
530
- updated_at: Optional[datetime] = None
531
- spec: Spec = Field(default_factory=Spec)
532
-
533
- @validator("spec", pre=True)
534
- def parse_json(cls, v): # noqa: N805
535
- if isinstance(v, str):
536
- try:
537
- return json.loads(v)
538
- except json.JSONDecodeError:
539
- raise ValueError("invalid json")
540
- return v
541
-
542
-
543
- class Layout(ReportAPIBaseModel):
544
- x: int = 0
545
- y: int = 0
546
- w: int = 8
547
- h: int = 6
548
-
549
-
550
- class Panel(ReportAPIBaseModel):
551
- id: str = Field("", alias="__id__")
552
- layout: Layout = Field(default_factory=Layout)
553
- ref: Optional[Ref] = None
554
-
555
-
556
- class MediaBrowserConfig(ReportAPIBaseModel):
557
- column_count: Optional[int] = None
558
- media_keys: LList[str] = Field(default_factory=list)
559
-
560
-
561
- class MediaBrowser(Panel):
562
- view_type: Literal["Media Browser"] = "Media Browser"
563
- config: MediaBrowserConfig = Field(default_factory=MediaBrowserConfig)
564
-
565
-
566
- class MarkdownPanelConfig(ReportAPIBaseModel):
567
- value: str
568
-
569
-
570
- class MarkdownPanel(Panel):
571
- view_type: Literal["Markdown Panel"] = "Markdown Panel"
572
- config: MarkdownPanelConfig
573
-
574
-
575
- class LinePlotConfig(ReportAPIBaseModel):
576
- chart_title: Optional[str] = None
577
- x_axis: Optional[str] = None
578
- metrics: LList[str] = Field(default_factory=list)
579
- x_axis_min: Optional[float] = None
580
- x_axis_max: Optional[float] = None
581
- y_axis_min: Optional[float] = None
582
- y_axis_max: Optional[float] = None
583
- x_log_scale: Optional[bool] = None
584
- y_log_scale: Optional[bool] = None
585
- x_axis_title: Optional[str] = None
586
- y_axis_title: Optional[str] = None
587
- ignore_outliers: Optional[bool] = None
588
- group_by: Optional[str] = None
589
- group_agg: Optional[GroupAgg] = None
590
- group_area: Optional[GroupArea] = None
591
- smoothing_weight: Optional[float] = None
592
- smoothing_type: Optional[SmoothingType] = None
593
- show_original_after_smoothing: Optional[bool] = None
594
- limit: Optional[int] = None
595
- expressions: Optional[LList[str]] = None
596
- plot_type: Optional[LinePlotStyle] = None
597
- font_size: Optional[FontSize] = None
598
- legend_position: Optional[LegendPosition] = None
599
- legend_template: Optional[str] = None
600
- aggregate: Optional[bool] = None
601
- x_expression: Optional[str] = None
602
-
603
- override_line_widths: Optional[dict] = None
604
- override_colors: Optional[dict] = None
605
- override_series_titles: Optional[dict] = None
606
- legend_fields: Optional[list] = None
607
-
608
- # there are more here...
609
-
610
-
611
- class LinePlot(Panel):
612
- view_type: Literal["Run History Line Plot"] = "Run History Line Plot"
613
- config: LinePlotConfig = Field(default_factory=LinePlotConfig)
614
-
615
-
616
- class GradientPoint(ReportAPIBaseModel):
617
- color: Annotated[str, ColorStrConstraints]
618
- offset: Annotated[float, Ge(0), Le(100)] = 0
619
-
620
-
621
- class ScatterPlotConfig(ReportAPIBaseModel):
622
- chart_title: Optional[str] = None
623
- x_axis: Optional[str] = None
624
- y_axis: Optional[str] = None
625
- z_axis: Optional[str] = None
626
- x_axis_min: Optional[float] = None
627
- x_axis_max: Optional[float] = None
628
- y_axis_min: Optional[float] = None
629
- y_axis_max: Optional[float] = None
630
- z_axis_min: Optional[float] = None
631
- z_axis_max: Optional[float] = None
632
- x_axis_log_scale: Optional[bool] = None
633
- y_axis_log_scale: Optional[bool] = None
634
- z_axis_log_scale: Optional[bool] = None
635
- show_min_y_axis_line: Optional[bool] = None
636
- show_max_y_axis_line: Optional[bool] = None
637
- show_avg_y_axis_line: Optional[bool] = None
638
- legend_template: Optional[str] = None
639
- custom_gradient: Optional[LList[GradientPoint]] = None
640
- font_size: Optional[FontSize] = None
641
- show_linear_regression: Optional[bool] = None
642
-
643
-
644
- class ScatterPlot(Panel):
645
- view_type: Literal["Scatter Plot"] = "Scatter Plot"
646
- config: ScatterPlotConfig = Field(default_factory=ScatterPlotConfig)
647
-
648
-
649
- class BarPlotConfig(ReportAPIBaseModel):
650
- chart_title: Optional[str] = None
651
- metrics: LList[str] = Field(default_factory=list)
652
- vertical: bool = False
653
- x_axis_min: Optional[float] = None
654
- x_axis_max: Optional[float] = None
655
- x_axis_title: Optional[str] = None
656
- y_axis_title: Optional[str] = None
657
- group_by: Optional[str] = None
658
- group_agg: Optional[GroupAgg] = None
659
- group_area: Optional[GroupArea] = None
660
- limit: Optional[int] = None
661
- bar_limit: Optional[int] = None
662
- expressions: Optional[LList[str]] = None
663
- legend_template: Optional[str] = None
664
- font_size: Optional[FontSize] = None
665
- override_series_titles: Optional[dict] = None
666
- override_colors: Optional[dict] = None
667
-
668
-
669
- class BarPlot(Panel):
670
- view_type: Literal["Bar Chart"] = "Bar Chart"
671
- config: BarPlotConfig = Field(default_factory=BarPlotConfig)
672
-
673
-
674
- class ScalarChartConfig(ReportAPIBaseModel):
675
- chart_title: Optional[str] = None
676
- metrics: LList[str] = Field(default_factory=list)
677
- group_agg: Optional[GroupAgg] = None
678
- group_area: Optional[GroupArea] = None
679
- expressions: Optional[LList[str]] = None
680
- legend_template: Optional[str] = None
681
- font_size: Optional[FontSize] = None
682
-
683
-
684
- class ScalarChart(Panel):
685
- view_type: Literal["Scalar Chart"] = "Scalar Chart"
686
- config: ScalarChartConfig = Field(default_factory=ScalarChartConfig)
687
-
688
-
689
- class CodeComparerConfig(ReportAPIBaseModel):
690
- diff: CodeCompareDiff = "split"
691
-
692
-
693
- class CodeComparer(Panel):
694
- view_type: Literal["Code Comparer"] = "Code Comparer"
695
- config: CodeComparerConfig = Field(default_factory=CodeComparerConfig)
696
-
697
-
698
- class Column(ReportAPIBaseModel):
699
- accessor: str
700
- display_name: Optional[str] = None
701
- inverted: Optional[bool] = None
702
- log: Optional[bool] = None
703
- ref: Optional[Ref] = None
704
-
705
-
706
- class ParallelCoordinatesPlotConfig(ReportAPIBaseModel):
707
- chart_title: Optional[str] = None
708
- columns: LList[Column] = Field(default_factory=list)
709
- custom_gradient: Optional[LList[GradientPoint]] = None
710
- font_size: Optional[FontSize] = None
711
-
712
-
713
- class ParallelCoordinatesPlot(Panel):
714
- view_type: Literal["Parallel Coordinates Plot"] = "Parallel Coordinates Plot"
715
- config: ParallelCoordinatesPlotConfig = Field(
716
- default_factory=ParallelCoordinatesPlotConfig
717
- )
718
-
719
-
720
- class ParameterConf(ReportAPIBaseModel):
721
- version: int = 2
722
- column_visible: dict = Field(default_factory=dict)
723
-
724
-
725
- class ParameterImportancePlotConfig(ReportAPIBaseModel):
726
- target_key: str
727
- columns_pinned: dict = Field(default_factory=dict)
728
- column_widths: dict = Field(default_factory=dict)
729
- column_order: LList[str] = Field(default_factory=list)
730
- page_size: int = 10
731
- only_show_selected: bool = False
732
-
733
-
734
- class ParameterImportancePlot(Panel):
735
- view_type: Literal["Parameter Importance"] = "Parameter Importance"
736
- config: ParameterImportancePlotConfig
737
-
738
-
739
- class RunComparerConfig(ReportAPIBaseModel):
740
- diff_only: Optional[Literal["split", True]] = None
741
-
742
-
743
- class RunComparer(Panel):
744
- view_type: Literal["Run Comparer"] = "Run Comparer"
745
- config: RunComparerConfig
746
-
747
-
748
- class QueryFieldsValue(ReportAPIBaseModel):
749
- name: str
750
- value: Any
751
-
752
-
753
- class QueryFieldsField(ReportAPIBaseModel):
754
- name: str = ""
755
- fields: Optional[LList["QueryFieldsField"]] = None
756
- value: LList[QueryFieldsValue] = Field(default_factory=list)
757
-
758
-
759
- class QueryField(ReportAPIBaseModel):
760
- args: LList[QueryFieldsValue] = Field(
761
- default_factory=lambda: [
762
- QueryFieldsValue(name="runSets", value="${runSets}"),
763
- QueryFieldsValue(name="limit", value=500),
764
- ]
765
- )
766
- fields: LList[QueryFieldsField] = Field(
767
- default_factory=lambda: [
768
- QueryFieldsField(name="id", value=[], fields=None),
769
- QueryFieldsField(name="name", value=[], fields=None),
770
- ]
771
- )
772
- name: str = "runSets"
773
-
774
-
775
- class UserQuery(ReportAPIBaseModel):
776
- query_fields: LList[QueryField] = Field(default_factory=lambda: [QueryField()])
777
-
778
-
779
- class Vega2ConfigTransform(ReportAPIBaseModel):
780
- name: Literal["tableWithLeafColNames"] = "tableWithLeafColNames"
781
-
782
-
783
- class Vega2Config(ReportAPIBaseModel):
784
- transform: Vega2ConfigTransform = Field(default_factory=Vega2ConfigTransform)
785
- user_query: UserQuery = Field(default_factory=UserQuery)
786
- panel_def_id: str = ""
787
- field_settings: dict = Field(default_factory=dict)
788
- string_settings: dict = Field(default_factory=dict)
789
-
790
-
791
- class Vega2(Panel):
792
- view_type: Literal["Vega2"] = "Vega2"
793
- config: Vega2Config = Field(default_factory=Vega2Config)
794
-
795
-
796
- class UnknownPanel(ReportAPIBaseModel):
797
- model_config = ConfigDict(
798
- alias_generator=to_camel,
799
- use_enum_values=True,
800
- validate_assignment=True,
801
- populate_by_name=True,
802
- arbitrary_types_allowed=True,
803
- extra="allow",
804
- )
805
-
806
-
807
- class WeavePanel(Panel):
808
- view_type: Literal["Weave"] = "Weave"
809
- config: dict
810
-
811
-
812
- PanelTypes = Union[
813
- LinePlot,
814
- ScatterPlot,
815
- ScalarChart,
816
- BarPlot,
817
- CodeComparer,
818
- ParallelCoordinatesPlot,
819
- ParameterImportancePlot,
820
- RunComparer,
821
- MediaBrowser,
822
- MarkdownPanel,
823
- Vega2,
824
- WeavePanel,
825
- UnknownPanel,
826
- ]
827
-
828
- BlockTypes = Union[
829
- Heading,
830
- Paragraph,
831
- CodeBlock,
832
- MarkdownBlock,
833
- LatexBlock,
834
- Image,
835
- List,
836
- CalloutBlock,
837
- Video,
838
- HorizontalRule,
839
- Spotify,
840
- SoundCloud,
841
- Gallery,
842
- PanelGrid,
843
- TableOfContents,
844
- BlockQuote,
845
- Twitter,
846
- UnknownBlock,
847
- ]
848
-
849
- block_type_mapping = {
850
- "twitter": Twitter,
851
- "heading": Heading,
852
- "paragraph": Paragraph,
853
- "code-block": CodeBlock,
854
- "markdown-block": MarkdownBlock,
855
- "latex-block": LatexBlock,
856
- "image": Image,
857
- "list": List,
858
- "callout-block": CalloutBlock,
859
- "video": Video,
860
- "horziontal-rule": HorizontalRule,
861
- "spotify": Spotify,
862
- "soundcloud": SoundCloud,
863
- "gallery": Gallery,
864
- "panel-grid": PanelGrid,
865
- "table-of-contents": TableOfContents,
866
- "block-quote": BlockQuote,
867
- }