Skip to main content

fcvm for Python

A client for the HTTP API of fcvm, which runs disposable, isolated Firecracker microVMs with container ergonomics. Use it to give an agent framework, a test harness or a build pipeline real VM sandboxes: create one from any OCI image, run commands, move files, snapshot it and fork running copies in about 150 ms.

The client has no dependencies and needs Python 3.9 or newer. The VMs run on a Linux host with KVM where fcvm is installed; the client itself runs anywhere that can reach that host's API.

pip install fcvm
from fcvm import Client

c = Client()
with c.create("box", template="python-sandbox", ttl="1h") as sb:      # removed when the block ends
    out = sb.run("pip install -q requests && python -c 'import requests; print(requests.__version__)'")
    sb.write_file("/work/app.py", "print('hi')\n")
    print(sb.exec("python /work/app.py").stdout)                      # ExecResult: exit_code, stdout, stderr
    job = sb.exec("python -m http.server 8000", background=True)      # a Job
    port = sb.publish(8000)                                           # http://127.0.0.1:{port} on the host
    job.kill()

snap = c.sandbox("prepared").snapshot("ready")
forks = snap.fork("try", count=3)                                     # three running Sandbox objects

Client() finds the local fcvm service by itself. For another host, set FCVM_URL and FCVM_TOKEN. The token gives full control of fcvm, so treat it like an SSH key.

Apache License 2.0.

Metadata

Release files for fcvm 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fcvm 0.7.0
File Size Uploaded
fcvm-0.7.0.tar.gz 10.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fcvm 0.7.0
File Interpreter ABI Platform
fcvm-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.4 kB

Release files / fcvm-0.7.0.tar.gz

Download URL fcvm-0.7.0.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3b7a0c1ee7e499bf2f33304ed22c1c7585006e9c7fb213e50c788c986f98a5c7
BLAKE2b-256 checksum
How to use checksums
db0868846f1ae2ba201b1295437aa5f46f99a71e459ce2372d01f477de27269c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / fcvm-0.7.0-py3-none-any.whl

Download URL fcvm-0.7.0-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
577ab3260f5899e74faada3c552ae23e5ccbe7d1e74da44180f4b8b27cf7914c
BLAKE2b-256 checksum
How to use checksums
357e9506badf43ab138b899f812f3bfe8121a51f95932f35fc1115d86c8cb1cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page