wandb 0.19.9__py3-none-win_amd64.whl → 0.19.10__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 (128) hide show
  1. wandb/__init__.py +1 -1
  2. wandb/__init__.pyi +4 -1
  3. wandb/_pydantic/__init__.py +14 -7
  4. wandb/_pydantic/base.py +44 -9
  5. wandb/_pydantic/utils.py +66 -0
  6. wandb/_pydantic/v1_compat.py +78 -56
  7. wandb/apis/public/__init__.py +2 -2
  8. wandb/apis/public/api.py +114 -2
  9. wandb/apis/public/artifacts.py +365 -673
  10. wandb/apis/public/automations.py +69 -0
  11. wandb/apis/public/integrations.py +168 -0
  12. wandb/apis/public/projects.py +29 -0
  13. wandb/apis/public/utils.py +107 -1
  14. wandb/automations/__init__.py +81 -0
  15. wandb/automations/_filters/__init__.py +40 -0
  16. wandb/automations/_filters/expressions.py +179 -0
  17. wandb/automations/_filters/operators.py +267 -0
  18. wandb/automations/_filters/run_metrics.py +183 -0
  19. wandb/automations/_generated/__init__.py +184 -0
  20. wandb/automations/_generated/create_filter_trigger.py +21 -0
  21. wandb/automations/_generated/create_generic_webhook_integration.py +43 -0
  22. wandb/automations/_generated/delete_trigger.py +19 -0
  23. wandb/automations/_generated/enums.py +33 -0
  24. wandb/automations/_generated/fragments.py +343 -0
  25. wandb/automations/_generated/generic_webhook_integrations_by_entity.py +22 -0
  26. wandb/automations/_generated/get_triggers.py +24 -0
  27. wandb/automations/_generated/get_triggers_by_entity.py +24 -0
  28. wandb/automations/_generated/input_types.py +104 -0
  29. wandb/automations/_generated/integrations_by_entity.py +22 -0
  30. wandb/automations/_generated/operations.py +710 -0
  31. wandb/automations/_generated/slack_integrations_by_entity.py +22 -0
  32. wandb/automations/_generated/update_filter_trigger.py +21 -0
  33. wandb/automations/_utils.py +123 -0
  34. wandb/automations/_validators.py +73 -0
  35. wandb/automations/actions.py +205 -0
  36. wandb/automations/automations.py +109 -0
  37. wandb/automations/events.py +235 -0
  38. wandb/automations/integrations.py +26 -0
  39. wandb/automations/scopes.py +76 -0
  40. wandb/beta/workflows.py +9 -10
  41. wandb/bin/gpu_stats.exe +0 -0
  42. wandb/bin/wandb-core +0 -0
  43. wandb/cli/cli.py +3 -3
  44. wandb/integration/keras/keras.py +2 -1
  45. wandb/integration/langchain/wandb_tracer.py +2 -1
  46. wandb/jupyter.py +137 -118
  47. wandb/old/summary.py +0 -2
  48. wandb/proto/v3/wandb_internal_pb2.py +293 -292
  49. wandb/proto/v3/wandb_settings_pb2.py +2 -2
  50. wandb/proto/v3/wandb_telemetry_pb2.py +10 -10
  51. wandb/proto/v4/wandb_internal_pb2.py +292 -292
  52. wandb/proto/v4/wandb_settings_pb2.py +2 -2
  53. wandb/proto/v4/wandb_telemetry_pb2.py +10 -10
  54. wandb/proto/v5/wandb_internal_pb2.py +292 -292
  55. wandb/proto/v5/wandb_settings_pb2.py +2 -2
  56. wandb/proto/v5/wandb_telemetry_pb2.py +10 -10
  57. wandb/proto/v6/wandb_base_pb2.py +41 -0
  58. wandb/proto/v6/wandb_internal_pb2.py +393 -0
  59. wandb/proto/v6/wandb_server_pb2.py +78 -0
  60. wandb/proto/v6/wandb_settings_pb2.py +58 -0
  61. wandb/proto/v6/wandb_telemetry_pb2.py +52 -0
  62. wandb/proto/wandb_base_pb2.py +2 -0
  63. wandb/proto/wandb_deprecated.py +8 -0
  64. wandb/proto/wandb_internal_pb2.py +3 -1
  65. wandb/proto/wandb_server_pb2.py +2 -0
  66. wandb/proto/wandb_settings_pb2.py +2 -0
  67. wandb/proto/wandb_telemetry_pb2.py +2 -0
  68. wandb/sdk/artifacts/_generated/__init__.py +248 -0
  69. wandb/sdk/artifacts/_generated/artifact_collection_membership_files.py +43 -0
  70. wandb/sdk/artifacts/_generated/artifact_version_files.py +36 -0
  71. wandb/sdk/artifacts/_generated/create_artifact_collection_tag_assignments.py +36 -0
  72. wandb/sdk/artifacts/_generated/delete_artifact_collection_tag_assignments.py +25 -0
  73. wandb/sdk/artifacts/_generated/delete_artifact_portfolio.py +35 -0
  74. wandb/sdk/artifacts/_generated/delete_artifact_sequence.py +35 -0
  75. wandb/sdk/artifacts/_generated/enums.py +17 -0
  76. wandb/sdk/artifacts/_generated/fragments.py +186 -0
  77. wandb/sdk/artifacts/_generated/input_types.py +16 -0
  78. wandb/sdk/artifacts/_generated/move_artifact_collection.py +35 -0
  79. wandb/sdk/artifacts/_generated/operations.py +510 -0
  80. wandb/sdk/artifacts/_generated/project_artifact_collection.py +101 -0
  81. wandb/sdk/artifacts/_generated/project_artifact_collections.py +33 -0
  82. wandb/sdk/artifacts/_generated/project_artifact_type.py +24 -0
  83. wandb/sdk/artifacts/_generated/project_artifact_types.py +24 -0
  84. wandb/sdk/artifacts/_generated/project_artifacts.py +42 -0
  85. wandb/sdk/artifacts/_generated/run_input_artifacts.py +51 -0
  86. wandb/sdk/artifacts/_generated/run_output_artifacts.py +51 -0
  87. wandb/sdk/artifacts/_generated/update_artifact_portfolio.py +35 -0
  88. wandb/sdk/artifacts/_generated/update_artifact_sequence.py +35 -0
  89. wandb/sdk/artifacts/_graphql_fragments.py +56 -79
  90. wandb/sdk/artifacts/artifact.py +40 -13
  91. wandb/sdk/artifacts/artifact_manifest_entry.py +2 -1
  92. wandb/sdk/artifacts/storage_handlers/azure_handler.py +1 -0
  93. wandb/sdk/data_types/base_types/media.py +2 -3
  94. wandb/sdk/data_types/base_types/wb_value.py +34 -11
  95. wandb/sdk/data_types/html.py +36 -9
  96. wandb/sdk/data_types/image.py +12 -12
  97. wandb/sdk/data_types/table.py +5 -0
  98. wandb/sdk/data_types/trace_tree.py +2 -0
  99. wandb/sdk/data_types/utils.py +1 -1
  100. wandb/sdk/data_types/video.py +14 -26
  101. wandb/sdk/interface/interface.py +2 -0
  102. wandb/sdk/internal/profiler.py +6 -5
  103. wandb/sdk/internal/run.py +13 -6
  104. wandb/sdk/lib/apikey.py +25 -4
  105. wandb/sdk/lib/asyncio_compat.py +1 -1
  106. wandb/sdk/lib/deprecate.py +13 -22
  107. wandb/sdk/lib/disabled.py +2 -1
  108. wandb/sdk/lib/printer.py +37 -8
  109. wandb/sdk/lib/printer_asyncio.py +46 -0
  110. wandb/sdk/lib/redirect.py +10 -5
  111. wandb/sdk/service/server_sock.py +19 -14
  112. wandb/sdk/service/service.py +9 -7
  113. wandb/sdk/service/streams.py +5 -0
  114. wandb/sdk/verify/verify.py +6 -3
  115. wandb/sdk/wandb_init.py +185 -65
  116. wandb/sdk/wandb_login.py +13 -4
  117. wandb/sdk/wandb_run.py +382 -286
  118. wandb/sdk/wandb_settings.py +21 -3
  119. wandb/sdk/wandb_setup.py +49 -0
  120. wandb/util.py +29 -29
  121. {wandb-0.19.9.dist-info → wandb-0.19.10.dist-info}/METADATA +5 -5
  122. {wandb-0.19.9.dist-info → wandb-0.19.10.dist-info}/RECORD +125 -72
  123. wandb/_globals.py +0 -19
  124. wandb/sdk/internal/_generated/base.py +0 -226
  125. wandb/sdk/internal/_generated/typing_compat.py +0 -14
  126. {wandb-0.19.9.dist-info → wandb-0.19.10.dist-info}/WHEEL +0 -0
  127. {wandb-0.19.9.dist-info → wandb-0.19.10.dist-info}/entry_points.txt +0 -0
  128. {wandb-0.19.9.dist-info → wandb-0.19.10.dist-info}/licenses/LICENSE +0 -0
