vmon Python SDK
Thin Python client SDK for the Rust vmon API. The Rust vmon binary owns the CLI, vmon serve gRPC/HTTP/WebSocket server, and VMM runtime; this package only provides Python objects for talking to that API.
Install
For development from the repository root:
uv sync --project sdk/py --python 3.14
The vmon distribution supports Python 3.14 and newer. The SDK expects a running Rust daemon/server. By default it talks to the local Unix socket at $VMON_HOME/vmond.sock (or ~/.vmon/vmond.sock). Named remote contexts are stored under $VMON_HOME/contexts.json, and bearer tokens can come from VMON_API_TOKEN or $VMON_HOME/credentials/<context>.token.
Local release package
From the repository root, build and validate the wheel and source distribution:
./scripts/package-python-sdk.sh
The script cleans sdk/py/dist/, builds vmon with Python 3.14, checks both distributions' metadata, installs the wheel and its dependencies into an isolated Python 3.14 environment, and verifies that import vmon resolves from that environment's installed wheel with a package version matching the distribution metadata. It does not publish or read upload credentials.
The publishable wheel and source distribution remain in sdk/py/dist/. The script also creates the deterministic release bundle and checksum consumed by the release workflow:
dist/vmon-python-sdk-<version>.tar.gz
dist/vmon-python-sdk-<version>.tar.gz.sha256
To inspect or install the locally built wheel:
uvx --python 3.14 twine check sdk/py/dist/*
uv pip install --python 3.14 sdk/py/dist/vmon-*.whl
Publishing to a package index is outside this local packaging workflow. The script does not invoke an upload command or read upload credentials.
Quick start
import vmon
with vmon.connect("vmon://node-a,node-b") as client:
assert client.health().ok is True
work = client.volumes.create("work")
with client.sandboxes.create(
image="alpine:latest",
env={"APP_ENV": "dev"},
secrets=[vmon.Secret.from_env("API_TOKEN")],
volumes={"/data": work},
) as sandbox:
captured = sandbox.run("sh", "-lc", "printf captured")
assert captured.returncode == 0
assert captured.stdout == b"captured"
process = sandbox.exec("sh", "-lc", "echo hello > /data/out && cat /data/out")
assert process.wait(timeout=30).code == 0
template = sandbox.snapshot_filesystem("alpine-ready")
restored = client.sandboxes.create(template=template)
restored.terminate()
Public surface
connect()parses local, HTTP(S), multi-host mesh, Unix-socket, and named-context DSNs and returns aClient.MeshDriverdiscovers peer advertise URLs lazily, fails over only on transport errors, and keeps sandbox calls pinned to the node that owns them.Clientexposessandboxes,snapshots,volumes,pools, andmeshresource namespaces. Health, server info, and event calls return the exportedHealth,ServerInfo, andEventRecordmodels; Prometheus metrics remain text.Sandboxis a bound resource.run()captures a command;exec()opens a streamingProcess;filesandportsexpose bound filesystem and proxy operations. Runtime metrics, network policy, and tunnels returnSandboxMetrics,SandboxNetworkPolicy, andTunnelSet. Lifecycle methods return typedSandboxInfoviews with desired/observed state, transition generation and failure, HA tier, and restart policy;RecoveryPoint.kindisdiskorcheckpoint.Process.wait()returnsExecExit; stdin is available throughprocess.stdin, and stdout/stderr remain closeable byte streams. Console, event, log, and file streams are closeable context managers.VolumeandSecretare validated request values. Server-side volume lifecycle lives underclient.volumes; secret values stay in memory and are sent only in create and exec requests.APIError,TransportError, andProtocolErrordistinguish server envelopes, failover-eligible I/O failures, and malformed wire data.sandbox.aio,sandbox.files.aio, andsandbox.ports.aioprovide thread-backed async forms of the synchronous object hierarchy.client.function()and@vmon.functionpackage source-available callables into server-native durable functions. Calls are recorded before execution, expose stableFunctionCallIDs, resumable events/results,spawn()and boundedmap()forms, and server-owned retries with at-least-once attempt semantics. Portable values use JSON/CBOR envelopes; explicitly trusted Python serialization supports richer values.@vmon.clsdefines durable actors with@vmon.method/@vmon.enter/@vmon.exitlifecycle hooks, andvmon.is_remote()reports worker-side execution.
Durable lifecycle
pause() retains the live VM. resume() resumes a paused VM or restores the
exact committed checkpoint of a durably suspended sandbox. suspend() releases
the live VM only after the checkpoint and lifecycle state commit; failure leaves
the previous VM authoritative. Recovery history is oldest to newest: disk
points cold-boot and checkpoint points restore VM execution state.
suspended = sandbox.suspend()
assert suspended.desired_state == suspended.observed_state == "suspended"
resumed = sandbox.resume()
point = sandbox.history()[-1]
restored = sandbox.rollback(point.name)
assert resumed.observed_state == restored.observed_state == "running"
Real-VM SDK smoke test
From the repository root, after building the Rust binary and enabling real-VM e2e prerequisites:
VMON_BIN=$PWD/target/debug/vmon VMON_E2E=1 uv run --python 3.14 python sdk/py/e2e.py
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vmon-0.2.1.tar.gz.
File metadata
- Download URL: vmon-0.2.1.tar.gz
- Upload date:
- Size: 171.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
773a4ea1d40bcc89e8e9de4d771cb61a8fcdefc10b71c71b2f4d28181a01e285
|
|
| MD5 |
2932032cd456d2c58e5f872e778b837f
|
|
| BLAKE2b-256 |
bc386f36d1555a95b2a6d29b6885d0c7683654380f0403b20d1d097dd65984e9
|
File details
Details for the file vmon-0.2.1-py3-none-any.whl.
File metadata
- Download URL: vmon-0.2.1-py3-none-any.whl
- Upload date:
- Size: 153.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
785876185c52b974afade066b5943cfb810df99230482eff23b108042cec5bce
|
|
| MD5 |
fe45e8424c95f6b971c56056bd77b5a0
|
|
| BLAKE2b-256 |
c61b264596430282adfaaa2f0f7c2a9860681d6530989d8b80a0fec2f87fb781
|