Commutator Studios Python SDK
Commutator SDK is the official Python client for the Commutator Studios quantum ecosystem. It provides a seamless, developer-friendly interface to integrate quantum workloads, optimization engines, and identity management natively into your Python tech stack.
By connecting to the Centralized API Gateway (commutator.app), this SDK handles authentication, rate-limiting, and billing checks automatically, allowing you to focus on building quantum-accelerated applications.
Features
- Quantum Fleet Management: Discover, list, and check the status of available quantum backends (e.g.,
ibm_berlin,ibmq_qasm_simulator). Automatically synchronizes hardware catalog using the authenticated user's quantum provider credentials. - Hardware & Algorithmic Recommendations: Interface directly with
cs-optimizerto get smart recommendations for hardware and optimization levels (e.g., VQE) before you run your circuits. - Job Execution & Polling: Submit quantum circuits, execute jobs on actual quantum hardware, and download results natively into Python objects.
- Standardized Error Handling: Detailed, structured exceptions (
APIError,ValidationError,AuthenticationError) for predictable and easy debugging. - ...and more!
Installation
The SDK requires Python 3.11+. You can install it directly from PyPI using pip:
pip install commutator-sdk
Quick Start
Here is a simple example showing how to authenticate, create a job, execute a circuit, and fetch the results.
1. Authentication
You can authenticate using your API Key or Username/Password.
from commutator.client import CommutatorClient
# Initialize the client (Environment is auto-detected)
client = CommutatorClient(api_key="your_api_key_here")
2. Submitting a Quantum Job
Submit your quantum circuit JSON and execute it on a selected backend.
import json
from commutator import ClassicalOptimizer
# 1. Create the Job
job = client.create_job(
name="My First VQE Run",
algorithm="VQE",
file_path="circuit.json"
)
job_id = job["id"]
print(f"Job created successfully: {job_id}")
# 2. Execute the Job with Classical Numerical Optimizer (e.g. COBYLA or Simplex)
client.execute_job(
job_id=job_id,
backend="ibm_berlin",
optimization_level=3,
optimizer=ClassicalOptimizer.COBYLA # or "cobyla" / ClassicalOptimizer.SIMPLEX
)
print("Job dispatched to the quantum backend!")
3. Optimizer Recommendations
Not sure which backend or optimization level to use? Ask the Recommendation Engine!
recommendations = client.optimizer.recommend(
job_id="your_job_id",
target_backends=["ibm_kingston", "ibm_brisbane"] # Optional: omit to evaluate all fleet backends
)
print(f"Recommended Backend: {recommendations[0]['provider']}")
Error Handling & Exception Reference
When executing quantum simulation jobs, the SDK automatically inspects the API response errorCode and raises typed Python exceptions providing human-readable diagnostic remedies:
from commutator.client import CommutatorClient
from commutator.exceptions import (
SimulationOOMError,
SimulationTimeoutError,
ProviderAuthenticationError,
JobFailedError
)
client = CommutatorClient(api_key="your_api_key")
try:
job_details = client.jobs.get(job_id="5bacd027-267d-4c8e-94c4-5348c48880b3")
except SimulationOOMError as e:
print(f"❌ Memory Error [{e.error_code}]: {e.message}")
print(f"💡 Actionable Remedy: {e.remedy}")
except SimulationTimeoutError as e:
print(f"⏱️ Job Timed Out [{e.error_code}]: {e.message}")
print(f"💡 Actionable Remedy: {e.remedy}")
except JobFailedError as e:
print(f"⚠️ Job Execution Failed [{e.error_code}]: {e.message}")
Supported Exception Mapping
API errorCode Enum |
Raised SDK Exception Class | Python Import Path |
|---|---|---|
SIMULATION_OOM |
SimulationOOMError |
from commutator.exceptions import SimulationOOMError |
SIMULATION_TIMEOUT |
SimulationTimeoutError |
from commutator.exceptions import SimulationTimeoutError |
PROVIDER_AUTH_FAILED |
ProviderAuthenticationError |
from commutator.exceptions import ProviderAuthenticationError |
OPTIMIZATION_DIVERGED |
OptimizationDivergedError |
from commutator.exceptions import OptimizationDivergedError |
| Fallback / System Faults | JobFailedError |
from commutator.exceptions import JobFailedError |
Advanced Usage
For comprehensive documentation, including detailed API reference, Identity Management (list_api_keys, get_audit_logs), and advanced configuration options, please refer to the official Commutator Studios Documentation.
License
Copyright © 2026 Commutator Studios GmbH. All rights reserved.
Metadata
Release files for commutator-sdk 0.2.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| commutator_sdk-0.2.8.tar.gz | 17.1 kB | Without provenance | Details for commutator_sdk-0.2.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| commutator_sdk-0.2.8-py3-none-any.whl | Python 3 | none | any | Details for commutator_sdk-0.2.8-py3-none-any.whl |
Total release size: 31.5 kB
Release files / commutator_sdk-0.2.8.tar.gz
| Download URL | commutator_sdk-0.2.8.tar.gz |
|---|---|
| Size | 17.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
946f79b99ac00c0d76708fef22ff51c5c5263f0b8fa66357fdc8c89a69cfcea9
|
|
BLAKE2b-256 checksum How to use checksums |
4be71dac97b455b8411f13f6a899aa2923d35cd51c2271f9828cf1a02a33022c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Release files / commutator_sdk-0.2.8-py3-none-any.whl
| Download URL | commutator_sdk-0.2.8-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
891cd5a3985811a2f18573dc1a539c3e9a9fac4aee625b01ed167b94df5e6377
|
|
BLAKE2b-256 checksum How to use checksums |
ea695e2c4c40f134e5c3dddcc8b5e6a9f5a1d9c4029c5551e2aa25f10e4e046e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Security for commutator-sdk 0.2.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.