virtx for Python
Python bindings for virtx: the same ConsoleClient, ImageClient, Recipe,
Directory and host mount as the Rust crate, with every call that waits as an awaitable.
from virtx import ConsoleClient, Directory, HostMount, Recipe
mount = HostMount(Directory().with_file("SKILL.md", "..."), "/tmp/skill")
async with await (
ConsoleClient.builder()
.cmd(["virtx-uvm"])
.image(Recipe("python:3.12-slim-trixie").step("pip install duckdb"))
.mount_readonly(mount, "/skills/example")
.mount("./artifacts", "/artifacts")
.network(False)
.vcpus(2)
.memory_mib(2048)
.build()
) as console:
result = await console.exec(["sh", "-c", "ls /skills/example"], timeout_ms=10_000)
print(result.code, result.stdout.decode())
Without .cmd(..) a console runs virtx-uvm from the bin directory of virtx's cache
($VIRTX_HOME, or the host's cache directory: see Cache).
An image can also be built ahead of the session that runs on it, and then named by its ref or its digest:
from virtx import ImageClient, ImageSource, Recipe
async with await ImageClient.try_new() as images:
built = await images.build(Recipe("alpine:3.20").step("apk add jq"), "myimg:latest")
print(built.reference, built.digest)
for image in await images.list():
print(image.digest, image.refs)
console = await ConsoleClient.builder().image(ImageSource.digest(built.digest)).build()
A ConsoleClient from this package can be handed to an ailoy
agent as is (AgentBuilder(...).console(console)): the agent shares its session, taking turns
with your own calls one at a time, and close() ends the session for both.
Building
The extension is built with maturin. The mount feature is on by
default and needs the host's FUSE provider, as the crate does — see the top-level README.
cd bindings/python
uv sync # makes .venv and installs the dev group
uv run maturin develop # builds the extension into it
uv run pytest
uv run maturin build --release makes a wheel. The crate's other features pass through:
maturin develop --features s3,notion.
The console tests at the end of tests/test_virtx.py need a console server, named by
$VIRTX_CONSOLE; without one they are skipped.
Metadata
Release files for virtx 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| virtx-0.1.2-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| virtx-0.1.2-cp310-abi3-manylinux_2_28_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| virtx-0.1.2-cp310-abi3-manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| virtx-0.1.2-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 15.9 MB
Release files / virtx-0.1.2-cp310-abi3-win_amd64.whl
| Download URL | virtx-0.1.2-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 3.5 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
6d9256e020a73aa21b1973fe68ebce2a0aaa6ad9c9c5b0c2d4bb34f0c54dc808
|
|
BLAKE2b-256 checksum How to use checksums |
b4576ad20465e3cd61986c10f829160ea3e1017f3b8a942268ac9eb80448d4da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / virtx-0.1.2-cp310-abi3-manylinux_2_28_x86_64.whl
| Download URL | virtx-0.1.2-cp310-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.3 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
753fa58feb446c5e53fa25bdbac652d94a398e68c3c258d5ceb658acd64d6fb9
|
|
BLAKE2b-256 checksum How to use checksums |
61153012a43f1e8a25efaf89de50cdaf1a2e584b35e36a0ca8154cbb0d1d8b43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / virtx-0.1.2-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | virtx-0.1.2-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 4.3 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
97b77deea964d017696f2a4aca00492d24efa304e94f4bb9a6bf083dcd22db0f
|
|
BLAKE2b-256 checksum How to use checksums |
6ea23e2869215bce8fd46ef0b8eb220594fcee792c82a996c28f7110a9458db0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / virtx-0.1.2-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | virtx-0.1.2-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 3.8 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b457c46007bbf070c9cfbaf78efe4b33067fc821e984c6e1601990bbc26174e8
|
|
BLAKE2b-256 checksum How to use checksums |
18b7327e229abfb53d50cbb2af97d953bd64494471bd686aa4e5a7273c410db6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|