Skip to main content

Lightweight, secure sandboxes for untrusted processes.

Project description

Vpod Python SDK

A lightweight, portable sandbox that gives an untrusted process an instant Linux environment.

GitHub CI

DocumentationIssues


It uses a RISC‑V architecture and runs entirely inside WebAssembly.

  • Fast startup : Boot in under a second.
  • Portable : Runs anywhere without any setup required.
  • Isolated : All execution state stays inside the WASM sandbox.

Installation

pip install vpod

Usage

Persistent session (Recommended)

All calls share the same running sandbox. Using a context manager (with) automatically cleans up resources when done:

from vpod import Sandbox

with Sandbox.create() as sbx:
    sbx.commands.run("export FOO=bar")
    sbx.commands.run("touch /tmp/data.csv")

    result = sbx.commands.run("echo $FOO")
    print(result.stdout)  # bar

Python REPL

Run Python code with persistent state across calls. Variables and imports persist for the lifetime of the session.

from vpod import Sandbox

with Sandbox.create() as sbx:
    sbx.code.run("import requests")
    sbx.code.run("data = [1, 2, 3]")
    result = sbx.code.run("print(sum(data))")
    print(result.text)  # 6

Advanced Configuration

You can mount local directories into the sandbox and specify which snapshot to use.

from vpod import Sandbox

# Mount a local workspace and use a snapshot with pre-installed data science tools
mounts = {"workspace": "/workspace:rw"}

with Sandbox.create(snapshot="vsnap-data", mounts=mounts) as sbx:
    sbx.code.run("import pandas as pd")
    sbx.code.run("print('Pandas is ready!')")

Suspend & Resume

Pause a running sandbox and resume it later — no daemon, no background process. Only dirty memory pages are saved, making it fast and storage-efficient.

from vpod import Sandbox

with Sandbox.create() as sbx:
    sbx.commands.run("uv pip install --system requests")
    instance_id = sbx.suspend()

# Later (even from a new process):
sbx = Sandbox.resume(instance_id)
sbx.code.run("import requests; print(requests.__version__)")
Method Description
sandbox.suspend() Suspend to disk, returns instance ID
Sandbox.resume(id) Resume a suspended instance
Sandbox.list_instances() List all instances
Sandbox.destroy(id) Delete a suspended instance from disk

Shell commands (stateless)

If you just need a quick one-off execution without preserving state:

from vpod import Sandbox

sbx = Sandbox.create()
result = sbx.commands.run("echo hello")
print(result.stdout)    # hello
sbx.close()             # Clean up the sandbox process

Snapshots

The first call to Sandbox.create() downloads the snapshot and caches it locally. Subsequent calls use the cache instantly.

To pre-download (e.g. in a Dockerfile or CI setup):

from vpod import snapshots

for s in snapshots.catalog():
    print(s["name"], s["tag"])

snapshots.pull("alpine:latest")

Available Snapshots

Name Tag Description Memory Limit (RAM)
alpine 3.23.0 Minimal Alpine Linux snapshot. 256 MB
vsnap-base 0.1.0 Alpine-based general-purpose snapshot with Python. 256 MB
vsnap-base-512mb 0.1.0 Same as vsnap-base with more memory headroom, for web servers and larger installs. 512 MB
vsnap-data 0.1.0 Alpine-based snapshot with numpy, pandas, and scipy. 512 MB

Documentation

Visit the Vpod documentation for the full guide and API reference. To report issues or contribute, head to the main GitHub repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vpod-0.5.0rc1.tar.gz (6.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vpod-0.5.0rc1-py3-none-any.whl (6.1 MB view details)

Uploaded Python 3

File details

Details for the file vpod-0.5.0rc1.tar.gz.

File metadata

  • Download URL: vpod-0.5.0rc1.tar.gz
  • Upload date:
  • Size: 6.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for vpod-0.5.0rc1.tar.gz
Algorithm Hash digest
SHA256 2d9c971a87148ffa28da34f8fc998066854dc7dcfde8069bb001be43465a106c
MD5 23fd93e6d9db8dd08d4ae8bbaf64caef
BLAKE2b-256 3f5e9497a6b5ce799beaba322ad57538b02f409c0d314c824acb187314cc2c41

See more details on using hashes here.

File details

Details for the file vpod-0.5.0rc1-py3-none-any.whl.

File metadata

  • Download URL: vpod-0.5.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 6.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for vpod-0.5.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 a607a154cc7a3a1be3457d9816732bf6003d11cf5a8201b50c88a76c83466739
MD5 bdcc05a48d26c0ffb44c6236f556be5b
BLAKE2b-256 280eb2ea77568e9d42b172ae8f21e586d98dbddc3bcd963f29190dc5b7496247

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page