QuantumRouter
Unified interface for quantum cloud providers. One API, any backend.
Installation •
Quick start •
Examples •
Adding a vendor •
License
Introduction
QuantumRouter is a Python library that provides a unified interface to multiple quantum cloud providers. Switching from one vendor (LingYun, IBM Quantum, TianYan, WuYue, ...) to another is a one-line change — the calling code stays identical.
The library exposes a vendor-agnostic Provider / Backend / Transport
abstraction. Each concrete vendor lives under
quantumrouter/providers/<vendor>/ and self-registers with a process-wide
registry on import. Vendor subpackages are imported lazily, so installing
one vendor never forces you to install another's dependencies.
Installation
From PyPI (recommended)
pip install quantumrouter
This installs the core package plus its base dependencies
(qiskit, requests). Vendor-specific third-party dependencies are not
pulled in by default — install the extras you need:
pip install "quantumrouter[lingyun]" # LingYun deps only (numpy)
pip install "quantumrouter[ibm]" # IBM Quantum deps (qiskit-ibm-provider)
pip install "quantumrouter[tianyan]" # TianYan deps (cqlib-adapter)
pip install "quantumrouter[wuyue]" # WuYue deps (wuyue)
pip install "quantumrouter[all]" # every vendor's deps at once
Multiple extras can be combined, e.g. pip install "quantumrouter[lingyun,ibm]".
Note — quote the extras argument (
"quantumrouter[all]") so your shell doesn't interpret the brackets.
Quick start
import quantumrouter
provider = quantumrouter.create_provider(
backend="lingyun", # change this to switch vendors
url="http://xx.xxxx.xx:8000", # cloud / simulation server
token="...", # optional for the simulation server
)
backends = provider.backends(online=True)
backend = backends[0]
task_ids = backend.submit_job(["QINIT 4\nH 0"], shots=1024)
results = backend.query_job(task_ids)
config = backend.fetch_configuration()
Use backend.run(...) instead of submit_job(...) to build a quantum circuit
with qiskit, run it, and fetch a Result object (including measurement
counts) in one call — see examples/basic_usage.py.
The same entry point selects a PCIe transport when the URL scheme is
pcie:// — the calling code does not change:
provider = quantumrouter.create_provider(
backend="lingyun",
url="pcie:///dev/quantum0",
)
Examples
The examples/ directory contains runnable, vendor-specific demos:
| Example | Vendor | What it shows |
|---|---|---|
| basic_usage_lingyun.py | LingYun | LingYun-specific flow |
| basic_usage_tianyan.py | TianYan | TianYan-specific flow with transpile |
| basic_usage_wuyue.py | WuYue | WuYue mobile cloud flow |
| multi_vendor.py | LingYun + IBM | switch vendors with one parameter |
| pcie_transport.py | LingYun | select a PCIe transport via URL scheme |
Run any of them with, for example:
python examples/basic_usage.py
Most examples accept connection details from environment variables
(LINGYUN_TOKEN, LINGYUN_URL, IBM_QUANTUM_TOKEN, ...) — set the ones you
need before running.
Architecture
quantumrouter/
├── transport/ # generic wire layer (HTTP, PCIe, …)
├── backend/ # generic backend contract
├── provider/ # Provider abstract base + registry + factory
└── providers/ # one subpackage per cloud vendor
├── base.py / registry.py # shared abstraction + registry
├── __init__.py # lazy __getattr__ for vendor subpackages
├── ibm/ # IBM Quantum (qiskit-ibm-provider)
├── lingyun/ # LingYun — HTTP / PCIe, QCIS & OpenQASM3
├── tianyan/ # TianYan — cqlib-adapter
└── wuyue/ # WuYue — wuyue SDK
Three layers, top-down:
- Transport (
transport/) — owns the wire bytes. HTTP and PCIe implementations live here behind a commonTransportinterface. - Backend (
backend/) — wraps one quantum computer or simulator. Exposes the operations users care about: listing, submitting, querying, fetching calibration. - Provider (
provider/) — the per-vendor entry point. Builds a transport from aConnectionConfig, hands it to a transport-backed client, and lists backends.
A single factory, create_provider(backend=..., url=..., token=...), ties the
layers together. The transport type (HTTP or PCIe) is inferred from the URL
scheme via ConnectionConfig.from_url().
Adding a vendor
- Create
quantumrouter/providers/<vendor>/with:provider.py— aProvidersubclass implementingbackends()andbackend(name), self-registering withProviderRegistry.register(<YourProvider>)at import time.client.py— a transport-backed API client for the vendor's REST surface.backend/—Backendsubclasses binding the generic contract to the vendor's response format.
- Add the vendor id to
_VENDOR_PACKAGESinquantumrouter/providers/__init__.pyso the lazy__getattr__picks it up. - Add an optional-dependencies group (e.g.
[<vendor>]) inpyproject.tomlfor the vendor's third-party deps, and include it in the[all]aggregate.
Vendor packages self-register once their subpackage is imported, which the
registry triggers automatically the first time
create_provider("<vendor>", ...) is called. Use only the vendors you have
deps for; the others stay unloaded.
License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quantumrouter-0.0.5-py3-none-any.whl.
File metadata
- Download URL: quantumrouter-0.0.5-py3-none-any.whl
- Upload date:
- Size: 69.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a6c015936cebeba33b52bfb85324c512d7447bec549490d74fa5b0860d8c26a
|
|
| MD5 |
1d11ebf9d1663a4a72528ff9719f10f9
|
|
| BLAKE2b-256 |
7ad4c83d7873745702e15662cd9910db12abb19f105ff58d81f9614d771ff7e7
|