Skip to main content

Umbrella meta-package for the XQuad toolchain — re-exports xqffi, xqcp, xqsa under a unified namespace.

Project description

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.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.
  • docs/python-api-walkthrough.md — end-to-end tour including both the direct-peer and umbrella import styles.

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

xquad-0.3.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

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

xquad-0.3.0-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for xquad-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e984784a9179e6cf2121a5e02f9e8c7d511b2b04598037fd4699b62e715d7e9c
MD5 66cb6546534b7b3cc4cc27649dd51caa
BLAKE2b-256 f04e435448463017bf80ae115671c9224ce26a97760648f5aede2c097eb08450

See more details on using hashes here.

File details

Details for the file xquad-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: xquad-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for xquad-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 75bb3b16d58d8bb297f3569cd3c53b04c58a9b58fe1b7771b0c81cee8543a666
MD5 0e8d930e61cfc894c908cb054e29fa63
BLAKE2b-256 f6e39087ce21b9581ebdc958ee4d4ce5a7ce13438430cb33023700d17a6c602f

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