Skip to content

bunpy run

bunpy run [flags] <script.py> [-- script-args...]
bunpy <script.py> [script-args...]   # shorthand

Description

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

FlagDefaultDescription
--inspectoffPrint IR size, module list, and timing breakdown, then exit
--quiet, -qoffSuppress runtime warnings
--env-file <path>.envLoad environment variables from a file before running
--watch, -woffRe-run the script when source files change
--help, -hPrint help

Examples

Run a script:

bunpy run hello.py
bunpy hello.py       # identical

Pass arguments to the script (available as sys.argv):

bunpy run cli.py -- --port 8080 --debug

Inspect 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 ms

Load a .env file:

bunpy run --env-file .env.production server.py

Watch mode - re-runs on every save:

bunpy run --watch dev.py

Script 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

VariableDescription
BUNPY_NO_COLORDisable ANSI color output
BUNPY_MAX_DEPTHOverride the VM recursion limit (default 500)