uniqc.backend_adapter.task.adapters.qiskit_adapter module

Qiskit backend adapter.

Translates OriginIR circuits to Qiskit QuantumCircuit objects and submits via the qiskit / qiskit_ibm_runtime packages. No raw REST calls.

qiskit is a core dependency of unified-quantum — no extra install step is required.

class uniqc.backend_adapter.task.adapters.qiskit_adapter.QiskitAdapter(proxy=None)[source]

Bases: QuantumAdapter

Adapter for IBM Quantum backends via Qiskit.

Proxy Configuration:

Proxies can be passed via the proxy parameter: - Dict with ‘http’ and/or ‘https’ keys - Or a single proxy URL string for both protocols

If no proxy is configured: - Automatically detects and uses system proxy settings - If no system proxy, uses direct connection

If proxy is configured: - Uses configured proxy in addition to any system proxy

Raises:

MissingDependencyError – If qiskit or qiskit_ibm_runtime is not installed.

Parameters:

proxy (dict[str, str] | str | None)

Example

>>> adapter = QiskitAdapter(proxy={
...     "http": "http://proxy.example.com:8080",
...     "https": "https://proxy.example.com:8080"
... })
dry_run(originir, *, shots=1000, **kwargs)[source]

Dry-run validation for IBM Quantum backends.

Validates offline by: 1. Parsing OriginIR -> Qiskit QuantumCircuit. 2. Checking chip_id is in available backends (local config lookup). 3. Checking shots <= max_shots (local config lookup). 4. Checking qubit count against backend limits. 5. Attempting transpilation against the backend’s basis_gates

(purely local — catches unsupported gates).

This method makes NO network calls. service.backend(chip_id) and backend.configuration() are local config reads.

Note

Any dry-run success followed by actual submission failure is a critical bug. Please report it at the UnifiedQuantum issue tracker.

Parameters:
Return type:

DryRunResult

get_chip_characterization(backend_name)[source]

Return per-qubit and per-pair calibration data for an IBM backend.

Parameters:

backend_name (str) – IBM backend name, e.g. "ibm_brisbane".

Return type:

ChipCharacterization or None

is_available()[source]

Check if the Qiskit adapter is available (IBM service initialized).

Return type:

bool

list_backends()[source]

List IBM backends through QiskitRuntimeService.

The returned entries include both average metrics and per-qubit/per-edge calibration details from backend.target so the Gateway can color chip topologies without flattening every edge to the global average.

Return type:

list[dict[str, Any]]

max_native_batch_size: int = 100
name: str = 'ibm'
query(taskid)[source]

Query a single IBM Quantum job’s status.

Parameters:

taskid (str)

Return type:

dict[str, Any]

query_batch(taskids)[source]

Query multiple IBM Quantum jobs and merge results.

Each per-job query may return either a single counts dict (when one Sampler job covers exactly one PUB) or a list[dict] (when one Sampler job covers many PUBs — IBM’s native batch execution). The merged result must always be a flat list[dict] so downstream code (query_sync, the task manager normalisers, integration tests like run_test_result_shape_batch) can iterate per-circuit.

Parameters:

taskids (list[str])

Return type:

dict[str, Any]

query_sync(taskid, interval=2.0, timeout=60.0, retry=5)[source]

Poll task status until completion or timeout.

Parameters:
Return type:

list[dict[str, Any]]

submit(circuit, *, shots=1000, **kwargs)[source]

Submit a single circuit to IBM Quantum.

Parameters:
  • circuit (qiskit.QuantumCircuit)

  • shots (int)

  • kwargs (Any)

Return type:

str

submit_batch(circuits, *, shots=1000, native_batch=True, **kwargs)[source]

Submit multiple circuits as a batch.

IBM Quantum (qiskit-runtime Sampler) natively supports running a list of circuits inside a single job, which spends only one position in the queue. With native_batch=True (default), this returns a single-element list containing that one job ID; query() / wait_for_result() will then surface the per-circuit count distributions as a list.

With native_batch=False, each circuit is submitted as its own job (one ID per circuit) — useful when downstream code wants individually addressable task IDs.

Returns:

[batch_job_id] for native batch, or one job ID per circuit otherwise.

Return type:

list[str]

Parameters:
  • circuits (list[qiskit.QuantumCircuit])

  • shots (int)

  • native_batch (bool)

  • kwargs (Any)

translate_circuit(originir)[source]

Translate an OriginIR string to a Qiskit QuantumCircuit.

The conversion path is OriginIR → QASM string → Qiskit QuantumCircuit.

Parameters:

originir (str)

Return type:

qiskit.QuantumCircuit