SpinorioSpinorio
Documentation
Open Lab
Browse documentation

Docs / Spinorio Compiler / Python SDK

Compiler Python SDK

Use the same Spinorio Compiler service from an authenticated Spinorio Lab notebook.


Authentication model

The bundled spinorio Python package uses the authenticated Spinorio Lab workspace and its internal service credentials. This release does not issue standalone external API keys/service accounts for the compiler.

IBM provider credentials stay server-side

A key connected in Workflow → Provider Connections is not passed into notebook code. The Spinorio SDK can ask the server to discover IBM instances/QPUs for compilation, but this does not automatically authenticate QiskitRuntimeService() inside the notebook.

Compile from Python

python
import spinorio

# qc is an existing Qiskit QuantumCircuit
compiled = spinorio.qcompile(
    qc,
    backend="TARGET_ID",
    optimization_level=2,
)
compiled

qcompile() currently accepts a Qiskit QuantumCircuit, uploads it as QPY, submits a compiler job, polls for completion, and returns the compiled QuantumCircuit. The default optimization level is 2.

Discover IBM compilation targets

python
import spinorio

instances = spinorio.list_ibm_instances()
instances

# Choose one returned instance ID explicitly.
backends = spinorio.list_ibm_backends(instances[0]["id"])
backends

Select the instance explicitly. The returned backend/target ID can be passed to qcompile().

Current SDK methods

MethodPurpose
spinorio.qcompile(circuit, backend, optimization_level=2)Submit a QPY compilation and return the completed compiled circuit.
spinorio.list_targets()List saved topology/configuration and offline reference compilation targets.
spinorio.list_ibm_instances()List IBM Quantum service instances accessible through the connected Spinorio provider account.
spinorio.list_ibm_backends(instance_id)List available IBM QPUs/target IDs for an explicitly selected service instance.
spinorio.load_compilation(job_id)Load a completed compilation QPY artifact as a QuantumCircuit.

Previous

← Compiler overview

Next

IBM Quantum →