Skip to content
sandbox-workers
Esc
navigateopen⌘Jpreview
On this page

Python

Execute code with CPython 3.14.6 inside a dedicated Wasm Worker.

Package: @sandbox-workers/python. Includes a read-only standard library. This build cannot use _decimal, decimal, fractions, or statistics because mpdecimal imports are unresolved. pip installations and native extensions are unavailable.

Deploy

Deploy to Cloudflare

Or, after npm publication:

pnpm dlx @sandbox-workers/cli init python my-sandbox

See deployment setup and Service Bindings. The template requires a Paid plan and creates no public URL.

Example

Env vars:

{ "NAME": "world" }

Code:

import os
name = os.environ.get("NAME", "world")
print("Hello from CPython!")
{"message": f"Hello, {name}!", "squares": [x*x for x in range(6)]}

Every request gets a fresh engine instance. State does not persist between executions. Consult limits for fuel, memory, and output budgets.

License notice

Before use or redistribution, review this runtime’s LICENSE and THIRD_PARTY_NOTICES.md. Bundled interpreters retain their upstream licenses. The package includes the applicable notices in its licenses/ directory.