Skip to main content

dwsandbox-client

A typed Python client for the DonkeyWork Sandbox control plane. The models are generated from the service's OpenAPI spec; the clients wrap them with a base URL and an API key.

pip install dwsandbox-client

Usage

Give it your sandbox access key (dws_...) and it exposes two provisioning methods. Both a synchronous and an asynchronous client ship in the box.

create — provision and wait

Returns the ready sandbox in one call (blocks ~15s while it provisions), including the absolute MCP URL:

from dwsandbox_client import SandboxClient

with SandboxClient("dws_your_key") as sandbox:
    ready = sandbox.create()                      # or create(template_id=..., sandbox_id=...)
    print(ready.status, ready.mcp_url)

create_stream — provision with live progress

Yields each provisioning event as it happens:

from dwsandbox_client import SandboxClient, SandboxStatus

with SandboxClient("dws_your_key") as sandbox:
    for event in sandbox.create_stream():
        print(f"[{event.stage}] {event.message}")
        if event.is_terminal:
            assert event.status is SandboxStatus.ready

Async

Same surface, await / async for:

import asyncio
from dwsandbox_client import AsyncSandboxClient

async def main():
    async with AsyncSandboxClient("dws_your_key") as sandbox:
        ready = await sandbox.create()
        print(ready.mcp_url)
        async for event in sandbox.create_stream():
            print(event.stage, event.status)

asyncio.run(main())

The access key may also be sent by your own httpx client — pass http_client= to either constructor to reuse a configured client (proxies, custom timeouts, etc.). The base URL defaults to https://sandbox.donkeywork.dev; override with base_url=.

Note on transport. create and create_stream both go over REST/SSE, which is the transport that works reliably through the public edge. (Native gRPC provisioning exists for in-cluster/LAN callers but the edge does not proxy its long-lived stream.)

Types

dwsandbox_client.models contains the full set of shapes generated from the OpenAPI spec. The commonly used ones are re-exported at the top level: CreateSandboxRequest, CreateSandboxResponse, ProvisioningEvent, SandboxStatus. Fields are snake_case with camelCase wire aliases (e.g. ready.mcp_urlmcpUrl).

Development

Regenerate the models after the API's OpenAPI spec changes:

./scripts/generate.sh        # regenerates src/dwsandbox_client/models.py from openapi.json

scripts/generate.sh documents how to refresh openapi.json from the running API.

Releasing (PyPI, via GitHub Actions)

Publishing is automated through .github/workflows/pyclient-publish.yml, which uploads to PyPI using Trusted Publishing (OIDC, no stored token). Two ways to cut a release:

  • Auto minor bump (normal path): GitHub → Actions → Publish dwsandbox-client → Run workflow. It bumps the minor version in pyproject.toml, commits it, tags pyclient-v<version>, and publishes — no version to pick by hand.

  • Specific version: push the tag yourself (used for the first release):

    git tag pyclient-v0.1.0 && git push origin pyclient-v0.1.0
    

Either way the workflow verifies the tag matches pyproject.toml, builds the sdist + wheel, and publishes.

One-time PyPI setup (only the project owner can do this): on pypi.org create the dwsandbox-client project (or a pending publisher before the first release) and add a Trusted Publisher pointing at this GitHub repo, workflow pyclient-publish.yml, and environment pypi. No API token or GitHub secret is needed after that.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dwsandbox_client-0.1.0.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dwsandbox_client-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file dwsandbox_client-0.1.0.tar.gz.

File metadata

  • Download URL: dwsandbox_client-0.1.0.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dwsandbox_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 437ad137a5e07117cefc0d8ffebba1c65b79e6e1422b6ee5caa8c92b12e6bfcd
MD5 2c799010ebd715daba6ce65c6f6a701b
BLAKE2b-256 2ed1bff6ff01d356db20e10bef5667bda4584e5b6adbba6fc032b0f865ea3212

See more details on using hashes here.

Provenance

The following attestation bundles were made for dwsandbox_client-0.1.0.tar.gz:

Publisher: pyclient-publish.yml on andyjmorgan/DonkeyWork-Sandbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dwsandbox_client-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dwsandbox_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a141dea31554d8672d76d9a65cf34e330688333e65fa1cd1795ce97a649926f
MD5 cc195334fe9a47a054dcee82796100d9
BLAKE2b-256 c6e7f3fb855fab5ee7436262845f2776a5725b4a73019da693a126a2e87559b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for dwsandbox_client-0.1.0-py3-none-any.whl:

Publisher: pyclient-publish.yml on andyjmorgan/DonkeyWork-Sandbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.3.0

2 files

0.2.0

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page