bunpy run
bunpy run [flags] <script.py> [-- script-args...]
bunpy <script.py> [script-args...] # shorthandDescription
Compiles a Python source file with gocopy and runs it on the goipy VM.
Injected globals (fetch, URL, Request, Response, WebSocket,
setTimeout, setInterval, clearTimeout, clearInterval) are available
without any import.
Flags
| Flag | Default | Description |
|---|---|---|
--inspect | off | Print IR size, module list, and timing breakdown, then exit |
--quiet, -q | off | Suppress runtime warnings |
--env-file <path> | .env | Load environment variables from a file before running |
--watch, -w | off | Re-run the script when source files change |
--help, -h | Print help |
Examples
Run a script:
bunpy run hello.py
bunpy hello.py # identicalPass arguments to the script (available as sys.argv):
bunpy run cli.py -- --port 8080 --debugInspect the compiled IR:
bunpy run --inspect hello.py
# IR size: 4.2 KB
# Compile: 1.3 ms
# Marshal: 0.1 ms
# Unmarshal: 0.2 ms
# Run: 0.8 msLoad a .env file:
bunpy run --env-file .env.production server.pyWatch mode - re-runs on every save:
bunpy run --watch dev.pyScript arguments
Arguments after -- are forwarded to the script and available via sys.argv:
# cli.py
import sys
print(sys.argv)bunpy cli.py -- foo bar
# ['cli.py', 'foo', 'bar']Environment variables
| Variable | Description |
|---|---|
BUNPY_NO_COLOR | Disable ANSI color output |
BUNPY_MAX_DEPTH | Override the VM recursion limit (default 500) |