repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
wandb
wandb/sdk/lib/timer.py
.py
import time from typing import Any from typing_extensions import Self class Timer: def __init__(self) -> None: self.start_time: float = time.time() self.start: float = time.perf_counter() self.stop: float = self.start def __enter__(self) -> Self: return self def __exit__...
22
473
wandb
wandb/sdk/lib/config_util.py
.py
from __future__ import annotations import json import logging import os from typing import Any import wandb from wandb.errors import Error from wandb.util import load_yaml from . import filesystem logger = logging.getLogger("wandb") class ConfigError(Error): pass def dict_from_proto_list(obj_list): d = ...
106
2,931
wandb
wandb/sdk/lib/retry.py
.py
from __future__ import annotations import abc import asyncio import datetime import functools import logging import os import random import threading import time from collections.abc import Awaitable, Callable from typing import Any, Generic, TypeVar import wandb import wandb.errors from wandb.util import CheckRetryF...
378
12,328
wandb
wandb/sdk/lib/sparkline.py
.py
# # From pysparklines (BSD License): https://pypi.python.org/pypi/pysparklines from __future__ import annotations import math spark_chars = "β–β–‚β–ƒβ–„β–…β–†β–‡β–ˆ" # math.isfinite doesn't exist in python2, so provider our own def isfinite(f): return not (math.isinf(f) or math.isnan(f)) def sparkify(series: list[float | in...
45
1,361
wandb
wandb/sdk/lib/paths.py
.py
from __future__ import annotations import os import platform from functools import wraps from pathlib import PurePath, PurePosixPath from typing import Any, TypeAlias, Union # Path _inputs_ should generally accept any kind of path. This is named the same and # modeled after the hint defined in the Python standard lib...
107
4,535
wandb
wandb/sdk/lib/filenames.py
.py
from __future__ import annotations import os from collections.abc import Callable, Generator WANDB_DIRS = ("wandb", ".wandb") CONFIG_FNAME = "config.yaml" OUTPUT_FNAME = "output.log" DIFF_FNAME = "diff.patch" SUMMARY_FNAME = "wandb-summary.json" METADATA_FNAME = "wandb-metadata.json" REQUIREMENTS_FNAME = "requiremen...
65
1,938
wandb
wandb/sdk/lib/ipython.py
.py
from __future__ import annotations import logging import sys import warnings from typing import Literal import wandb PythonType = Literal["python", "ipython", "jupyter"] logger = logging.getLogger(__name__) def toggle_button(what="run"): """Returns the HTML for a button used to reveal the element following it...
144
4,260
wandb
wandb/sdk/lib/preinit.py
.py
from __future__ import annotations from collections.abc import Callable from typing import Any import wandb class PreInitObject: def __init__(self, name: str, destination: Any | None = None) -> None: self._name = name if destination is not None: self.__doc__ = destination.__doc__ ...
46
1,497
wandb
wandb/sdk/lib/settings_file.py
.py
"""Reading and writing W&B settings files. There is usually a "global" settings file at ~/.config/wandb/settings. A "local" settings file, also referred to as "workspace settings", is created by the `wandb init` CLI command at ./wandb/settings. Any settings defined in the local file override settings in the global fil...
197
6,595
wandb
wandb/sdk/lib/capped_dict.py
.py
from __future__ import annotations import collections from typing import Any class CappedDict(collections.OrderedDict): default_max_size = 50 def __init__(self, max_size: int | None = None) -> None: self.max_size = max_size or self.default_max_size super().__init__() def __setitem__(sel...
29
843
wandb
wandb/sdk/lib/deprecation.py
.py
from __future__ import annotations from typing import TYPE_CHECKING, TypeAlias import wandb from wandb.sdk.lib import telemetry if TYPE_CHECKING: from wandb.proto.wandb_telemetry_pb2 import Deprecated UNSET: DoNotSet = object() """A temporary default value for removing formerly optional parameters. This helps...
52
1,374
wandb
wandb/sdk/lib/printer_asyncio.py
.py
import asyncio from collections.abc import Callable from typing import TypeVar from wandb.sdk import wandb_setup from wandb.sdk.lib import asyncio_compat, printer _T = TypeVar("_T") def run_async_with_spinner( spinner_printer: printer.Printer, text: str, func: Callable[[], _T], ) -> _T: """Run a slo...
46
1,357
wandb
wandb/sdk/lib/exit_hooks.py
.py
from __future__ import annotations import sys import traceback from types import TracebackType from typing import TYPE_CHECKING import wandb from wandb.errors import Error if TYPE_CHECKING: from typing import NoReturn class ExitHooks: exception: BaseException | None = None def __init__(self) -> None: ...
57
1,555
wandb
wandb/sdk/lib/hashutil.py
.py
from __future__ import annotations import base64 import hashlib import logging import mmap import time from typing import TYPE_CHECKING, TypeAlias from wandb.sdk.lib.paths import StrPath if TYPE_CHECKING: import _hashlib # type: ignore[import-not-found] logger = logging.getLogger(__name__) # In the future, c...
99
3,292
wandb
wandb/sdk/lib/run_messages.py
.py
"""Echoing messages from wandb-core to the terminal.""" from __future__ import annotations import asyncio import contextlib import logging from wandb.errors import term from wandb.proto import wandb_internal_pb2 as pb from wandb.sdk.interface.interface import InterfaceBase from wandb.sdk.lib import asyncio_compat, a...
122
4,053
wandb
wandb/sdk/lib/ratelimit.py
.py
"""A small asyncio rate limiter.""" import asyncio from wandb.sdk.lib import asyncio_compat class Cooldown: """A very simple rate limiter for asyncio loops. Implemented by sleeping until the next unblock time. Use the `looptime` package to test code that uses this. """ def __init__(self, cool...
50
1,464
wandb
wandb/sdk/lib/lazyloader.py
.py
"""module lazyloader.""" import importlib import sys import types class LazyLoader(types.ModuleType): """Lazily import a module, mainly to avoid pulling in large dependencies. We use this for tensorflow and other optional libraries primarily at the top module level. """ # The lint error here is...
64
1,891
wandb
wandb/sdk/lib/console_capture.py
.py
"""Module for intercepting stdout/stderr. This patches the `write()` method of `stdout` and `stderr` on import. Once patched, it is not possible to unpatch or repatch, though individual callbacks can be removed. We assume that all other writing methods on the object delegate to `write()`, like `writelines()`. This is...
309
9,389
wandb
wandb/sdk/lib/handler_util.py
.py
import wandb.data_types as data_types def get_types(): classes = map(data_types.__dict__.get, data_types.__all__) types = [] for cls in classes: if hasattr(cls, "_log_type") and cls._log_type is not None: types.append(cls._log_type) # add table-file type because this is a special c...
22
589
wandb
wandb/sdk/lib/wbauth/wbnetrc.py
.py
from __future__ import annotations import netrc import os import pathlib import platform import shlex from urllib.parse import urlsplit from wandb.errors import term from .auth import AuthApiKey, AuthWithSource from .host_url import HostUrl class WriteNetrcError(Exception): """Could not write to the netrc file...
212
5,994
wandb
wandb/sdk/lib/wbauth/authenticate.py
.py
from __future__ import annotations import os import threading from wandb import env from wandb.errors import AuthenticationError, UsageError, term from wandb.sdk import wandb_setup from . import prompt, wbnetrc from .auth import Auth, AuthApiKey, AuthIdentityTokenFile, AuthWithSource from .host_url import HostUrl fr...
281
8,450
wandb
wandb/sdk/lib/wbauth/__init__.py
.py
__all__ = ( "Auth", "AuthApiKey", "AuthIdentityTokenFile", "HostUrl", "session_credentials", "authenticate_session", "unauthenticate_session", "use_explicit_auth", "set_auth_settings", "check_api_key", "prompt_and_save_api_key", "read_netrc_auth", "write_netrc_auth", ...
30
760
wandb
wandb/sdk/lib/wbauth/host_url.py
.py
from __future__ import annotations import re from typing_extensions import final, override from wandb import env, util from wandb.sdk.lib import urls @final class HostUrl: """A validated and normalized W&B server URL. For convenient formatting, the __str__ representation is the URL itself. """ de...
74
2,144
wandb
wandb/sdk/lib/wbauth/auth.py
.py
from __future__ import annotations import abc import dataclasses import pathlib from typing_extensions import final, override from wandb.errors import AuthenticationError from . import validation from .host_url import HostUrl # We use an abstract base class instead of a union because # (1) All Auth subtypes hav...
147
4,130
wandb
wandb/sdk/lib/wbauth/saas.py
.py
from urllib.parse import urlsplit def is_wandb_domain(url: str) -> bool: """Returns whether the URL points to an official W&B server.""" _, netloc, _, _, _ = urlsplit(url) return netloc.endswith("wandb.ai")
8
221
wandb
wandb/sdk/lib/wbauth/settings.py
.py
"""Logic for setting auth-related parts of wandb.Settings.""" from wandb.sdk.wandb_settings import Settings from .auth import Auth, AuthApiKey, AuthIdentityTokenFile def set_auth_settings(settings: Settings, auth: Auth | None) -> None: """Set auth-related settings based on the given credentials. Auth setti...
66
2,109
wandb
wandb/sdk/lib/wbauth/prompt.py
.py
from __future__ import annotations import logging from urllib.parse import urlsplit, urlunsplit from wandb import util from wandb.errors import links, term from . import saas, validation, wbnetrc from .host_url import HostUrl _logger = logging.getLogger(__name__) _LOGIN_CHOICE_NEW = "Create a W&B account" _LOGIN_C...
202
6,011
wandb
wandb/sdk/lib/wbauth/validation.py
.py
"""Validation for API keys.""" from __future__ import annotations import pathlib import re from typing import TYPE_CHECKING if TYPE_CHECKING: from wandb.apis.public.service_api import ServiceApi from .host_url import HostUrl # Matches a JWT: three non-empty base64url segments separated by dots. _JWT_RE = ...
158
4,612
wandb
wandb/sdk/lib/service/service_connection.py
.py
from __future__ import annotations import atexit import pathlib from collections.abc import Callable from wandb.proto import wandb_api_pb2, wandb_settings_pb2, wandb_sync_pb2 from wandb.proto import wandb_server_pb2 as spb from wandb.sdk import wandb_settings from wandb.sdk.interface.interface import InterfaceBase fr...
392
13,096
wandb
wandb/sdk/lib/service/service_client.py
.py
from __future__ import annotations import asyncio import logging import struct from types import TracebackType from wandb.proto import wandb_server_pb2 as spb from wandb.sdk.lib import asyncio_manager from wandb.sdk.mailbox.mailbox import Mailbox from wandb.sdk.mailbox.mailbox_handle import MailboxHandle _logger = l...
145
4,664
wandb
wandb/sdk/lib/service/service_token.py
.py
from __future__ import annotations import abc import asyncio import os import re from typing_extensions import final, override from wandb import env from wandb.sdk.lib import asyncio_manager from wandb.sdk.lib.service import ipc_support from .service_client import ServiceClient _CURRENT_VERSION = "3" # Token form...
187
5,271
wandb
wandb/sdk/lib/service/ipc_support.py
.py
"""Constants determining what IPC methods are supported.""" import socket SUPPORTS_UNIX = hasattr(socket, "AF_UNIX") """Whether Unix sockets are supported. AF_UNIX is not supported on Windows: https://github.com/python/cpython/issues/77589 Windows has supported Unix sockets since ~2017, but support in Python is mis...
14
341
wandb
wandb/sdk/lib/service/service_port_file.py
.py
"""Module for figuring out how to connect to the service process.""" from __future__ import annotations import os import pathlib import re import subprocess import time import wandb from . import ipc_support, service_token # Time functions are monkeypatched in unit tests. _MONOTONIC = time.monotonic _SLEEP = time....
107
2,992
wandb
wandb/sdk/lib/service/service_finalizer.py
.py
"""Allows Python garbage collection to trigger wandb-core cleanup. This is tricky to implement correctly and requires a good understanding of Python's garbage collection and every line in this file. If done wrong, it can cause random deadlocks, and it has in the past. Even if done correctly, it may still not work depe...
97
3,527
wandb
wandb/sdk/lib/service/service_process.py
.py
"""Module for starting up the service process (wandb-core).""" from __future__ import annotations import os import pathlib import platform import subprocess import tempfile from typing import TYPE_CHECKING from wandb.analytics import get_sentry from wandb.env import core_debug, dcgm_profiling_enabled, error_reportin...
171
4,677
wandb
wandb/sdk/launch/_launch_add.py
.py
from __future__ import annotations import asyncio import pprint from typing import Any import wandb import wandb.apis.public as public from wandb.apis.internal import Api from wandb.errors import CommError from wandb.sdk.launch.builder.build import build_image_from_project from wandb.sdk.launch.errors import LaunchEr...
258
8,670
wandb
wandb/sdk/launch/errors.py
.py
from wandb.errors import Error class LaunchError(Error): """Raised when a known error occurs in wandb launch.""" class LaunchDockerError(Error): """Raised when Docker daemon is not running.""" class ExecutionError(Error): """Generic execution exception."""
14
275
wandb
wandb/sdk/launch/wandb_reference.py
.py
"""Support for parsing W&B URLs (which might be user provided) into constituent parts.""" from __future__ import annotations from dataclasses import dataclass from enum import IntEnum from urllib.parse import urlparse PREFIX_HTTP = "http://" PREFIX_HTTPS = "https://" class ReferenceType(IntEnum): RUN = 1 J...
132
3,971
wandb
wandb/sdk/launch/utils.py
.py
from __future__ import annotations import asyncio import copy import json import logging import os import platform import re import subprocess import sys from collections import defaultdict from collections.abc import Iterator from typing import TYPE_CHECKING, Any, cast import click import wandb import wandb.docker ...
1,105
39,349
wandb
wandb/sdk/launch/_launch.py
.py
from __future__ import annotations import asyncio import logging import os import sys from typing import Any import wandb from wandb.analytics import TelemetryRecorder from wandb.apis.internal import Api from . import loader from ._project_spec import LaunchProject from .agent import LaunchAgent from .agent.agent im...
339
11,941
wandb
wandb/sdk/launch/_project_spec.py
.py
"""Convert launch arguments into a runnable wandb launch script. Arguments can come from a launch spec or call to wandb launch. """ from __future__ import annotations import enum import json import logging import os import shlex import shutil import tempfile from copy import deepcopy from typing import TYPE_CHECKING...
606
22,792
wandb
wandb/sdk/launch/__init__.py
.py
from ._launch import create_and_run_agent, launch from ._launch_add import launch_add from .agent.agent import LaunchAgent from .inputs.manage import manage_config_file, manage_wandb_config from .utils import load_wandb_config __all__ = [ "create_and_run_agent", "LaunchAgent", "launch", "launch_add", ...
16
399
wandb
wandb/sdk/launch/git_reference.py
.py
"""Support for parsing GitHub URLs (which might be user provided) into constituent parts.""" from __future__ import annotations import os import re from enum import IntEnum from wandb.sdk.launch.errors import LaunchError from wandb.sdk.lib.gitlib import GitCommandError, run_git PREFIX_HTTPS = "https://" GIT_COMMI...
148
5,238
wandb
wandb/sdk/launch/loader.py
.py
"""Utilities for the agent.""" from __future__ import annotations from typing import Any import wandb from wandb.apis.internal import Api from wandb.docker import is_docker_installed from wandb.sdk.launch.errors import LaunchError from .builder.abstract import AbstractBuilder from .environment.abstract import Abstr...
252
8,940
wandb
wandb/sdk/launch/create_job.py
.py
from __future__ import annotations import json import logging import os import re import sys import tempfile from typing import Any import wandb from wandb.apis.internal import Api from wandb.sdk.artifacts.artifact import Artifact from wandb.sdk.internal.job_builder import JobBuilder from wandb.sdk.launch.git_referen...
544
17,614
wandb
wandb/sdk/launch/inputs/manage.py
.py
"""Functions for declaring overridable configuration for launch jobs.""" from __future__ import annotations from typing import Any def manage_config_file( path: str, include: list[str] | None = None, exclude: list[str] | None = None, schema: Any | None = None, ): r"""Declare an overridable confi...
116
5,005
wandb
wandb/sdk/launch/inputs/files.py
.py
import json import os from typing import Any import yaml from ..errors import LaunchError FILE_OVERRIDE_ENV_VAR = "WANDB_LAUNCH_FILE_OVERRIDES" class FileOverrides: """Singleton that read file overrides json from environment variables.""" _instance = None def __new__(cls): if cls._instance is...
148
4,647
wandb
wandb/sdk/launch/inputs/schema.py
.py
META_SCHEMA = { "type": "object", "properties": { "type": { "type": "string", "enum": ["boolean", "integer", "number", "string", "object", "array"], }, "title": {"type": "string"}, "description": {"type": "string"}, "label": {"type": "string"}, ...
74
2,900
wandb
wandb/sdk/launch/inputs/internal.py
.py
"""The layer between launch sdk user code and the wandb internal process. If there is an active run this communication is done through the wandb run's backend interface. If there is no active run, the messages are staged on the StagedLaunchInputs singleton and sent when a run is created. """ from __future__ import a...
317
9,733
wandb
wandb/sdk/launch/registry/local_registry.py
.py
"""Local registry implementation.""" import logging from typing_extensions import Self from wandb.docker import is_docker_installed from wandb.sdk.launch.errors import LaunchError from wandb.sdk.launch.utils import docker_image_exists from .abstract import AbstractRegistry _logger = logging.getLogger(__name__) c...
67
1,755
wandb
wandb/sdk/launch/registry/azure_container_registry.py
.py
"""Implementation of AzureContainerRegistry class.""" from __future__ import annotations import re from typing import TYPE_CHECKING from wandb.sdk.launch.environment.azure_environment import AzureEnvironment from wandb.sdk.launch.errors import LaunchError from wandb.sdk.launch.utils import AZURE_CONTAINER_REGISTRY_U...
127
4,550
wandb
wandb/sdk/launch/registry/abstract.py
.py
"""Abstract base class for registries.""" from abc import ABC, abstractmethod from typing_extensions import Self class AbstractRegistry(ABC): """Abstract base class for registries.""" uri: str async def get_username_password(self) -> tuple[str, str]: """Get the username and password for the re...
50
1,143
wandb
wandb/sdk/launch/registry/elastic_container_registry.py
.py
"""Implementation of Elastic Container Registry class for wandb launch.""" from __future__ import annotations import base64 import logging from wandb.sdk.launch.errors import LaunchError from wandb.sdk.launch.registry.abstract import AbstractRegistry from wandb.sdk.launch.utils import ( ELASTIC_CONTAINER_REGISTR...
194
7,229
wandb
wandb/sdk/launch/registry/google_artifact_registry.py
.py
"""Implementation of Google Artifact Registry for wandb launch.""" from __future__ import annotations import logging import google.auth # type: ignore import google.cloud.artifactregistry # type: ignore from wandb.sdk.launch.errors import LaunchError from wandb.sdk.launch.utils import ( GCP_ARTIFACT_REGISTRY_...
221
8,494
wandb
wandb/sdk/launch/registry/anon.py
.py
from typing_extensions import Self from wandb.docker import is_docker_installed from wandb.sdk.launch.utils import docker_image_exists from .abstract import AbstractRegistry class AnonynmousRegistry(AbstractRegistry): def __init__(self, uri: str) -> None: """Initialize the registry.""" self.uri ...
30
939
wandb
wandb/sdk/launch/sweeps/utils.py
.py
from __future__ import annotations import json import os import re from typing import TYPE_CHECKING, Any import wandb from wandb import util from wandb.sdk.launch.errors import LaunchError if TYPE_CHECKING: from wandb.apis.public import Api as PublicApi DEFAULT_SWEEP_COMMAND: list[str] = [ "${env}", "${...
327
10,199
wandb
wandb/sdk/launch/sweeps/scheduler.py
.py
"""Abstract Scheduler class.""" from __future__ import annotations import asyncio import base64 import copy import logging import os import socket import threading import time import traceback from abc import ABC, abstractmethod from collections.abc import Iterator from dataclasses import dataclass from enum import E...
737
26,692
wandb
wandb/sdk/launch/sweeps/__init__.py
.py
import logging from collections.abc import Callable from typing import Any log = logging.getLogger(__name__) class SchedulerError(Exception): """Raised when a known error occurs with wandb sweep scheduler.""" class SweepNotFoundError(Exception): """Raised when a sweep is not found, typically because it was...
45
1,092
wandb
wandb/sdk/launch/sweeps/scheduler_sweep.py
.py
"""Scheduler for classic wandb Sweeps.""" from __future__ import annotations import logging from pprint import pformat as pf from typing import Any import wandb from wandb.sdk.launch.sweeps import SweepNotFoundError from wandb.sdk.launch.sweeps.scheduler import LOG_PREFIX, RunState, Scheduler, SweepRun _logger = lo...
101
3,302
wandb
wandb/sdk/launch/builder/docker_builder.py
.py
"""Implementation of the docker builder.""" from __future__ import annotations import logging import os from typing import Any import wandb import wandb.docker as docker from wandb.sdk.launch.agent.job_status_tracker import JobAndRunStatusTracker from wandb.sdk.launch.builder.abstract import AbstractBuilder, registr...
180
6,331
wandb
wandb/sdk/launch/builder/kaniko_builder.py
.py
from __future__ import annotations import asyncio import base64 import copy import json import logging import os import shutil import tarfile import tempfile import time import traceback from typing import Any import wandb from wandb.sdk.launch.agent.job_status_tracker import JobAndRunStatusTracker from wandb.sdk.lau...
597
23,926
wandb
wandb/sdk/launch/builder/abstract.py
.py
"""Abstract plugin class defining the interface needed to build container images for W&B Launch.""" from __future__ import annotations from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Any from wandb.sdk.launch.environment.abstract import AbstractEnvironment from wandb.sdk.launch.registry.abstrac...
159
5,089
wandb
wandb/sdk/launch/builder/build.py
.py
import hashlib import json import logging import os import pathlib import re import shlex import shutil from typing import Any import wandb import wandb.env from wandb import docker from wandb.apis.internal import Api from wandb.sdk.launch.loader import ( builder_from_config, environment_from_config, regis...
325
11,898
wandb
wandb/sdk/launch/builder/context_manager.py
.py
import logging import os import shutil import tempfile from wandb.sdk.launch._project_spec import LaunchProject from wandb.sdk.launch.builder.build import image_tag_from_dockerfile_and_source from wandb.sdk.launch.errors import LaunchError from wandb.sdk.launch.utils import get_current_python_version from .build impo...
235
9,593
wandb
wandb/sdk/launch/builder/noop.py
.py
"""NoOp builder implementation.""" from __future__ import annotations from typing import Any from wandb.sdk.launch.builder.abstract import AbstractBuilder from wandb.sdk.launch.environment.abstract import AbstractEnvironment from wandb.sdk.launch.errors import LaunchError from wandb.sdk.launch.registry.abstract impo...
61
1,917
wandb
wandb/sdk/launch/builder/templates/_wandb_bootstrap.py
.py
from __future__ import annotations import json import os import re import subprocess import sys FAILED_PACKAGES_PREFIX = "ERROR: Failed to install: " FAILED_PACKAGES_POSTFIX = ". During automated build process." ONLY_INCLUDE = {x for x in os.getenv("WANDB_ONLY_INCLUDE", "").split(",") if x != ""} OPTS = [] # If the b...
190
7,289
wandb
wandb/sdk/launch/builder/templates/dockerfile.py
.py
DOCKERFILE_TEMPLATE = """ # ----- stage 1: build ----- FROM {py_build_image} as build # requirements section depends on pip vs conda, and presence of buildx ENV PIP_PROGRESS_BAR off {requirements_section} # ----- stage 2: base ----- {base_setup} COPY --from=build /env /env ENV PATH="/env/bin:$PATH" ENV SHELL /bin/b...
93
2,264
wandb
wandb/sdk/launch/environment/aws_environment.py
.py
"""Implements the AWS environment.""" from __future__ import annotations import logging import os from wandb.sdk.launch.errors import LaunchError from wandb.util import get_module from ..utils import ARN_PARTITION_RE, S3_URI_RE, event_loop_thread_exec from .abstract import AbstractEnvironment boto3 = get_module( ...
324
12,515
wandb
wandb/sdk/launch/environment/local_environment.py
.py
"""Dummy local environment implementation. This is the default environment.""" from __future__ import annotations from typing import Any from wandb.sdk.launch.errors import LaunchError from .abstract import AbstractEnvironment class LocalEnvironment(AbstractEnvironment): """Local environment class.""" de...
66
2,246
wandb
wandb/sdk/launch/environment/abstract.py
.py
"""Abstract base class for environments.""" from abc import ABC, abstractmethod class AbstractEnvironment(ABC): """Abstract base class for environments.""" region: str @abstractmethod async def verify(self) -> None: """Verify that the environment is configured correctly.""" raise No...
30
951
wandb
wandb/sdk/launch/environment/gcp_environment.py
.py
"""Implementation of the GCP environment for wandb launch.""" from __future__ import annotations import logging import os import subprocess from wandb.sdk.launch.errors import LaunchError from wandb.util import get_module from ..utils import GCS_URI_RE, event_loop_thread_exec from .abstract import AbstractEnvironme...
336
12,709
wandb
wandb/sdk/launch/environment/azure_environment.py
.py
"""Implementation of AzureEnvironment class.""" from azure.core.exceptions import HttpResponseError # type: ignore from azure.identity import DefaultAzureCredential # type: ignore from azure.storage.blob import BlobClient, BlobServiceClient # type: ignore from typing_extensions import Self from ..errors import Lau...
105
3,880
wandb
wandb/sdk/launch/runner/kubernetes_monitor.py
.py
"""Monitors kubernetes resources managed by the launch agent.""" from __future__ import annotations import asyncio import logging import traceback from typing import Any import kubernetes_asyncio # type: ignore import urllib3 from kubernetes_asyncio import watch from kubernetes_asyncio.client import ( # type: igno...
477
17,803
wandb
wandb/sdk/launch/runner/sagemaker_runner.py
.py
"""Implementation of the SageMakerRunner class.""" from __future__ import annotations import asyncio import logging from typing import Any, cast if False: import boto3 # type: ignore import wandb from wandb.apis.internal import Api from wandb.sdk.launch.environment.aws_environment import AwsEnvironment from wa...
427
15,241
wandb
wandb/sdk/launch/runner/local_container.py
.py
from __future__ import annotations import asyncio import logging import os import shlex import shutil import subprocess import sys import threading from typing import TYPE_CHECKING, Any import wandb from wandb.sdk.launch.environment.abstract import AbstractEnvironment from wandb.sdk.launch.registry.abstract import Ab...
332
11,706
wandb
wandb/sdk/launch/runner/vertex_runner.py
.py
from __future__ import annotations import asyncio import logging from typing import Any if False: from google.cloud import aiplatform # type: ignore # noqa: F401 from wandb.apis.internal import Api from wandb.util import get_module from .._project_spec import LaunchProject from ..environment.gcp_environment ...
228
8,183
wandb
wandb/sdk/launch/runner/local_process.py
.py
from __future__ import annotations import logging import shlex from typing import Any import wandb from .._project_spec import LaunchProject from ..errors import LaunchError from ..utils import ( LOG_PREFIX, MAX_ENV_LENGTHS, PROJECT_SYNCHRONOUS, sanitize_wandb_api_key, validate_wandb_python_deps,...
81
2,752
wandb
wandb/sdk/launch/runner/abstract.py
.py
"""Implementation of the abstract runner class. This class defines the interface that the W&B launch runner uses to manage the lifecycle of runs launched in different environments (e.g. runs launched locally or in a cluster). """ from __future__ import annotations import logging import os import shutil import sys fr...
166
4,820
wandb
wandb/sdk/launch/runner/kubernetes_runner.py
.py
"""Implementation of KubernetesRunner class for wandb launch.""" from __future__ import annotations import asyncio import base64 import datetime import json import logging import os import shlex import time from collections.abc import Iterator from typing import Any import yaml import wandb from wandb.apis.internal...
1,494
55,523
wandb
wandb/sdk/launch/agent/__init__.py
.py
from .agent import LaunchAgent LaunchAgent = LaunchAgent __all__ = ["LaunchAgent"]
6
85
wandb
wandb/sdk/launch/agent/job_status_tracker.py
.py
from __future__ import annotations import logging from dataclasses import dataclass from wandb.apis.internal import Api from wandb.errors import CommError from wandb.sdk.launch._project_spec import LaunchProject from ..runner.abstract import AbstractRun from ..utils import event_loop_thread_exec from .run_queue_item...
57
1,823
wandb
wandb/sdk/launch/agent/config.py
.py
"""Definition of the config object used by the Launch agent.""" from __future__ import annotations from enum import Enum # ValidationError is imported for exception type checking purposes only. from pydantic import ( # type: ignore BaseModel, ConfigDict, Field, ValidationError, field_validator, ...
294
9,263
wandb
wandb/sdk/launch/agent/run_queue_item_file_saver.py
.py
"""Implementation of the run queue item file saver class.""" from __future__ import annotations import os from typing import Literal import wandb FileSubtypes = Literal["warning", "error"] class RunQueueItemFileSaver: def __init__( self, agent_run: wandb.Run | None, run_queue_item_id: ...
42
1,320
wandb
wandb/sdk/launch/agent/agent.py
.py
"""Implementation of launch agent.""" from __future__ import annotations import asyncio import copy import logging import os import pprint import threading import time import traceback from dataclasses import dataclass from multiprocessing import Event from typing import Any import wandb from wandb.analytics import ...
970
38,105
wandb
wandb/sdk/data_types/table_decorators.py
.py
"""Decorators for W&B Table operations.""" from __future__ import annotations from collections.abc import Callable from functools import wraps from typing import Any, Concatenate, TypeVar from typing_extensions import ParamSpec import wandb _P = ParamSpec("_P") _T = TypeVar("_T") def allow_relogging_after_mutati...
108
3,675
wandb
wandb/sdk/data_types/histogram.py
.py
from __future__ import annotations import sys from collections.abc import Sequence from typing import TYPE_CHECKING from wandb import util from .base_types.wb_value import WBValue if TYPE_CHECKING: # pragma: no cover import numpy as np from wandb.sdk.artifacts.artifact import Artifact from ..wandb_ru...
111
3,377
wandb
wandb/sdk/data_types/table.py
.py
from __future__ import annotations import base64 import binascii import codecs import datetime import json import logging import os from collections.abc import Callable, Iterable, Iterator, Sequence from typing import TYPE_CHECKING, Any, Literal, TypeVar, cast, get_args, overload import wandb from wandb import util f...
1,604
58,625
wandb
wandb/sdk/data_types/utils.py
.py
from __future__ import annotations import datetime import logging import os from collections.abc import Sequence from decimal import Decimal from typing import TYPE_CHECKING, Any, TypeAlias, cast import wandb from wandb import util from ..internal import incremental_table_util from .base_types.media import Batchable...
266
9,029
wandb
wandb/sdk/data_types/saved_model.py
.py
from __future__ import annotations import os import pathlib import shutil import sys from types import ModuleType from typing import TYPE_CHECKING, Any, ClassVar, Generic, TypeVar, cast import wandb from wandb import util from wandb.sdk.lib import runid from wandb.sdk.lib.hashutil import md5_file_hex from wandb.sdk.l...
440
16,423
wandb
wandb/sdk/data_types/_private.py
.py
import atexit import tempfile # Staging directory, so we can encode raw data into files, then hash them before # we put them into the Run directory to be uploaded. MEDIA_TMP = tempfile.TemporaryDirectory("wandb-media") def _cleanup_media_tmp_dir() -> None: atexit.register(MEDIA_TMP.cleanup)
11
299
wandb
wandb/sdk/data_types/trace_tree.py
.py
"""This module contains the `WBTraceTree` media type, and the supporting dataclasses. A `WBTraceTree` is a media object containing a root span and an arbitrary model dump as a serializable dictionary. Logging such media type will result in a W&B Trace Debugger panel being created in the workspace UI. """ from __futur...
442
14,693
wandb
wandb/sdk/data_types/image.py
.py
from __future__ import annotations import hashlib import logging import os import pathlib from collections.abc import Sequence from io import BytesIO from typing import TYPE_CHECKING, Any, TypeAlias, cast from urllib import parse from packaging.version import parse as parse_version import wandb from wandb import uti...
1,108
40,935
wandb
wandb/sdk/data_types/_dtypes.py
.py
from __future__ import annotations import datetime import math import typing as t from wandb.util import ( _is_artifact_string, _is_artifact_version_weave_dict, get_module, is_numpy_array, ) np = get_module("numpy") # intentionally not required if t.TYPE_CHECKING: from wandb.sdk.artifacts.artif...
900
29,246
wandb
wandb/sdk/data_types/html.py
.py
from __future__ import annotations import os import pathlib from collections.abc import Sequence from typing import TYPE_CHECKING from wandb.sdk.lib import filesystem, runid from . import _dtypes from ._private import MEDIA_TMP from .base_types.media import BatchableMedia if TYPE_CHECKING: # pragma: no cover f...
167
4,932
wandb
wandb/sdk/data_types/bokeh.py
.py
from __future__ import annotations import codecs import json import os import pathlib from typing import TYPE_CHECKING from wandb import util from wandb._strutils import nameof from wandb.sdk.lib import runid from . import _dtypes from ._private import MEDIA_TMP from .base_types.media import Media if TYPE_CHECKING:...
100
3,384
wandb
wandb/sdk/data_types/video.py
.py
from __future__ import annotations import functools import logging import os import pathlib from collections.abc import Sequence from io import BytesIO from typing import TYPE_CHECKING, Any, Literal import wandb from wandb import env, util from wandb.sdk import wandb_setup from wandb.sdk.lib import filesystem, printe...
305
10,520
wandb
wandb/sdk/data_types/plotly.py
.py
from __future__ import annotations import codecs import os from collections.abc import Sequence from typing import TYPE_CHECKING, TypeAlias from wandb import util from wandb.sdk.lib import runid from ._private import MEDIA_TMP from .base_types.media import Media, _numpy_arrays_to_lists from .base_types.wb_value impo...
99
3,323
wandb
wandb/sdk/data_types/audio.py
.py
from __future__ import annotations import hashlib import os import pathlib from typing import TYPE_CHECKING from wandb import util from wandb.sdk.lib import filesystem, runid from . import _dtypes from ._private import MEDIA_TMP from .base_types.media import BatchableMedia if TYPE_CHECKING: import numpy as np ...
206
6,335
wandb
wandb/sdk/data_types/molecule.py
.py
from __future__ import annotations import io import os import pathlib from collections.abc import Sequence from typing import TYPE_CHECKING, TypeAlias from wandb import util from wandb.sdk.lib import runid from wandb.sdk.lib.paths import LogicalPath from ._private import MEDIA_TMP from .base_types.media import Batch...
254
8,882
wandb
wandb/sdk/data_types/object_3d.py
.py
from __future__ import annotations import codecs import itertools import os import pathlib from collections.abc import Sequence from typing import TYPE_CHECKING, ClassVar, Literal, TextIO, TypeAlias, TypedDict, cast import wandb from wandb import util from wandb.sdk.lib import json_util, runid from wandb.sdk.lib.path...
543
18,732