@@ -246,7 +246,7 @@ class Settings(BaseModel, validate_assignment=True):
246
246
 
247
247
  "wrap_emu" - Same as "wrap" but captures output through an emulator.
248
248
  Derived from the `wrap` setting and should not be set manually.
249
- """
249
+ """
250
250
 
251
251
  console_multipart: bool = False
252
252
  """Whether to produce multipart console log files."""
@@ -376,6 +376,7 @@ class Settings(BaseModel, validate_assignment=True):
376
376
  "default",
377
377
  "return_previous",
378
378
  "finish_previous",
379
+ "create_new",
379
380
  ],
380
381
  bool,
381
382
  ] = "default"
@@ -384,8 +385,14 @@ class Settings(BaseModel, validate_assignment=True):
384
385
  Options:
385
386
  - "default": Use "finish_previous" in notebooks and "return_previous"
386
387
  otherwise.
387
- - "return_previous": Return the active run.
388
- - "finish_previous": Finish the active run, then return a new one.
388
+ - "return_previous": Return the most recently created run
389
+ that is not yet finished. This does not update `wandb.run`; see
390
+ the "create_new" option.
391
+ - "finish_previous": Finish all active runs, then return a new run.
392
+ - "create_new": Create a new run without modifying other active runs.
393
+ Does not update `wandb.run` and top-level functions like `wandb.log`.
394
+ Because of this, some older integrations that rely on the global run
395
+ will not work.
389
396
 
