Skip to main content

crosswind-sandboxes

A Python port of @cloudflare/sandbox 1.0.3 for Python Workers. It has file operations, S3 mounts and directory backups for a running container. It installs as crosswind-sandboxes and imports as sandboxes.

The package has no Python dependencies. It calls ctx.container through the Pyodide FFI and runs the official sandbox-shim binary inside the container, speaking shim protocol version 1.

Requirements

  • The container image must contain /usr/local/bin/sandbox-shim, copied from cloudflare/sandbox:<VERSION>.
  • The container must be running. No class starts, stops, or monitors it.
  • nodejs_compat is not needed. Errno names come from a fixed table of Linux values.

Example

from sandboxes import DirectoryBackup, Files
from workers import DurableObject

# Export the gateways so ctx.exports can reach them.
from sandboxes import DirectoryBackupGateway, S3Gateway  # noqa: F401


class Workspace(DurableObject):
    async def snapshot(self) -> dict:
        container = self.ctx.container
        if not container.running:
            container.start()

        files = Files(container)
        await files.write_file("/workspace/notes.txt", "hello")
        entries = await files.read_directory("/workspace")

        backups = DirectoryBackup(
            container, self.ctx.exports.DirectoryBackupGateway, binding="BACKUPS"
        )
        record = await backups.backup("/workspace")
        return {"entries": [entry.name for entry in entries], "record": record}

Differences from the TypeScript SDK

  • Names use snake_case, and option objects become keyword-only arguments.
  • AbortSignal becomes an asyncio.Event passed as abort=. Setting it raises SandboxAbortError. An event can't cross RPC, so cancellation works only inside the Durable Object.
  • Invalid values raise ValueError, and values of the wrong type raise TypeError.
  • Errors are exception classes under SandboxError, checked with isinstance. There is no is() helper.
  • stat() returns a SandboxFileStat dataclass with an int size and UTC datetime times. File types use snake_case: block_device and character_device.
  • read_file() returns a JS Response. A failure after the file opens errors the body with a JS Error whose name is the Python exception's class name.
  • DirectoryBackupRecord is a TypedDict compatible with the JS SDK's records.

See sandbox-sdk-api.md for the full API map.

Metadata

Release files for crosswind-sandboxes 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crosswind-sandboxes 0.1.0
File Size Uploaded Provenance Actions
crosswind_sandboxes-0.1.0.tar.gz 39.2 kB Without provenance Details for crosswind_sandboxes-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for crosswind-sandboxes 0.1.0
File Interpreter ABI Platform Actions
crosswind_sandboxes-0.1.0-py3-none-any.whl Python 3 none any Details for crosswind_sandboxes-0.1.0-py3-none-any.whl

Total release size: 83.7 kB

Release files / crosswind_sandboxes-0.1.0.tar.gz

Download URL crosswind_sandboxes-0.1.0.tar.gz
Size 39.2 kB
Tags Source
SHA-256 checksum
How to use checksums
db83e2ec1b2bf2d96cd93a1c609c99650cea83e6221582228e3ef32dec705775
BLAKE2b-256 checksum
How to use checksums
07d8180ec669cc78e2e535c72dfe2dbfcd2b2799251e4f5ed0a8174fe6b50e2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / crosswind_sandboxes-0.1.0-py3-none-any.whl

Download URL crosswind_sandboxes-0.1.0-py3-none-any.whl
Size 44.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dfc3030e8d71f4f7db9e6bb89210eca4ca5b46642f5c63c29b0abfd640bdbc8f
BLAKE2b-256 checksum
How to use checksums
ac0ac870467d0237326ebdb38eadd6533414674b83f5c251f1f75fd015de3737
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for crosswind-sandboxes 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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