This release is a pre-release and may not be stable for production use.
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 |
re-exports xqffi.asm |
parse_xqasm, assemble_source, disassemble |
xquad.verifier |
re-exports xqffi.verifier |
verify, verify_source |
xquad.cp |
re-exports xqcp |
DSL -- Problem, Types, expression builders |
xquad.sa |
re-exports 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, andxquad.vmsurfaces.
License
AGPL-3.0-or-later.
Release files for xquad 0.4.0rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xquad-0.4.0rc1.tar.gz | 14.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xquad-0.4.0rc1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.8 kB
Release files / xquad-0.4.0rc1.tar.gz
| Download URL | xquad-0.4.0rc1.tar.gz |
|---|---|
| Size | 14.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9a650960a00ae540bc195446f371601897fafd962ca6ad738447b6a4d13fe926
|
|
BLAKE2b-256 checksum How to use checksums |
76e5a89b1847b8e444f2b8c8417caf9c824da6820fc8a57057c2a0b1663ac296
|
| 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.0rc1-py3-none-any.whl
| Download URL | xquad-0.4.0rc1-py3-none-any.whl |
|---|---|
| Size | 13.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2ae3633df98523269f84b01313cf1dc8e8bb01e4b42d60188eadef301a337ab8
|
|
BLAKE2b-256 checksum How to use checksums |
9a2f32beb37d45c275324a4c1711f205e3117c1f27cf1bd73ad5fbdee30e722d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|