wandb 0.22.0__py3-none-macosx_12_0_arm64.whl → 0.22.2__py3-none-macosx_12_0_arm64.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 (114) hide show
  1. wandb/__init__.py +1 -1
  2. wandb/__init__.pyi +8 -5
  3. wandb/_pydantic/__init__.py +12 -11
  4. wandb/_pydantic/base.py +49 -19
  5. wandb/apis/__init__.py +2 -0
  6. wandb/apis/attrs.py +2 -0
  7. wandb/apis/importers/internals/internal.py +16 -23
  8. wandb/apis/internal.py +2 -0
  9. wandb/apis/normalize.py +2 -0
  10. wandb/apis/public/__init__.py +3 -2
  11. wandb/apis/public/api.py +215 -164
  12. wandb/apis/public/artifacts.py +23 -20
  13. wandb/apis/public/const.py +2 -0
  14. wandb/apis/public/files.py +33 -24
  15. wandb/apis/public/history.py +2 -0
  16. wandb/apis/public/jobs.py +20 -18
  17. wandb/apis/public/projects.py +4 -2
  18. wandb/apis/public/query_generator.py +3 -0
  19. wandb/apis/public/registries/__init__.py +7 -0
  20. wandb/apis/public/registries/_freezable_list.py +9 -12
  21. wandb/apis/public/registries/registries_search.py +8 -6
  22. wandb/apis/public/registries/registry.py +22 -17
  23. wandb/apis/public/reports.py +2 -0
  24. wandb/apis/public/runs.py +261 -57
  25. wandb/apis/public/sweeps.py +10 -9
  26. wandb/apis/public/teams.py +2 -0
  27. wandb/apis/public/users.py +2 -0
  28. wandb/apis/public/utils.py +16 -15
  29. wandb/automations/_generated/__init__.py +54 -127
  30. wandb/automations/_generated/create_generic_webhook_integration.py +1 -7
  31. wandb/automations/_generated/fragments.py +26 -91
  32. wandb/bin/gpu_stats +0 -0
  33. wandb/bin/wandb-core +0 -0
  34. wandb/cli/beta.py +16 -2
  35. wandb/cli/beta_leet.py +74 -0
  36. wandb/cli/beta_sync.py +9 -11
  37. wandb/cli/cli.py +34 -7
  38. wandb/errors/errors.py +3 -3
  39. wandb/proto/v3/wandb_api_pb2.py +86 -0
  40. wandb/proto/v3/wandb_internal_pb2.py +352 -351
  41. wandb/proto/v3/wandb_settings_pb2.py +2 -2
  42. wandb/proto/v3/wandb_sync_pb2.py +19 -6
  43. wandb/proto/v4/wandb_api_pb2.py +37 -0
  44. wandb/proto/v4/wandb_internal_pb2.py +352 -351
  45. wandb/proto/v4/wandb_settings_pb2.py +2 -2
  46. wandb/proto/v4/wandb_sync_pb2.py +10 -6
  47. wandb/proto/v5/wandb_api_pb2.py +38 -0
  48. wandb/proto/v5/wandb_internal_pb2.py +352 -351
  49. wandb/proto/v5/wandb_settings_pb2.py +2 -2
  50. wandb/proto/v5/wandb_sync_pb2.py +10 -6
  51. wandb/proto/v6/wandb_api_pb2.py +48 -0
  52. wandb/proto/v6/wandb_internal_pb2.py +352 -351
  53. wandb/proto/v6/wandb_settings_pb2.py +2 -2
  54. wandb/proto/v6/wandb_sync_pb2.py +10 -6
  55. wandb/proto/wandb_api_pb2.py +18 -0
  56. wandb/proto/wandb_generate_proto.py +1 -0
  57. wandb/sdk/artifacts/_factories.py +7 -2
  58. wandb/sdk/artifacts/_generated/__init__.py +112 -412
  59. wandb/sdk/artifacts/_generated/fragments.py +65 -0
  60. wandb/sdk/artifacts/_generated/operations.py +52 -22
  61. wandb/sdk/artifacts/_generated/run_input_artifacts.py +3 -23
  62. wandb/sdk/artifacts/_generated/run_output_artifacts.py +3 -23
  63. wandb/sdk/artifacts/_generated/type_info.py +19 -0
  64. wandb/sdk/artifacts/_gqlutils.py +47 -0
  65. wandb/sdk/artifacts/_models/__init__.py +4 -0
  66. wandb/sdk/artifacts/_models/base_model.py +20 -0
  67. wandb/sdk/artifacts/_validators.py +40 -12
  68. wandb/sdk/artifacts/artifact.py +99 -118
  69. wandb/sdk/artifacts/artifact_file_cache.py +6 -1
  70. wandb/sdk/artifacts/artifact_manifest_entry.py +67 -14
  71. wandb/sdk/artifacts/storage_handler.py +18 -12
  72. wandb/sdk/artifacts/storage_handlers/azure_handler.py +11 -6
  73. wandb/sdk/artifacts/storage_handlers/gcs_handler.py +9 -6
  74. wandb/sdk/artifacts/storage_handlers/http_handler.py +9 -4
  75. wandb/sdk/artifacts/storage_handlers/local_file_handler.py +10 -6
  76. wandb/sdk/artifacts/storage_handlers/multi_handler.py +5 -4
  77. wandb/sdk/artifacts/storage_handlers/s3_handler.py +10 -8
  78. wandb/sdk/artifacts/storage_handlers/tracking_handler.py +6 -4
  79. wandb/sdk/artifacts/storage_handlers/wb_artifact_handler.py +24 -21
  80. wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +4 -2
  81. wandb/sdk/artifacts/storage_policies/_multipart.py +187 -0
  82. wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +71 -242
  83. wandb/sdk/artifacts/storage_policy.py +25 -12
  84. wandb/sdk/data_types/bokeh.py +5 -1
  85. wandb/sdk/data_types/image.py +17 -6
  86. wandb/sdk/data_types/object_3d.py +67 -2
  87. wandb/sdk/interface/interface.py +31 -4
  88. wandb/sdk/interface/interface_queue.py +10 -0
  89. wandb/sdk/interface/interface_shared.py +0 -7
  90. wandb/sdk/interface/interface_sock.py +9 -3
  91. wandb/sdk/internal/_generated/__init__.py +2 -12
  92. wandb/sdk/internal/job_builder.py +27 -10
  93. wandb/sdk/internal/sender.py +5 -2
  94. wandb/sdk/internal/settings_static.py +2 -82
  95. wandb/sdk/launch/create_job.py +2 -1
  96. wandb/sdk/launch/runner/kubernetes_runner.py +25 -20
  97. wandb/sdk/launch/utils.py +82 -1
  98. wandb/sdk/lib/progress.py +8 -74
  99. wandb/sdk/lib/service/service_client.py +5 -9
  100. wandb/sdk/lib/service/service_connection.py +39 -23
  101. wandb/sdk/mailbox/mailbox_handle.py +2 -0
  102. wandb/sdk/projects/_generated/__init__.py +12 -33
  103. wandb/sdk/wandb_init.py +23 -3
  104. wandb/sdk/wandb_login.py +53 -27
  105. wandb/sdk/wandb_run.py +10 -5
  106. wandb/sdk/wandb_settings.py +63 -25
  107. wandb/sync/sync.py +7 -2
  108. wandb/util.py +1 -1
  109. {wandb-0.22.0.dist-info → wandb-0.22.2.dist-info}/METADATA +1 -1
  110. {wandb-0.22.0.dist-info → wandb-0.22.2.dist-info}/RECORD +113 -103
  111. wandb/sdk/artifacts/_graphql_fragments.py +0 -19
  112. {wandb-0.22.0.dist-info → wandb-0.22.2.dist-info}/WHEEL +0 -0
  113. {wandb-0.22.0.dist-info → wandb-0.22.2.dist-info}/entry_points.txt +0 -0
  114. {wandb-0.22.0.dist-info → wandb-0.22.2.dist-info}/licenses/LICENSE +0 -0
