An open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
—
Qiskit's provider system abstracts quantum hardware backends, enabling unified access to different quantum devices and simulators through consistent interfaces for job management, backend configuration, and execution.
class Backend:
def __init__(self):
"""Abstract base class for quantum backends."""
def run(self, circuits, **kwargs):
"""Execute quantum circuits on backend."""
@property
def target(self):
"""Backend target specification."""
@property
def num_qubits(self):
"""Number of qubits."""
class BackendV2(Backend):
def __init__(self, provider=None, name=None, description=None,
online_date=None, backend_version=None, **fields):
"""Version 2 backend interface."""
@property
def instructions(self):
"""Supported instructions."""
@property
def operation_names(self):
"""Supported operation names."""
@property
def coupling_map(self):
"""Backend coupling constraints."""class Job:
def result(self):
"""Get job result (blocking)."""
def status(self):
"""Get job status."""
def cancel(self):
"""Cancel job if possible."""class BackendConfiguration:
n_qubits: int
coupling_map: List[List[int]]
basis_gates: List[str]
gate_set: str
local: bool
simulator: bool
conditional: bool
open_pulse: bool
memory: bool
max_shots: int
max_experiments: int
class BackendProperties:
last_update_date: str
qubits: List
gates: List
general: List
class QubitProperties:
def __init__(self, t1=None, t2=None, frequency=None, anharmonicity=None):
"""
Properties of individual qubits.
Parameters:
- t1: T1 relaxation time
- t2: T2 dephasing time
- frequency: Qubit frequency
- anharmonicity: Anharmonicity
"""
class InstructionProperties:
def __init__(self, duration=None, error=None, calibration=None):
"""
Properties of quantum instructions.
Parameters:
- duration: Instruction duration
- error: Gate error rate
- calibration: Calibration data
"""Backend runtime options and execution parameters.
from qiskit.providers import Options
class Options:
def __init__(self, **kwargs):
"""
Configurable backend execution options.
Common options:
- shots: Number of measurements (default: 1024)
- memory: Whether to return memory data
- max_credits: Maximum credits to spend
- seed_simulator: Random seed for simulators
"""
def update_options(self, **fields):
"""Update option values."""
def get(self, field, default=None):
"""Get option value with default."""Extended job control and monitoring capabilities.
from qiskit.providers import JobStatus, JobError, JobTimeoutError
class JobV1(Job):
def __init__(self, backend, job_id, **kwargs):
"""Legacy V1 job interface."""
def submit(self):
"""Submit job to backend."""
def wait_for_final_state(self, timeout=None, wait=5,
callback=None):
"""Wait until job reaches final state."""
def error_message(self):
"""Get error message if job failed."""
class JobStatus:
"""Job status enumeration."""
INITIALIZING = 'job is being initialized'
QUEUED = 'job is queued'
VALIDATING = 'job is being validated'
RUNNING = 'job is actively running'
CANCELLED = 'job has been cancelled'
DONE = 'job has successfully run'
ERROR = 'job incurred error'
class JobError(Exception):
"""Exception raised by job operations."""
class JobTimeoutError(JobError):
"""Exception raised when job times out."""
# Job result access
class Result:
def __init__(self, backend_name, backend_version, qobj_id,
job_id, success, results, **kwargs):
"""
Result of quantum job execution.
Parameters:
- backend_name: Name of backend that executed job
- backend_version: Version of backend
- qobj_id: Quantum object identifier
- job_id: Job identifier
- success: Whether job completed successfully
- results: List of experiment results
"""
def get_counts(self, experiment=None):
"""Get measurement counts."""
def get_memory(self, experiment=None):
"""Get individual measurement results."""
def get_statevector(self, experiment=None):
"""Get final statevector (simulators only)."""
def get_unitary(self, experiment=None):
"""Get circuit unitary (simulators only)."""from qiskit.providers.fake_provider import FakeManila
from qiskit import QuantumCircuit, transpile
# Use fake backend
backend = FakeManila()
circuit = QuantumCircuit(2, 2)
circuit.h(0)
circuit.cx(0, 1)
circuit.measure_all()
# Transpile and execute
transpiled = transpile(circuit, backend)
job = backend.run(transpiled, shots=1024)
result = job.result()
counts = result.get_counts()Install with Tessl CLI
npx tessl i tessl/pypi-qiskit