Skip to main content

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xqffi-0.3.0.tar.gz (151.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

xqffi-0.3.0-cp313-abi3-manylinux_2_34_x86_64.whl (440.2 kB view details)

Uploaded CPython 3.13+manylinux: glibc 2.34+ x86-64

xqffi-0.3.0-cp313-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (429.5 kB view details)

Uploaded CPython 3.13+manylinux: glibc 2.17+ ARM64

File details

Details for the file xqffi-0.3.0.tar.gz.

File metadata

  • Download URL: xqffi-0.3.0.tar.gz
  • Upload date:
  • Size: 151.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for xqffi-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4d258a744452aa2c525f8e03c32c5f17be81b47c9a0aedad32463178b32319fe
MD5 5588c0d28d22e30f2c0aaa48f4f0098b
BLAKE2b-256 e8580fb524ab3e1f2ce258fc1f88d234959aca64f2f4f55061415b2114a98d10

See more details on using hashes here.

File details

Details for the file xqffi-0.3.0-cp313-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for xqffi-0.3.0-cp313-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e9366876c661760f1f3f4ef29b18a2ad4bf30718e7602f9e0f2ddb0da9764421
MD5 d5fae02d16db599ef5e68686a094c5ae
BLAKE2b-256 b33c023176d84ec1dd57caa871b8897539efb0dd3259386a5f4b52675aa9c1ff

See more details on using hashes here.

File details

Details for the file xqffi-0.3.0-cp313-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for xqffi-0.3.0-cp313-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 aebf0f01bdc6dceb07ee2b5fcec9c24e8e5532cbfb6943505c142afdf59c5de1
MD5 af19d2ebfc6893727685df011a49dc70
BLAKE2b-256 905c2596c7201720e862d2117f9435568dcdc64f54f8a22dc64bdf44ffab8b16

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page