390
397
  Can also be a boolean, but this is deprecated. False is the same as
391
398
  "return_previous", and True is the same as "finish_previous".
@@ -689,6 +696,12 @@ class Settings(BaseModel, validate_assignment=True):
689
696
  This does not disable user-provided summary updates.
690
697
  """
691
698
 
699
+ x_server_side_expand_glob_metrics: bool = False
700
+ """Flag to delegate glob matching of metrics in define_metric to the server.
701
+
702
+ If the server does not support this, the client will perform the glob matching.
703
+ """
704
+
692
705
  x_service_transport: Optional[str] = None
693
706
  """Transport method for communication with the wandb service."""
694
707
 
@@ -1662,6 +1675,11 @@ class Settings(BaseModel, validate_assignment=True):
1662
1675
  if not root:
1663
1676
  return None
1664
1677
 
1678
+ # For windows if the root and program are on different drives,
1679
+ # os.path.relpath will raise a ValueError.
1680
+ if not util.are_paths_on_same_drive(root, program):
1681
+ return None
1682
+
1665
1683
  full_path_to_program = os.path.join(
1666
1684
  root, os.path.relpath(os.getcwd(), root), program
1667
1685
  )
wandb/sdk/wandb_setup.py CHANGED
@@ -27,6 +27,7 @@ from . import wandb_settings
27
27
  from .lib import config_util, server
28
28
 
29
29
  if TYPE_CHECKING:
30
+ from wandb.sdk import wandb_run
30
31
  from wandb.sdk.lib.service_connection import ServiceConnection
31
32
  from wandb.sdk.wandb_settings import Settings
32
33
 
@@ -83,6 +84,8 @@ class _WandbSetup:
83
84
  ) -> None:
84
85
  self._connection: ServiceConnection | None = None
85
86
 
87
+ self._active_runs: list[wandb_run.Run] = []
88
+
86
89
  self._environ = environ or dict(os.environ)
87
90
  self._sweep_config: dict | None = None
88
91
  self._config: dict | None = None
@@ -100,6 +103,52 @@ class _WandbSetup:
100
103
  self._check()
101
104
  self._setup()
102
105
 
106
+ def add_active_run(self, run: wandb_run.Run) -> None:
107
+ """Append a run to the active runs list.
108
+
109
+ This must be called when a run is initialized.
110
+
111
+ Args:
112
+ run: A newly initialized run.
113
+ """
114
+ if run not in self._active_runs:
115
+ self._active_runs.append(run)
116
+
117
+ def remove_active_run(self, run: wandb_run.Run) -> None:
118
+ """Remove the run from the active runs list.
119
+
120
+ This must be called when a run is finished.
121
+
122
+ Args:
123
+ run: A run that is finished or crashed.
124
+ """
125
+ try:
126
+ self._active_runs.remove(run)
127
+ except ValueError:
128
+ pass # Removing a run multiple times is not an error.
129
+
130
+ @property
131
+ def most_recent_active_run(self) -> wandb_run.Run | None:
132
+ """The most recently initialized run that is not yet finished."""
133
+ if not self._active_runs:
134
+ return None
135
+
136
+ return self._active_runs[-1]
137
+
138
+ def finish_all_active_runs(self) -> None:
139
+ """Finish all unfinished runs.
140
+
141
+ NOTE: This is slightly inefficient as it finishes runs one at a time.
142
+ This only exists to support using the `reinit="finish_previous"`
143
+ setting together with `reinit="create_new"` which does not seem to be a
144
+ useful pattern. Since `"create_new"` should eventually become the
145
+ default and only behavior, it does not seem worth optimizing.
146
+ """
147
+ # Take a snapshot as each call to `finish()` modifies `_active_runs`.
148
+ runs_copy = list(self._active_runs)
149
+ for run in runs_copy:
150
+ run.finish()
151
+
103
152
  def _settings_setup(
104
153
  self,
105
154
  settings: Settings | None,
wandb/util.py CHANGED
@@ -51,6 +51,11 @@ from typing import (
51
51
  Union,
52
52
  )
53
53
 
54
+ if sys.version_info < (3, 10):
55
+ from typing_extensions import TypeGuard
56
+ else:
57
+ from typing import TypeGuard
58
+
54
59
  import requests
55
60
  import yaml
56
61
 
@@ -184,6 +189,13 @@ class LazyModuleState:
184
189
  self.module.__spec__.loader.exec_module(self.module)
185
190
  self.module.__class__ = types.ModuleType
186
191
 
192
+ # Set the submodule as an attribute on the parent module
193
+ # This enables access to the submodule via normal attribute access.
194
+ parent, _, child = self.module.__name__.rpartition(".")
195
+ if parent:
196
+ parent_module = sys.modules[parent]
197
+ setattr(parent_module, child, self.module)
198
+
187
199
 
188
200
  class LazyModule(types.ModuleType):
189
201
  def __getattribute__(self, name: str) -> Any:
@@ -1060,18 +1072,6 @@ def has_num(dictionary: Mapping, key: Any) -> bool:
1060
1072
  return key in dictionary and isinstance(dictionary[key], numbers.Number)
1061
1073
 
1062
1074
 
1063
- def get_log_file_path() -> str:
1064
- """Log file path used in error messages.
1065
-
1066
- It would probably be better if this pointed to a log file in a
1067
- run directory.
1068
- """
1069
- # TODO(jhr, cvp): refactor
1070
- if wandb.run is not None:
1071
- return wandb.run._settings.log_internal
1072
- return os.path.join("wandb", "debug-internal.log")
1073
-
1074
-
1075
1075
  def docker_image_regex(image: str) -> Any:
1076
1076
  """Regex match for valid docker image names."""
1077
1077
  if image:
@@ -1438,6 +1438,20 @@ def auto_project_name(program: Optional[str]) -> str:
1438
1438
  return str(project.replace(os.sep, "_"))
1439
1439
 
1440
1440
 
1441
+ def are_paths_on_same_drive(path1: str, path2: str) -> bool:
1442
+ """Check if two paths are on the same drive.
1443
+
1444
+ This check is only relevant on Windows,
1445
+ since the concept of drives only exists on Windows.
1446
+ """
1447
+ if platform.system() != "Windows":
1448
+ return True
1449
+
1450
+ path1_drive = pathlib.Path(path1).resolve().drive
1451
+ path2_drive = pathlib.Path(path2).resolve().drive
1452
+ return path1_drive == path2_drive
1453
+
1454
+
1441
1455
  # TODO(hugh): Deprecate version here and use wandb/sdk/lib/paths.py
1442
1456
  def to_forward_slash_path(path: str) -> str:
1443
1457
  if platform.system() == "Windows":
@@ -1698,15 +1712,15 @@ def _resolve_aliases(aliases: Optional[Union[str, Iterable[str]]]) -> List[str]:
1698
1712
  raise ValueError("`aliases` must be Iterable or None") from exc
1699
1713
 
1700
1714
 
1701
- def _is_artifact_object(v: Any) -> bool:
1715
+ def _is_artifact_object(v: Any) -> "TypeGuard[wandb.Artifact]":
1702
1716
  return isinstance(v, wandb.Artifact)
1703
1717
 
1704
1718
 
1705
- def _is_artifact_string(v: Any) -> bool:
1719
+ def _is_artifact_string(v: Any) -> "TypeGuard[str]":
1706
1720
  return isinstance(v, str) and v.startswith("wandb-artifact://")
1707
1721
 
1708
1722
 
1709
- def _is_artifact_version_weave_dict(v: Any) -> bool:
1723
+ def _is_artifact_version_weave_dict(v: Any) -> "TypeGuard[dict]":
1710
1724
  return isinstance(v, dict) and v.get("_type") == "artifactVersion"
1711
1725
 
1712
1726
 
@@ -1750,20 +1764,6 @@ def _get_max_cli_version() -> Union[str, None]:
1750
1764
  return str(max_cli_version) if max_cli_version is not None else None
1751
1765
 
1752
1766
 
1753
- def _is_offline() -> bool:
1754
- """Returns true if wandb is configured to be offline.
1755
-
1756
- If there is an active run, returns whether the run is offline.
1757
- Otherwise, returns the default mode, which is affected by explicit settings
1758
- passed to `wandb.setup()`, environment variables, and W&B configuration
1759
- files.
1760
- """
1761
- if wandb.run:
1762
- return wandb.run.settings._offline
1763
- else:
1764
- return wandb.setup().settings._offline
1765
-
1766
-
1767
1767
  def ensure_text(
1768
1768
  string: Union[str, bytes], encoding: str = "utf-8", errors: str = "strict"
1769
1769
  ) -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: wandb
3
- Version: 0.19.9
3
+ Version: 0.19.10
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
@@ -52,10 +52,10 @@ Requires-Dist: docker-pycreds>=0.4.0
52
52
  Requires-Dist: eval-type-backport; python_version < '3.10'
53
53
  Requires-Dist: gitpython!=3.1.29,>=1.0.0
54
54
  Requires-Dist: platformdirs
55
- Requires-Dist: protobuf!=4.21.0,!=5.28.0,<6,>=3.12.0; python_version < '3.9' and sys_platform == 'linux'
56
- Requires-Dist: protobuf!=4.21.0,!=5.28.0,<6,>=3.15.0; python_version == '3.9' and sys_platform == 'linux'
57
- Requires-Dist: protobuf!=4.21.0,!=5.28.0,<6,>=3.19.0; python_version > '3.9' and sys_platform == 'linux'
58
- Requires-Dist: protobuf!=4.21.0,!=5.28.0,<6,>=3.19.0; sys_platform != 'linux'
55
+ Requires-Dist: protobuf!=4.21.0,!=5.28.0,<7,>=3.12.0; python_version < '3.9' and sys_platform == 'linux'
56
+ Requires-Dist: protobuf!=4.21.0,!=5.28.0,<7,>=3.15.0; python_version == '3.9' and sys_platform == 'linux'
57
+ Requires-Dist: protobuf!=4.21.0,!=5.28.0,<7,>=3.19.0; python_version > '3.9' and sys_platform == 'linux'
58
+ Requires-Dist: protobuf!=4.21.0,!=5.28.0,<7,>=3.19.0; sys_platform != 'linux'
59
59
  Requires-Dist: psutil>=5.0.0
60
60
  Requires-Dist: pydantic<3
61
61
  Requires-Dist: pyyaml