Skip to main content

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

xquad is the Python distribution to install, and the only one XQuad publishes. It provides the interactive Program / Session / RunResult API, a VM wrapper over the Rust interpreter, and re-exports the lower-level packages (xqffi, xqcp, xqsa) under a single namespace.

Install

pip install xquad

The one wheel carries xqffi, xqcp and xqsa as well, importable under their own names, and the xquad command. Up to 0.5 they were separate distributions; from 0.6 they are not published on their own. Solver backends are extras: pip install xquad[dwave], and likewise cuda, metal and quip (see xqsa).

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

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

vm = VM()
vm.set_output_slots(1)
vm.run(programs.encoder)
model = vm.outputs()[0]

sample = sa.SolverCPU().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 VM wrapper over the Rust interpreter: assembles source, keeps calldata and limits across runs
xquad.types re-exports xqffi.vm Domain, XqmxModel, XqmxSample, triu, XqvmError and its faults, VM limits
xquad.asm is xqffi.asm parse_xqasm, assemble_source, disassemble
xquad.checker is xqffi.checker check, check_source
xquad.cp is xqcp DSL -- Problem, Types, expression builders
xquad.sa is xqsa Solvers -- SolverCPU, Solver

The raw FFI surface stays available as xqffi.vm.Vm.

Also see

  • xqffi -- PyO3 FFI bindings (low-level / conformance).
  • 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.6.0

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.6.0
File Size Uploaded Provenance Actions
xquad-0.6.0.tar.gz 750.6 kB Without provenance Details for xquad-0.6.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for xquad 0.6.0
File Interpreter ABI Platform Actions
xquad-0.6.0-cp313-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.13 abi3 Linux glibc 2.17+ x86-64 Details for xquad-0.6.0-cp313-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
xquad-0.6.0-cp313-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.13 abi3 Linux glibc 2.17+ ARM64 Details for xquad-0.6.0-cp313-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Total release size: 2.3 MB

Release files / xquad-0.6.0.tar.gz

Download URL xquad-0.6.0.tar.gz
Size 750.6 kB
Tags Source
SHA-256 checksum
How to use checksums
beb91d864fac75ccb40fa2f2717d1486308547667d0a46762fa59a31e6917520
BLAKE2b-256 checksum
How to use checksums
5eb2982363be6f1e1aa5f9648402bdf9d327ab030b045c4c1de1fe1b439c5c40
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.6.0-cp313-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL xquad-0.6.0-cp313-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 767.2 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
816cbdbb74cb07e7a418cd41c7fb930f12b8c088e88982dca448ac0f57b6bbe6
BLAKE2b-256 checksum
How to use checksums
f20fd232e397b6a463f3ea1ea42d90a976ed0dc2afeedd62b468a6ded6c6af6f
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.6.0-cp313-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL xquad-0.6.0-cp313-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 744.3 kB
Tags CPython 3.13 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
bc7bf269aa1007b3821054a55656d36c57b78ee9d463fb8ec757c5414d9b6fd7
BLAKE2b-256 checksum
How to use checksums
db9e9b2c2d5b4980fe9e0174953393f9841863544f0c72607f3c5fe7bff45bcc
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.6.0

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