wandb 0.19.10__py3-none-win32.whl → 0.19.11__py3-none-win32.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 (91) hide show
  1. wandb/__init__.py +1 -1
  2. wandb/__init__.pyi +3 -3
  3. wandb/_pydantic/__init__.py +2 -3
  4. wandb/_pydantic/base.py +11 -31
  5. wandb/_pydantic/utils.py +8 -1
  6. wandb/_pydantic/v1_compat.py +3 -3
  7. wandb/apis/public/api.py +590 -22
  8. wandb/apis/public/artifacts.py +13 -5
  9. wandb/apis/public/automations.py +1 -1
  10. wandb/apis/public/integrations.py +22 -10
  11. wandb/apis/public/registries/__init__.py +0 -0
  12. wandb/apis/public/registries/_freezable_list.py +179 -0
  13. wandb/apis/public/{registries.py → registries/registries_search.py} +22 -129
  14. wandb/apis/public/registries/registry.py +357 -0
  15. wandb/apis/public/registries/utils.py +140 -0
  16. wandb/apis/public/runs.py +58 -56
  17. wandb/automations/__init__.py +16 -24
  18. wandb/automations/_filters/expressions.py +12 -10
  19. wandb/automations/_filters/operators.py +10 -19
  20. wandb/automations/_filters/run_metrics.py +231 -82
  21. wandb/automations/_generated/__init__.py +27 -34
  22. wandb/automations/_generated/create_automation.py +17 -0
  23. wandb/automations/_generated/delete_automation.py +17 -0
  24. wandb/automations/_generated/fragments.py +40 -25
  25. wandb/automations/_generated/{get_triggers.py → get_automations.py} +5 -5
  26. wandb/automations/_generated/get_automations_by_entity.py +26 -0
  27. wandb/automations/_generated/operations.py +35 -98
  28. wandb/automations/_generated/update_automation.py +17 -0
  29. wandb/automations/_utils.py +178 -64
  30. wandb/automations/_validators.py +94 -2
  31. wandb/automations/actions.py +113 -98
  32. wandb/automations/automations.py +47 -69
  33. wandb/automations/events.py +139 -87
  34. wandb/automations/integrations.py +23 -4
  35. wandb/automations/scopes.py +22 -20
  36. wandb/bin/gpu_stats.exe +0 -0
  37. wandb/bin/wandb-core +0 -0
  38. wandb/env.py +11 -0
  39. wandb/old/settings.py +4 -1
  40. wandb/proto/v3/wandb_internal_pb2.py +240 -236
  41. wandb/proto/v3/wandb_telemetry_pb2.py +10 -10
  42. wandb/proto/v4/wandb_internal_pb2.py +236 -236
  43. wandb/proto/v4/wandb_telemetry_pb2.py +10 -10
  44. wandb/proto/v5/wandb_internal_pb2.py +236 -236
  45. wandb/proto/v5/wandb_telemetry_pb2.py +10 -10
  46. wandb/proto/v6/wandb_internal_pb2.py +236 -236
  47. wandb/proto/v6/wandb_telemetry_pb2.py +10 -10
  48. wandb/sdk/artifacts/_generated/__init__.py +42 -1
  49. wandb/sdk/artifacts/_generated/add_aliases.py +21 -0
  50. wandb/sdk/artifacts/_generated/delete_aliases.py +21 -0
  51. wandb/sdk/artifacts/_generated/fetch_linked_artifacts.py +67 -0
  52. wandb/sdk/artifacts/_generated/fragments.py +35 -0
  53. wandb/sdk/artifacts/_generated/input_types.py +12 -0
  54. wandb/sdk/artifacts/_generated/operations.py +101 -0
  55. wandb/sdk/artifacts/_generated/update_artifact.py +26 -0
  56. wandb/sdk/artifacts/_graphql_fragments.py +1 -0
  57. wandb/sdk/artifacts/_validators.py +120 -1
  58. wandb/sdk/artifacts/artifact.py +380 -203
  59. wandb/sdk/artifacts/artifact_file_cache.py +4 -6
  60. wandb/sdk/artifacts/artifact_manifest_entry.py +11 -2
  61. wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +182 -1
  62. wandb/sdk/artifacts/storage_policy.py +3 -0
  63. wandb/sdk/data_types/video.py +46 -32
  64. wandb/sdk/interface/interface.py +2 -3
  65. wandb/sdk/internal/internal_api.py +21 -31
  66. wandb/sdk/internal/sender.py +5 -2
  67. wandb/sdk/launch/sweeps/utils.py +8 -0
  68. wandb/sdk/projects/_generated/__init__.py +47 -0
  69. wandb/sdk/projects/_generated/delete_project.py +22 -0
  70. wandb/sdk/projects/_generated/enums.py +4 -0
  71. wandb/sdk/projects/_generated/fetch_registry.py +22 -0
  72. wandb/sdk/projects/_generated/fragments.py +41 -0
  73. wandb/sdk/projects/_generated/input_types.py +13 -0
  74. wandb/sdk/projects/_generated/operations.py +88 -0
  75. wandb/sdk/projects/_generated/rename_project.py +27 -0
  76. wandb/sdk/projects/_generated/upsert_registry_project.py +27 -0
  77. wandb/sdk/service/service.py +9 -1
  78. wandb/sdk/wandb_init.py +32 -5
  79. wandb/sdk/wandb_run.py +37 -9
  80. wandb/sdk/wandb_settings.py +6 -7
  81. wandb/sdk/wandb_setup.py +12 -0
  82. wandb/util.py +7 -3
  83. {wandb-0.19.10.dist-info → wandb-0.19.11.dist-info}/METADATA +1 -1
  84. {wandb-0.19.10.dist-info → wandb-0.19.11.dist-info}/RECORD +87 -70
  85. wandb/automations/_generated/create_filter_trigger.py +0 -21
  86. wandb/automations/_generated/delete_trigger.py +0 -19
  87. wandb/automations/_generated/get_triggers_by_entity.py +0 -24
  88. wandb/automations/_generated/update_filter_trigger.py +0 -21
  89. {wandb-0.19.10.dist-info → wandb-0.19.11.dist-info}/WHEEL +0 -0
  90. {wandb-0.19.10.dist-info → wandb-0.19.11.dist-info}/entry_points.txt +0 -0
  91. {wandb-0.19.10.dist-info → wandb-0.19.11.dist-info}/licenses/LICENSE +0 -0
