Skip to main content

ix-sdk

Generated Python bindings for ix. The Rust ix-sdk owns every platform verb; Unibind generates the asyncio classes, typed records, exception classes and .pyi stubs from that contract, so the Python surface never drifts from the platform.

Python 3.13 or newer. The package ships py.typed and generated stubs, so pyright and mypy see the same methods and records the native module exports.

boot a machine

The credential resolves from IX_TOKEN, then the ix config file written by ix login, so there is no client to configure. The machine answers by the time create returns.

import asyncio

import ix_sdk


async def main() -> None:
    client = ix_sdk.Client()
    machine = await client.machines().create(ix_sdk.CreateMachineOptions(name="sdk-example"))
    try:
        result = await machine.exec_checked(["uname", "-a"])
        print(result.stdout.strip())
    finally:
        await machine.delete()


asyncio.run(main())

async with deletes a machine the handle booted at the end of the block, exception or not. Bind it with a plain = when the machine is meant to outlive the program; a machine outlives the process that made it, and client.machines().connect(machine_id) reattaches later.

boot from your repository's flake

Pass a sha-pinned flake reference as the template and the platform builds it in-guest on first use, publishes the result to the region's template cache, and boots every later create warm from that cache. Builds are single-flight region-wide, and create_stream carries the live build log:

options = ix_sdk.CreateMachineOptions(
    template="github:owner/repo/0123456789abcdef0123456789abcdef01234567#ci-runner",
)
stream = await client.machines().create_stream(options)
async for frame in stream:
    if frame.stderr:
        print(frame.stderr, end="")
    if frame.finished:
        machine = client.machines().connect(frame.machine_id)

everything else

Every verb is a method on the generated surface: machine.exec, machine.read_file, machine.write_file, machine.snapshot, machine.tail_logs, client.keys().create, and so on. Streams are async for iterables, and dropping the iterator cancels the work behind it.

Records are typed objects with documented read-only properties and a readable repr, and every record is dict-like: dict(machine), {**machine} and machine["status"] all work, so a list of records drops straight into a DataFrame.

The one piece of language-owned sugar is Repl, a stateful interpreter inside a machine:

repl = await ix_sdk.Repl.open(machine, "python")
await repl.exec("x = 21")
out = await repl.exec("print(x * 2)")

docs

Metadata

Release files for ix-sdk 0.7.2

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

Built distribution (wheel)

Table of built distributions (wheels) for ix-sdk 0.7.2
File Interpreter ABI Platform
ix_sdk-0.7.2-cp313-abi3-manylinux_2_34_x86_64.whl CPython 3.13 abi3 Linux glibc 2.34+ x86-64 Details

Release files / ix_sdk-0.7.2-cp313-abi3-manylinux_2_34_x86_64.whl

Download URL ix_sdk-0.7.2-cp313-abi3-manylinux_2_34_x86_64.whl
Size 3.9 MB
Tags CPython 3.13 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
377b6e31cbc490faf888f9e3b84fbbe52f9af60d011fb6b3627e237b806010ec
BLAKE2b-256 checksum
How to use checksums
f42d660f25de784412409ddc55656e3dd815ab76c3ea558a1391609088d7f395
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release history Release notifications | RSS feed

This release

0.7.2 This release

1 release file

0.7.1

1 release file

0.7.0

1 release file

0.6.0

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.1.0

4 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