Python quickstart¶
From zero to running code in a microVM.
1. Install¶
2. Set your key¶
3. Run code¶
Save as hello.py:
from sistemo import Sandbox
with Sandbox() as sb:
result = sb.run("uname -a")
print(result.stdout)
print(result.exit_code) # 0
print(result.ok) # True
Or paste this in a terminal:
python3 -c "from sistemo import Sandbox; sb=Sandbox(); print(sb.run('uname -a').stdout); sb.close()"
4. Run several commands in one sandbox¶
A sandbox stays alive for the whole with block, so reuse it:
from sistemo import Sandbox
with Sandbox(stack="python") as sb:
sb.run("pip install requests", timeout=180)
r = sb.run("python3 -c 'import requests; print(requests.__version__)'")
print(r.stdout)
5. Pick an image¶
from sistemo import Sandbox
with Sandbox(stack="node") as sb: # base | python | node | ai | debian13 | ubuntu26.04
print(sb.run("node -v").stdout)
See Images for the catalog.
6. Size the sandbox¶
# Sandbox()'s default is 1 vCPU / 1 GB / 10 GB. A free account allows up to
# 2 vCPU / 2 GB per machine; 4 GB is a 400 until your first top-up.
sb = Sandbox(vcpus=1, memory_mb=1024, rootfs_size_gb=10)
try:
print(sb.run("uname -a").stdout)
finally:
sb.close()
Always clean up
Use with Sandbox() as sb: so the VM is destroyed automatically. If you create one manually, call sb.close() in a finally block — a leaked sandbox keeps billing.
Next: Sandbox API · Examples