Skip to main content

xquad -- Primary user-facing package for the XQuad toolchain

xquad is the Python distribution most users should install. It provides the interactive Program / Session / RunResult API, a unified VM wrapper that dispatches to either the Rust or Python interpreter, and re-exports the lower-level peer packages (xqffi, xqcp, xqsa) under a single namespace.

Install

pip install xquad

Pulls xqffi, xqcp, xqsa, and xqvm_py as runtime dependencies. Peer installs stay valid (pip install xqffi xqcp xqsa) if you only need a subset.

Interactive usage

Load a program once, run it with different calldata, inspect outputs by slot:

from xquad.program import Program

program = Program.from_source("""
PUSH 0
INPUT r0
PUSH 1
INPUT r1
LOAD r0
LOAD r1
ADD
STOW r2
PUSH 0
OUTPUT r2
HALT
""")

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.

Full pipeline

Compile a problem via the DSL, execute, sample:

from xquad import cp, sa
from xquad.vm import VM, VMBackend

problem = cp.Problem("MyProblem")
# ... define inputs, model, objective, decoder ...
programs = problem.compile()

vm = VM(backend=VMBackend.RUST)   # or VMBackend.PYTHON for the reference interpreter
vm.set_output_slots(1)
vm.run(programs.encoder)
model = vm.outputs()[0]

sample = sa.SolverDWaveCPU().solve(model).sample

Re-exports of peer packages are identity, not copies:

import xquad, xqcp
assert xquad.cp.Problem is xqcp.Problem   # always True

So isinstance works whether the caller imported directly from the peer or via the umbrella.

Subnamespaces

xquad.* Origin Contents
xquad.program first-party Interactive API -- Program, Session, RunResult
xquad.vm first-party Unified VM wrapper with backend dispatch (VMBackend.RUST / VMBackend.PYTHON)
xquad.types first-party Canonical Python type aliases used across the API
xquad.asm is xqffi.asm parse_xqasm, assemble_source, disassemble
xquad.verifier is xqffi.verifier verify, verify_source
xquad.cp is xqcp DSL -- Problem, Types, expression builders
xquad.sa is xqsa Solvers -- SolverDWaveCPU, Solver

Lower-level escape hatches remain available directly via the peer packages (xqffi.vm.Vm for the raw FFI one-shot surface; xqvm_py.Executor for the pure-Python reference VM).

Also see

  • xqffi -- PyO3 FFI bindings (low-level / conformance).
  • xqvm_py -- pure-Python reference VM (conformance oracle).
  • xqcp -- constraint-programming DSL.
  • xqsa -- solver adapters.
  • Running Programs -- end-to-end tour including the Program/Session, xqffi.vm, and xquad.vm surfaces.

License

AGPL-3.0-or-later.

Metadata

Release files for xquad 0.4.5

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

Source distribution (sdist)

Source distribution for xquad 0.4.5
File Size Uploaded Provenance Actions
xquad-0.4.5.tar.gz 42.8 kB Without provenance Details for xquad-0.4.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xquad 0.4.5
File Interpreter ABI Platform Actions
xquad-0.4.5-py3-none-any.whl Python 3 none any Details for xquad-0.4.5-py3-none-any.whl

Total release size: 73.3 kB

Release files / xquad-0.4.5.tar.gz

Download URL xquad-0.4.5.tar.gz
Size 42.8 kB
Tags Source
SHA-256 checksum
How to use checksums
87aa6192bb549cde6ecf40e60ae12bc3c4208f00ae8e1a903929ead9c98fc48a
BLAKE2b-256 checksum
How to use checksums
c42f25b9f147fea2e99e153b1c07e83a50641936e6f9be0a4181e990e2c08097
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / xquad-0.4.5-py3-none-any.whl

Download URL xquad-0.4.5-py3-none-any.whl
Size 30.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b2e7d2afc58fa699eb5ffe75459b5852627cb60c3ac359290c837a0f9c3f441
BLAKE2b-256 checksum
How to use checksums
fee8fe19304d15f0fdbea924b09e96045d72cf91381ebc444305e4f32e76edc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.5

Security for xquad 0.4.5

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