Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Environment:Wandb Weave Python SDK Runtime

From Leeroopedia
Knowledge Sources
Domains Infrastructure, Python, SDK
Last Updated 2026-02-14 12:00 GMT

Overview

Python 3.10+ CPython environment with Pydantic 2.x, wandb client, and core dependencies for the Weave tracing SDK.

Description

This environment defines the runtime requirements for the Weave Python SDK client. It is built on CPython 3.10 or higher (PyPy is explicitly excluded) and requires a set of core dependencies including Pydantic 2.x for data modeling, the wandb client for authentication and project management, tenacity for retry logic, and httpx (via gql) for HTTP communication. The SDK is tested on Python 3.10, 3.11, 3.12, and 3.13. On Windows, the additional tzdata package is required for timezone support.

Usage

Use this environment for any interaction with the Weave SDK, including tracing, evaluation, prompt management, and object publishing. This is the mandatory prerequisite for all Weave client-side operations. Every implementation page in this wiki requires this environment.

System Requirements

Category Requirement Notes
OS Linux, macOS, or Windows Cross-platform; Windows requires `tzdata` package
Python CPython >= 3.10 PyPy explicitly not supported
Network Internet access to Wandb API Default: `https://api.wandb.ai` and `https://trace.wandb.ai`
Disk Varies Default 1GB server cache; scorer models cached at `~/.cache/wandb/weave-scorers`

Dependencies

System Packages

  • No system-level packages required for the base SDK

Python Packages

  • `wandb` >= 0.17.1
  • `pydantic` >= 2.0.0
  • `sentry-sdk` >= 2.0.0, < 3.0.0
  • `packaging` >= 21.0
  • `tenacity` >= 8.3.0, != 8.4.0 (8.4.0 has a bug with AsyncRetrying import)
  • `click` (any version)
  • `gql[httpx]` >= 3.0.0
  • `jsonschema` >= 4.23.0
  • `diskcache` == 5.6.3 (exact pin)
  • `cachetools` >= 6.2.4
  • `polyfile-weave` >= 0.5.9
  • `tzdata` (Windows only)

Optional Dependencies

  • `rich` — Enhanced console output
  • `presidio-analyzer`, `presidio-anonymizer` — PII redaction (Python < 3.13 only)

Credentials

The following credentials must be available at runtime:

  • `WANDB_API_KEY`: W&B API key for authentication. Can also be set via `~/.netrc` or `~/_netrc` file.

Quick Install

# Install the Weave SDK
pip install weave

# Or with optional rich console support
pip install "weave[rich]"

Code Evidence

Python version check from `weave/__init__.py:6-10`:

if sys.version_info < (3, 10):  # noqa: UP036
    warnings.warn(
        "Weave only supports Python 3.10 or higher; please upgrade your Python version to avoid potential issues.",
        stacklevel=2,
    )

Python version requirement from `pyproject.toml:35`:

requires-python = ">=3.10"

CPython-only constraint from `pyproject.toml:461-463`:

[tool.uv]
# Limit environments to CPython only (exclude PyPy) to avoid validation issues
environments = ["platform_python_implementation == 'CPython'"]

Tenacity bug exclusion from `pyproject.toml:42`:

"tenacity>=8.3.0,!=8.4.0",  # Excluding 8.4.0 because it had a bug on import of AsyncRetrying

API key resolution chain from `weave/trace/env.py:73-103`:

def _wandb_api_key_via_env() -> str | None:
    api_key = os.environ.get("WANDB_API_KEY")
    return api_key

def _wandb_api_key_via_netrc() -> str | None:
    for filepath in ("~/.netrc", "~/_netrc"):
        api_key = _wandb_api_key_via_netrc_file(filepath)
        if api_key:
            return api_key
    return None

Supported Python versions in CI from `noxfile.py:10`:

SUPPORTED_PYTHON_VERSIONS = ["3.10", "3.11", "3.12", "3.13"]

Common Errors

Error Message Cause Solution
`Weave only supports Python 3.10 or higher` Running on Python < 3.10 Upgrade to Python 3.10+
`wandb version >= 0.16.4 is required` Outdated wandb package `pip install wandb --upgrade`
`The target Weave host requires weave >= X` Server requires newer SDK `pip install weave --upgrade`
`ImportError: AsyncRetrying` tenacity 8.4.0 installed `pip install "tenacity>=8.3.0,!=8.4.0"`
Authentication failure No WANDB_API_KEY or netrc entry Set `WANDB_API_KEY` env var or run `wandb login`

Compatibility Notes

  • PyPy: Not supported. Multiple dependencies and integrations explicitly exclude PyPy.
  • Python 3.12+: Op protocol detection uses `hasattr` checks instead of `isinstance` due to Python 3.12 protocol changes.
  • Python 3.13: Cohere and NotDiamond integrations are not compatible with Python 3.13.
  • Python 3.10: NotDiamond integration is not compatible with Python 3.10.
  • Windows: Requires `tzdata` for timezone support. Grid display uses Windows-specific code path.
  • diskcache: Pinned to exact version 5.6.3 for stability.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment