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

A small wrapper over xqvm::Vm, and what xquad.vm.VM builds on:

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. They refuse what bytecode could not build: a size over MAX_ALLOCATION_SIZE (InvalidAllocation) or a grid that does not fit (InvalidGridDimensions), a sample value outside its domain (ValueError), and a coefficient index outside 0..size, negative included (IndexOutOfBounds). The three faults are XqvmError subclasses, so RuntimeError.

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

  • 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.

Metadata

Release files for xqffi 0.5.1

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.5.1
File Size Uploaded Provenance Actions
xqffi-0.5.1.tar.gz 297.5 kB Without provenance Details for xqffi-0.5.1.tar.gz

Built distributions (wheels)

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

Total release size: 1.3 MB

Release files / xqffi-0.5.1.tar.gz

Download URL xqffi-0.5.1.tar.gz
Size 297.5 kB
Tags Source
SHA-256 checksum
How to use checksums
134470d4d0e940e03f67a31613572fd5257296a0e548e39672946c16769e5d0f
BLAKE2b-256 checksum
How to use checksums
b8b54a81854957a458047b94b8223ca2f3d66053142c6337144eff066524d102
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.5.1-cp313-abi3-manylinux_2_34_x86_64.whl

Download URL xqffi-0.5.1-cp313-abi3-manylinux_2_34_x86_64.whl
Size 507.7 kB
Tags CPython 3.13 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
dd38723b64c244ea6c6907d2d1d190c023ff85088fe52fa8b8a625b593d9a6de
BLAKE2b-256 checksum
How to use checksums
f73ce6ec0e0fab301f0f46bf7ae02a0151994d2473822aec0ff938c45ccc9b65
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.5.1-cp313-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

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

Security for xqffi 0.5.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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