@@ -3,9 +3,14 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import re
6
+ from dataclasses import dataclass, field
6
7
  from functools import wraps
7
- from typing import TYPE_CHECKING, Any, Callable, TypeVar, cast, overload
8
+ from typing import TYPE_CHECKING, Any, Callable, Literal, TypeVar, cast, overload
8
9
 
10
+ from wandb.sdk.artifacts._generated.fragments import (
11
+ ArtifactPortfolioTypeFields,
12
+ ArtifactSequenceTypeFields,
13
+ )
9
14
  from wandb.sdk.artifacts.exceptions import (
10
15
  ArtifactFinalizedError,
11
16
  ArtifactNotLoggedError,
@@ -24,6 +29,41 @@ if TYPE_CHECKING:
24
29
  REGISTRY_PREFIX: Final[str] = "wandb-registry-"
25
30
  MAX_ARTIFACT_METADATA_KEYS: Final[int] = 100
26
31
 
32
+ ARTIFACT_NAME_MAXLEN: Final[int] = 128
33
+ ARTIFACT_NAME_INVALID_CHARS: Final[frozenset[str]] = frozenset({"/"})
34
+
35
+ LINKED_ARTIFACT_COLLECTION_TYPE: Final[str] = ArtifactPortfolioTypeFields.model_fields[
36
+ "typename__"
37
+ ].default
38
+ SOURCE_ARTIFACT_COLLECTION_TYPE: Final[str] = ArtifactSequenceTypeFields.model_fields[
39
+ "typename__"
40
+ ].default
41
+
42
+
43
+ @dataclass
44
+ class _LinkArtifactFields:
45
+ """Keep this list updated with fields where the linked artifact and the source artifact differ."""
46
+
47
+ entity_name: str
48
+ project_name: str
49
+ name: str
50
+ version: str
51
+ aliases: list[str]
52
+
53
+ # These fields shouldn't be set as they should always be
54
+ # these values for a linked artifact
55
+ # These fields shouldn't be set by the user as they should always be these values for a linked artifact
56
+ _is_link: Literal[True] = field(init=False, default=True)
57
+ _linked_artifacts: list[Artifact] = field(init=False, default_factory=list)
58
+
59
+ @property
60
+ def is_link(self) -> bool:
61
+ return self._is_link
62
+
63
+ @property
64
+ def linked_artifacts(self) -> list[Artifact]:
65
+ return self._linked_artifacts
66
+
27
67
 
28
68
  # For mypy checks
29
69
  @overload
@@ -43,6 +83,69 @@ def always_list(obj: Any, base_type: Any = (str, bytes)) -> list[T]:
43
83
  return [obj] if isinstance(obj, base_type) else list(obj)
44
84
 
45
85
 
86
+ def validate_artifact_name(name: str) -> str:
87
+ """Validate the artifact name, returning it if successful.
88
+
89
+ Raises:
90
+ ValueError: If the artifact name is invalid.
91
+ """
92
+ if len(name) > ARTIFACT_NAME_MAXLEN:
93
+ short_name = f"{name[:ARTIFACT_NAME_MAXLEN]} ..."
94
+ raise ValueError(
95
+ f"Artifact name is longer than {ARTIFACT_NAME_MAXLEN} characters: {short_name!r}"
96
+ )
97
+
98
+ if ARTIFACT_NAME_INVALID_CHARS.intersection(name):
99
+ raise ValueError(
100
+ "Artifact names must not contain any of the following characters: "
101
+ f"{', '.join(sorted(ARTIFACT_NAME_INVALID_CHARS))}. Got: {name!r}"
102
+ )
103
+
104
+ return name
105
+
106
+
107
+ INVALID_URL_CHARACTERS = ("/", "\\", "#", "?", "%", ":", "\r", "\n")
108
+
109
+
110
+ def validate_project_name(name: str) -> None:
111
+ """Validates a project name according to W&B rules.
112
+
113
+ Args:
114
+ name: The project name string.
115
+
116
+ Raises:
117
+ ValueError: If the name is invalid (too long or contains invalid characters).
118
+ """
119
+ max_len = 128
120
+
121
+ if len(name) == 0:
122
+ raise ValueError("Project name cannot be empty")
123
+
124
+ registry_name = ""
125
+ if name.startswith(REGISTRY_PREFIX):
126
+ registry_name = name[len(REGISTRY_PREFIX) :]
127
+ if len(registry_name) == 0:
128
+ raise ValueError("Registry name cannot be empty")
129
+
130
+ if len(name) > max_len:
131
+ if registry_name:
132
+ raise ValueError(
133
+ f"Invalid registry name {registry_name!r}, must be {max_len - len(REGISTRY_PREFIX)} characters or less"
134
+ )
135
+ else:
136
+ raise ValueError(
137
+ f"Invalid project name {name!r}, must be {max_len} characters or less"
138
+ )
139
+
140
+ # Find the first occurrence of any invalid character
141
+ if invalid_chars := set(INVALID_URL_CHARACTERS).intersection(name):
142
+ error_name = registry_name or name
143
+ invalid_chars_repr = ", ".join(sorted(map(repr, invalid_chars)))
144
+ raise ValueError(
145
+ f"Invalid project/registry name {error_name!r}, cannot contain characters: {invalid_chars_repr!s}"
146
+ )
147
+
148
+
46
149
  def validate_aliases(aliases: Collection[str] | str) -> list[str]:
47
150
  """Validate the artifact aliases and return them as a list.
48
151
 
@@ -59,6 +162,22 @@ def validate_aliases(aliases: Collection[str] | str) -> list[str]:
59
162
  return aliases_list
60
163
 
61
164
 
165
+ def validate_artifact_types_list(artifact_types: list[str]) -> list[str]:
166
+ """Return True if the artifact types list is valid, False otherwise."""
167
+ artifact_types = always_list(artifact_types)
168
+ invalid_chars = ("/", ":")
169
+ if any(
170
+ char in type or len(type) > 128
171
+ for type in artifact_types
172
+ for char in invalid_chars
173
+ ):
174
+ raise ValueError(
175
+ f"""Artifact types must not contain any of the following characters: {", ".join(invalid_chars)}
176
+ and must be less than equal to 128 characters"""
177
+ )
178
+ return artifact_types
179
+
180
+
62
181
  _VALID_TAG_PATTERN: re.Pattern[str] = re.compile(r"^[-\w]+( +[-\w]+)*$")
63
182
 
64
183