wandb/sdk/wandb_run.py CHANGED
@@ -33,6 +33,7 @@ from wandb.errors import CommError, UsageError
33
33
  from wandb.errors.links import url_registry
34
34
  from wandb.integration.torch import wandb_torch
35
35
  from wandb.plot import CustomChart, Visualize
36
+ from wandb.proto import wandb_internal_pb2 as pb
36
37
  from wandb.proto.wandb_deprecated import Deprecated
37
38
  from wandb.proto.wandb_internal_pb2 import (
38
39
  MetricRecord,
@@ -41,7 +42,6 @@ from wandb.proto.wandb_internal_pb2 import (
41
42
  RunRecord,
42
43
  )
43
44
  from wandb.sdk.artifacts._internal_artifact import InternalArtifact
44
- from wandb.sdk.artifacts._validators import is_artifact_registry_project
45
45
  from wandb.sdk.artifacts.artifact import Artifact
46
46
  from wandb.sdk.internal import job_builder
47
47
  from wandb.sdk.lib import asyncio_compat, wb_logging
@@ -2051,6 +2051,9 @@ class Run:
2051
2051
  When given an absolute path or glob and no `base_path`, one
2052
2052
  directory level is preserved as in the example above.
2053
2053
 
2054
+ Files are automatically deduplicated: calling `save()` multiple times
2055
+ on the same file without modifications will not re-upload it.
2056
+
2054
2057
  Args:
2055
2058
  glob_str: A relative or absolute path or Unix glob.
2056
2059
  base_path: A path to use to infer a directory structure; see examples.
@@ -2075,10 +2078,10 @@ class Run:
2075
2078
  run.save("these/are/myfiles/*", base_path="these")
2076
2079
  # => Saves files in an "are/myfiles/" folder in the run.
2077
2080
 
2078
- run.save("/User/username/Documents/run123/*.txt")
2081
+ run.save("/Users/username/Documents/run123/*.txt")
2079
2082
  # => Saves files in a "run123/" folder in the run. See note below.
2080
2083
 
2081
- run.save("/User/username/Documents/run123/*.txt", base_path="/User")
2084
+ run.save("/Users/username/Documents/run123/*.txt", base_path="/Users")
2082
2085
  # => Saves files in a "username/Documents/run123/" folder in the run.
2083
2086
 
2084
2087
  run.save("files/*/saveme.txt")
@@ -2698,7 +2701,9 @@ class Run:
2698
2701
  assert self._backend and self._backend.interface
2699
2702
 
2700
2703
  while True:
2701
- handle = self._backend.interface.deliver_poll_exit()
2704
+ handle = await self._backend.interface.deliver_async(
2705
+ pb.Record(request=pb.Request(poll_exit=pb.PollExitRequest()))
2706
+ )
2702
2707
 
2703
2708
  time_start = time.monotonic()
2704
2709
  last_result = await handle.wait_async(timeout=None)
@@ -3004,7 +3009,7 @@ class Run:
3004
3009
  # the target entity to the run's entity. Instead, delegate to
3005
3010
  # Artifact.link() to resolve the required org entity.
3006
3011
  target = ArtifactPath.from_str(target_path)
3007
- if not (target.project and is_artifact_registry_project(target.project)):
3012
+ if not target.is_registry_path():
3008
3013
  target = target.with_defaults(prefix=self.entity, project=self.project)
3009
3014
 
3010
3015
  return artifact.link(target.to_str(), aliases)
@@ -157,9 +157,12 @@ def _path_convert(*args: str) -> str:
157
157
 
158
158
 
159
159
  CLIENT_ONLY_SETTINGS = (
160
- "reinit",
160
+ "files_dir",
161
161
  "max_end_of_run_history_metrics",
162
162
  "max_end_of_run_summary_metrics",
163
+ "reinit",
164
+ "x_files_dir",
165
+ "x_sync_dir_suffix",
163
166
  )
164
167
  """Python-only keys that are not fields on the settings proto."""
165
168
 
@@ -238,20 +241,15 @@ class Settings(BaseModel, validate_assignment=True):
238
241
  """The type of console capture to be applied.
239
242
 
240
243
  Possible values are:
241
- "auto" - Automatically selects the console capture method based on the
244
+ - "auto" - Automatically selects the console capture method based on the
242
245
  system environment and settings.
243
-
244
- "off" - Disables console capture.
245
-
246
- "redirect" - Redirects low-level file descriptors for capturing output.
247
-
248
- "wrap" - Overrides the write methods of sys.stdout/sys.stderr. Will be
246
+ - "off" - Disables console capture.
247
+ - "redirect" - Redirects low-level file descriptors for capturing output.
248
+ - "wrap" - Overrides the write methods of sys.stdout/sys.stderr. Will be
249
249
  mapped to either "wrap_raw" or "wrap_emu" based on the state of the system.
250
-
251
- "wrap_raw" - Same as "wrap" but captures raw output directly instead of
250
+ - "wrap_raw" - Same as "wrap" but captures raw output directly instead of
252
251
  through an emulator. Derived from the `wrap` setting and should not be set manually.
253
-
254
- "wrap_emu" - Same as "wrap" but captures output through an emulator.
252
+ - "wrap_emu" - Same as "wrap" but captures output through an emulator.
255
253
  Derived from the `wrap` setting and should not be set manually.
256
254
  """
257
255
 
@@ -660,6 +658,9 @@ class Settings(BaseModel, validate_assignment=True):
660
658
  x_files_dir: Optional[str] = None
661
659
  """Override setting for the computed files_dir.
662
660
 
661
+ DEPRECATED, DO NOT USE. This private setting is not respected by wandb-core
662
+ but will continue to work for some legacy Python code.
663
+
663
664
  <!-- lazydoc-ignore-class-attributes -->
664
665
  """
665
666
 
@@ -941,6 +942,13 @@ class Settings(BaseModel, validate_assignment=True):
941
942
  <!-- lazydoc-ignore-class-attributes -->
942
943
  """
943
944
 
945
+ x_sync_dir_suffix: str = ""
946
+ """Suffix to add to the run's directory name (sync_dir).
947
+
948
+ This is set in wandb.init() to avoid naming conflicts.
949
+ If set, it is joined to the default name with a dash.
950
+ """
951
+
944
952
  x_update_finish_state: bool = True
945
953
  """Flag to indicate whether this process can update the run's final state on the server.
946
954
 
@@ -954,6 +962,8 @@ class Settings(BaseModel, validate_assignment=True):
954
962
  """Check if a private field is provided and assign to the corresponding public one.
955
963
 
956
964
  This is a compatibility layer to handle previous versions of the settings.
965
+
966
+ <!-- lazydoc-ignore: internal -->
957
967
  """
958
968
  new_values = {}
959
969
  for key in values:
@@ -988,6 +998,10 @@ class Settings(BaseModel, validate_assignment=True):
988
998
 
989
999
  @model_validator(mode="after")
990
1000
  def validate_skip_transaction_log(self):
1001
+ """Validate x_skip_transaction_log.
1002
+
1003
+ <!-- lazydoc-ignore: internal -->
1004
+ """
991
1005
  if self._offline and self.x_skip_transaction_log:
992
1006
  raise ValueError("Cannot skip transaction log in offline mode")
993
1007
  return self
@@ -1445,6 +1459,8 @@ class Settings(BaseModel, validate_assignment=True):
1445
1459
  - Converts single string values to tuple format
1446
1460
  - Preserves None values
1447
1461
 
1462
+ <!-- lazydoc-ignore-classmethod: internal -->
1463
+
1448
1464
  Args:
1449
1465
  value: A string, list, tuple, or None representing tags
1450
1466
 
@@ -1453,8 +1469,6 @@ class Settings(BaseModel, validate_assignment=True):
1453
1469
 
1454
1470
  Raises:
1455
1471
  ValueError: If any tag is empty or exceeds 64 characters
1456
-
1457
- <!-- lazydoc-ignore-classmethod: internal -->
1458
1472
  """
1459
1473
  if value is None:
1460
1474
  return None
@@ -1638,6 +1652,7 @@ class Settings(BaseModel, validate_assignment=True):
1638
1652
  @property
1639
1653
  def files_dir(self) -> str:
1640
1654
  """Absolute path to the local directory where the run's files are stored."""
1655
+ # Must match the logic in settings.go in the service process.
1641
1656
  return self.x_files_dir or _path_convert(self.sync_dir, "files")
1642
1657
 
1643
1658
  @computed_field # type: ignore[prop-decorator]
@@ -1733,10 +1748,12 @@ class Settings(BaseModel, validate_assignment=True):
1733
1748
  @property
1734
1749
  def sync_dir(self) -> str:
1735
1750
  """The directory for storing the run's files."""
1736
- return _path_convert(
1737
- self.wandb_dir,
1738
- f"{self.run_mode}-{self.timespec}-{self.run_id}",
1739
- )
1751
+ name = f"{self.run_mode}-{self.timespec}-{self.run_id}"
1752
+
1753
+ if self.x_sync_dir_suffix:
1754
+ name += f"-{self.x_sync_dir_suffix}"
1755
+
1756
+ return _path_convert(self.wandb_dir, name)
1740
1757
 
1741
1758
  @computed_field # type: ignore[prop-decorator]
1742
1759
  @property
@@ -1776,7 +1793,10 @@ class Settings(BaseModel, validate_assignment=True):
1776
1793
  # wandb/sdk/wandb_setup.py::_WandbSetup._settings_setup.
1777
1794
 
1778
1795
  def update_from_system_config_file(self):
1779
- """Update settings from the system config file."""
1796
+ """Update settings from the system config file.
1797
+
1798
+ <!-- lazydoc-ignore: internal -->
1799
+ """
1780
1800
  if not self.settings_system or not os.path.exists(self.settings_system):
1781
1801
  return
1782
1802
  for key, value in self._load_config_file(self.settings_system).items():
@@ -1784,7 +1804,10 @@ class Settings(BaseModel, validate_assignment=True):
1784
1804
  setattr(self, key, value)
1785
1805
 
1786
1806
  def update_from_workspace_config_file(self):
1787
- """Update settings from the workspace config file."""
1807
+ """Update settings from the workspace config file.
1808
+
1809
+ <!-- lazydoc-ignore: internal -->
1810
+ """
1788
1811
  if not self.settings_workspace or not os.path.exists(self.settings_workspace):
1789
1812
  return
1790
1813
  for key, value in self._load_config_file(self.settings_workspace).items():
@@ -1792,7 +1815,10 @@ class Settings(BaseModel, validate_assignment=True):
1792
1815
  setattr(self, key, value)
1793
1816
 
1794
1817
  def update_from_env_vars(self, environ: Dict[str, Any]):
1795
- """Update settings from environment variables."""
1818
+ """Update settings from environment variables.
1819
+
1820
+ <!-- lazydoc-ignore: internal -->
1821
+ """
1796
1822
  env_prefix: str = "WANDB_"
1797
1823
  private_env_prefix: str = env_prefix + "_"
1798
1824
  special_env_var_names = {
@@ -1829,7 +1855,10 @@ class Settings(BaseModel, validate_assignment=True):
1829
1855
  setattr(self, key, value)
1830
1856
 
1831
1857
  def update_from_system_environment(self):
1832
- """Update settings from the system environment."""
1858
+ """Update settings from the system environment.
1859
+
1860
+ <!-- lazydoc-ignore: internal -->
1861
+ """
1833
1862
  # For code saving, only allow env var override if value from server is true, or
1834
1863
  # if no preference was specified.
1835
1864
  if (self.save_code is True or self.save_code is None) and (
@@ -1909,13 +1938,19 @@ class Settings(BaseModel, validate_assignment=True):
1909
1938
  self.program = program
1910
1939
 
1911
1940
  def update_from_dict(self, settings: Dict[str, Any]) -> None:
1912
- """Update settings from a dictionary."""
1941
+ """Update settings from a dictionary.
1942
+
1943
+ <!-- lazydoc-ignore: internal -->
1944
+ """
1913
1945
  for key, value in dict(settings).items():
1914
1946
  if value is not None:
1915
1947
  setattr(self, key, value)
1916
1948
 
1917
1949
  def update_from_settings(self, settings: Settings) -> None:
1918
- """Update settings from another instance of `Settings`."""
1950
+ """Update settings from another instance of `Settings`.
1951
+
1952
+ <!-- lazydoc-ignore: internal -->
1953
+ """
1919
1954
  d = {field: getattr(settings, field) for field in settings.model_fields_set}
1920
1955
  if d:
1921
1956
  self.update_from_dict(d)
@@ -1923,7 +1958,10 @@ class Settings(BaseModel, validate_assignment=True):
1923
1958
  # Helper methods.
1924
1959
 
1925
1960
  def to_proto(self) -> wandb_settings_pb2.Settings:
1926
- """Generate a protobuf representation of the settings."""
1961
+ """Generate a protobuf representation of the settings.
1962
+
1963
+ <!-- lazydoc-ignore: internal -->
1964
+ """
1927
1965
  settings_proto = wandb_settings_pb2.Settings()
1928
1966
  for k, v in self.model_dump(exclude_none=True).items():
1929
1967
  if k in CLIENT_ONLY_SETTINGS:
wandb/sync/sync.py CHANGED
@@ -193,7 +193,7 @@ class SyncThread(threading.Thread):
193
193
  x_start_time=time.time(),
194
194
  )
195
195
 
196
- settings_static = SettingsStatic(settings.to_proto())
196
+ settings_static = SettingsStatic(dict(settings))
197
197
 
198
198
  handle_manager = handler.HandleManager(
199
199
  settings=settings_static,
@@ -207,7 +207,12 @@ class SyncThread(threading.Thread):
207
207
 
208
208
  filesystem.mkdir_exists_ok(settings.files_dir)
209
209
  send_manager.send_run(record, file_dir=settings.files_dir)
210
- watcher = tb_watcher.TBWatcher(settings, proto_run, new_interface, True)
210
+ watcher = tb_watcher.TBWatcher(
211
+ settings_static,
212
+ proto_run,
213
+ new_interface,
214
+ True,
215
+ )
211
216
 
212
217
  for tb in tb_logdirs:
213
218
  watcher.add(tb, True, tb_root)
wandb/util.py CHANGED
@@ -229,7 +229,7 @@ def import_module_lazy(name: str) -> types.ModuleType:
229
229
 
230
230
  def get_module(
231
231
  name: str,
232
- required: Optional[Union[str, bool]] = None,
232
+ required: Optional[str] = None,
233
233
  lazy: bool = True,
234
234
  ) -> Any:
235
235
  """Return module or None. Absolute import is required.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: wandb
3
- Version: 0.22.0
3
+ Version: 0.22.2
4
4
  Summary: A CLI and library for interacting with the Weights & Biases API.
5
5
  Project-URL: Source, https://github.com/wandb/wandb
6
6
  Project-URL: Bug Reports, https://github.com/wandb/wandb/issues