Skip to main content

unkernel-rs for Python

Embeddable Linux 7.x micro-VM sandbox running inside WebAssembly (wasmtime) — zero Docker, zero KVM, zero root, zero Node.js.

Powered by unkernel-rs and pithings/unkernel.

Install

pip install unkernel-rs

On first boot, unkernel-rs downloads and SHA-256-verifies the pinned unkernel.wasm + alpine.erofs (~26 MB) into your local cache and AOT-compiles a .cwasm image for ~1s warm boots.

Quickstart

1. Disposable Air-Gapped Linux VM

import unkernel_rs

with unkernel_rs.Vm() as vm:
    res = vm.exec(["uname", "-a"])
    print(res.stdout_text)
    print(vm.active_processes())  # Level-3 SharedMemory VMI

2. Port Forwarding, SSH & Remote Desktop (VNC)

Forward any host TCP port into the guest with port_forwards=["127.0.0.1:2222:22"] — preview web servers (http://localhost:8000), SSH straight into the Wasm Linux VM with real OpenSSH, or even launch a full X11 + Fluxbox desktop over VNC:

import unkernel_rs

with unkernel_rs.Vm(net=True, port_forwards=["127.0.0.1:2222:22"]) as vm:
    vm.shell("apk add --no-cache dropbear && mkdir -p /etc/dropbear && dropbear -R -p 22", user="root")
    input("SSH ready on 127.0.0.1:2222 — press Enter to stop...")
  • SSH example: examples/ssh_into_vm.py (automatic ED25519 key setup, ~345 ms SSH round-trip, ~33 ms HTTP round-trip).
  • Remote Desktop (VNC) example: examples/desktop_vnc.py (Xvfb + Fluxbox + xterm + x11vnc on vnc://127.0.0.1:5900, persisted on a 4 GiB sparse ext4 disk so subsequent boots take ~3–5s).

3. Copy-on-Write Workspace & Counterfactual Branching

import unkernel_rs

with unkernel_rs.Vm(mounts=["./repo:/work:cow"]) as vm:
    vm.shell("echo base > /work/state.txt")
    snap = vm.snapshot()

    with snap.branch() as branch_a, snap.branch() as branch_b:
        branch_a.shell("echo fix_a >> /work/state.txt")
        branch_b.shell("echo fix_b >> /work/state.txt")

        print(branch_a.workspace_diff("/work"))
        branch_a.commit_workspace("/work")  # commit winner, discard loser

4. Zero-MITM Level-3 VMI TLS Inspection & Audit Stream

import unkernel_rs

events = []
with unkernel_rs.Vm(
    net=True,
    allow_hosts=["example.com"],
    vmi_tls=True,
    on_audit=events.append,
) as vm:
    res = vm.shell("wget -qO- https://example.com | head -n 1")
    print(res.stdout_text)

for ev in events:
    if ev["event"] == "net.tls_decrypted":
        print(ev["direction"], ev.get("http_summary"), ev["proc"])

5. Freeze-on-Ask Policy Callback

import unkernel_rs

def approve(req: dict) -> str:
    # Entire guest kernel + monotonic clock are frozen while this runs!
    return "allow_once" if "example.com" in req["target"] else "deny_once"

with unkernel_rs.Vm(
    net=True,
    allow_hosts=["example.com"],
    ask_net=True,
    freeze_on_ask=True,
    on_approval=approve,
) as vm:
    res = vm.shell("wget -qO- https://example.com | head -n 1")

6. Built-In MCP Server (unkernel-mcp)

Installing unkernel-rs also installs the unkernel-mcp stdio JSON-RPC 2.0 server for Claude Desktop, Claude Code, Cursor, Antigravity, and OpenCode — exposing vm_exec, vm_snapshot, vm_branch_exec, vm_diff, vm_read_file, vm_commit, vm_discard, and vm_inspect:

{
  "mcpServers": {
    "unkernel": {
      "command": "uvx",
      "args": ["--from", "unkernel-rs", "unkernel-mcp", "--mount", ".:/work:cow"]
    }
  }
}

License

Dual-licensed under MIT OR Apache-2.0. Upstream unkernel Linux kernel images (GPL-2.0-only) are fetched at runtime and never bundled in this wheel.

Metadata

Release files for unkernel-rs 0.7.0

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

Built distributions (wheels)

Table of built distributions (wheels) for unkernel-rs 0.7.0
File Actions
unkernel_rs-0.7.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for unkernel_rs-0.7.0-cp39-abi3-win_amd64.whl
unkernel_rs-0.7.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for unkernel_rs-0.7.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
unkernel_rs-0.7.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for unkernel_rs-0.7.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
unkernel_rs-0.7.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for unkernel_rs-0.7.0-cp39-abi3-macosx_11_0_arm64.whl

Total release size: 22.3 MB

Release files / unkernel_rs-0.7.0-cp39-abi3-win_amd64.whl

Download URL unkernel_rs-0.7.0-cp39-abi3-win_amd64.whl
Size 6.0 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
e144ab862e0b24d4a54532ea28eb5e1f90c6e5a811f83b03d7502a684ec47ffa
BLAKE2b-256 checksum
How to use checksums
6588142e56cdfb8e952ba248a01d420777330d9e46efa30cc16938212820535a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / unkernel_rs-0.7.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL unkernel_rs-0.7.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 6.1 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
1d072b18f08ab22e8e42a97d92d0d9f8fb71159f7e180755836b9110db6344b5
BLAKE2b-256 checksum
How to use checksums
973ceac0adf8c14b3780938ae6299eb65f911361d102da1c03089cde8f8d6d72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / unkernel_rs-0.7.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL unkernel_rs-0.7.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 5.2 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
325f83a5923e334ced8168c3d2ae6ecc9437ca3867f3ff826c7283e9ad21e15a
BLAKE2b-256 checksum
How to use checksums
0e89512f1b9e65db4c3c5c4c810af537c1bd2ae68fc8ec4df27155b9e8173b44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / unkernel_rs-0.7.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL unkernel_rs-0.7.0-cp39-abi3-macosx_11_0_arm64.whl
Size 5.0 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
412cc3f6c177ee028785702bdf1eeb45a6291832bc64fa866bd858569ec73b6d
BLAKE2b-256 checksum
How to use checksums
dc3075bba80177b4ae03f2bad31165ee865e47d2e878d945a2cd523c365372a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for unkernel-rs 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for unkernel_rs-0.7.0-cp39-abi3-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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