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.1.tar.gz (9.6 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.1-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xquad-0.3.1.tar.gz
  • Upload date:
  • Size: 9.6 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.1.tar.gz
Algorithm Hash digest
SHA256 b5c7ae481e4905d7fc1dbc03a6056b50bf9e8afc333e8bad52d70210b15cdb38
MD5 3f7bec46aff9c06e1a963d2b704dd51b
BLAKE2b-256 8dbd0d93af32b48d51e1f43eb09bd5965a1c4319eeeb4f1c1d108fb3c2baedfa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xquad-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 16.2 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6507edba0328c1e2b517cab760c5e8a3938c8c440442fef66c3bd987f957c84a
MD5 3ff829991a100214456254e682984364
BLAKE2b-256 d710f8af5b2399e573c394e7667acaf3582a6ce356ee93ce6d07f9f81d027873

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