PyO3 FFI bindings exposing the XQuad Rust runtime (xqvm + xqasm) to Python
Project description
xqffi — PyO3 FFI bindings for the XQuad Rust runtime
The Python extension that exposes the Rust xqvm interpreter and xqasm assembler. Ships as a manylinux wheel built by maturin.
xqffi is a pure FFI shim — it only re-exposes the Rust types and entry points. User-facing conveniences (Program / Session / RunResult, keyword calldata, trace inspection) live in the xquad umbrella package.
Install
pip install xqffi
Surface
xqffi.vm — low-level one-shot
What the conformance harness drives. Small wrapper over xqvm::Vm:
from xqffi.vm import Vm
from xqffi.asm import assemble_source
vm = Vm()
vm.set_calldata([40, 2])
vm.set_output_slots(1)
vm.run(assemble_source(src))
assert vm.outputs() == [42]
XqmxModel and XqmxSample are thin getter/setter wrappers around the Rust types for direct model/sample manipulation.
xqffi.asm — assembly
parse_xqasm(str) → wire dict; assemble_source(str) → raw bytes; disassemble(bytes) → human-readable listing; instruction_count(bytes) → instruction count.
Interactive / multi-run API
Use xquad.program for the REPL / notebook / script workflow:
from xquad.program import Program
program = Program.from_source(src)
session = program.session(output_slots=1)
session.set_calldata([40, 2])
result = session.run()
assert dict(result.outputs) == {0: 42}
Program.load(bytes) takes wire-format bytecode; Session.run() returns a RunResult with dict-keyed outputs (unset slots present as None), residual stack, and step count.
Also see
xqvm_py— pure-Python reference VM (conformance oracle).xqcp— constraint programming DSL that compiles to.xqasm.xqsa-- solver adapters (dwave-samplers).xquad— umbrella meta-package with the interactive API.docs/python-api-walkthrough.md— full tour.
License
AGPL-3.0-or-later.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
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 xqffi-0.2.1-cp313-cp313-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: xqffi-0.2.1-cp313-cp313-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 445.5 kB
- Tags: CPython 3.13, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
549a7bc1d16d3c55c116b1c2acb28c0cd93abf41cb11c18ef81a2aed4cc35225
|
|
| MD5 |
274a7db31148fec3f3c838692d42e1fb
|
|
| BLAKE2b-256 |
56e9e8c1ebff4802f7df44d61407e5026401d3529aab588c5a91eb12fa0e20b9
|