CLI Reference
Commands
Section titled “Commands”pymode init <name>
Section titled “pymode init <name>”Scaffold a new PyMode project.
pymode init my-workerCreates a project directory with pyproject.toml, src/entry.py, and .gitignore.
pymode dev
Section titled “pymode dev”Start a local development server with hot reload.
pymode devThe dev server runs your Python handler natively (not in WASM) for instant feedback (~35ms per request).
| Option | Default | Description |
|---|---|---|
--port <port> | 8787 | Port to listen on |
--entry <file> | from pyproject.toml | Override entry point |
--env <KEY=VALUE> | — | Set environment variable |
--verbose | false | Log request/response bodies |
pymode deploy
Section titled “pymode deploy”Bundle and deploy to Cloudflare Workers.
pymode deploy| Option | Default | Description |
|---|---|---|
--entry <file> | from pyproject.toml | Override entry point |
--env <KEY=VALUE> | — | Set environment variable |
--wizer | false | Build Wizer snapshot for fast cold starts |
--dry-run | false | Bundle without deploying |
pymode add <packages...>
Section titled “pymode add <packages...>”Add Python package dependencies.
pymode add requests jinja2 markupsafePure-Python packages are bundled directly. C extension packages are compiled to .wasm side modules using build-extension.py.
pymode remove <packages...>
Section titled “pymode remove <packages...>”Remove Python package dependencies.
pymode remove requestspymode install
Section titled “pymode install”Install all dependencies from pyproject.toml.
pymode installConfiguration
Section titled “Configuration”pyproject.toml
Section titled “pyproject.toml”[project]name = "my-worker"version = "0.1.0"
[tool.pymode]main = "src/entry.py"# wizer = true # Enable deploy-time snapshots (~5ms cold starts)
[tool.pymode.kv_namespaces]MY_KV = "namespace-id"
[tool.pymode.r2_buckets]MY_R2 = "bucket-name"
[tool.pymode.d1_databases]MY_DB = "database-id".dev.vars
Section titled “.dev.vars”Local environment variables for development:
API_KEY=sk-test-123DEBUG_MODE=trueDATABASE_URL=postgres://localhost:5432/mydb