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.2.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.2.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dwsandbox_client-0.2.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.2.0.tar.gz
Algorithm Hash digest
SHA256 491c488d232505acea9fa152b8daed194c18d2912b1d0b941fba633b745a8567
MD5 96ba0af37ca2f7cf71d3fba7c42dae89
BLAKE2b-256 118115160827d866e4f72650179e44e0e55f35103f90940fc697572053f39a90

See more details on using hashes here.

Provenance

The following attestation bundles were made for dwsandbox_client-0.2.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.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dwsandbox_client-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9bf9082f2550da5204ce93735c8136cf6c1d59c8f896bde5a150e45a2d737726
MD5 741b01174d611910612b07940ffc6f44
BLAKE2b-256 d7995f6acedc763c5c7cc709aff27639947ccfc32da21746316fa44ebfc0720c

See more details on using hashes here.

Provenance

The following attestation bundles were made for dwsandbox_client-0.2.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

This release

0.2.0 This release

2 files

0.1.0

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