Skip to main content

xqffi -- PyO3 FFI bindings for the XQuad Rust runtime

The Python extension that exposes the Rust xqvm interpreter and xqasm assembler. Ships as abi3 manylinux wheels (x86_64 + aarch64, CPython >= 3.13) plus a universal sdist for other platforms, all 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.

xqffi.verifier -- static verification

verify(bytes) and verify_source(str) run the pre-execution verifier: every jump lands on a TARGET, every register is read after it is written, and stack depth balances. Both return None on success and raise ValueError on a rejected program. See Verifier.

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: CPU/GPU annealers, D-Wave QPU, Quip network.
  • xquad -- umbrella meta-package with the interactive API.
  • Running Programs -- full tour.

License

AGPL-3.0-or-later.

Release files for xqffi 0.3.2

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

Source distribution (sdist)

Source distribution for xqffi 0.3.2
File Size Uploaded
xqffi-0.3.2.tar.gz 153.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for xqffi 0.3.2
File Interpreter ABI Platform
xqffi-0.3.2-cp313-abi3-manylinux_2_34_x86_64.whl CPython 3.13 abi3 Linux glibc 2.34+ x86-64 Details
xqffi-0.3.2-cp313-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.13 abi3 Linux glibc 2.17+ ARM64 Details

Total release size: 1.0 MB

Release files / xqffi-0.3.2.tar.gz

Download URL xqffi-0.3.2.tar.gz
Size 153.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bdfebbb86638e52c53690cb226c290524a3e28a9d0c17d4cd509fca6b65eea23
BLAKE2b-256 checksum
How to use checksums
fa85c116be53e9dc59befd0ddd3ee9515b384e4c891ccf4a539ab58d75c7b75f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / xqffi-0.3.2-cp313-abi3-manylinux_2_34_x86_64.whl

Download URL xqffi-0.3.2-cp313-abi3-manylinux_2_34_x86_64.whl
Size 440.4 kB
Tags CPython 3.13 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
c24db7c9ddd59a7a1874d240ca1311ea84ca4a49fb3dbb72ba0d18f74174f92e
BLAKE2b-256 checksum
How to use checksums
7e8068949d15f4d018d5feb8ede9004353e167f38496933b850f51f64a8f82da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / xqffi-0.3.2-cp313-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL xqffi-0.3.2-cp313-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 429.9 kB
Tags CPython 3.13 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
d51dc7e98a011ad224edbcec67d9eace0a774c8eed9e6b829ef289547b1bf50b
BLAKE2b-256 checksum
How to use checksums
5436e2db197bb121839c7f58d973dc5ab3ef7fc36a30080436368e395725d429
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.5

Release history Release notifications | RSS feed

0.4.0

3 release files

This release

0.3.2 This release

3 release files

0.3.1

3 release files

0.3.0

3 release files

0.2.1

1 release file

0.2.0

2 release files

0.0.0

2 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