Python modules for QubitOS quantum control kernel
Project description
QubitOS Core
Open-source real-time quantum control system: pulse optimization, calibration management, and hardware abstraction.
Why This Exists
Quantum processors drift. Gate fidelities measured during Tuesday's calibration are wrong by Thursday. Coherence times shift with temperature, TLS defects come and go, and crosstalk changes as you bring neighboring qubits online. So every serious quantum experiment starts the same way: recalibrate, re-optimize pulses, hope the hardware holds still long enough to run your circuit.
Most quantum software treats this as somebody else's problem. Qiskit and Cirq give you circuit-level abstractions and assume calibration data is accurate and static. But if you have actually tried to run a multi-qubit algorithm on real hardware, you know it is not. The gap between "my simulation says 99.9% fidelity" and "the QPU returned garbage" is almost always a calibration or pulse-level problem, and there is no open-source tool that closes that loop.
QubitOS is built to sit between your compiler output and the hardware. It takes circuit-level instructions, optimizes pulses against current calibration data (not last week's), and executes them through a hardware abstraction layer that talks to real backends. The control loop is designed to be fast enough for feedback-based protocols where you need microsecond-scale decisions.
This started because I kept running into the same problem across QubitPulseOpt, qco-integration, and the circuit optimizer: optimizing gates in isolation does not help if the hardware has drifted since calibration. QubitOS is the system that ties all of those pieces together.
Overview
QubitOS Core provides:
- pulsegen - GRAPE/DRAG pulse optimization with Lindblad noise modeling (99.9% single-qubit fidelity)
- calibrator - Live calibration tracking, drift detection, and automatic re-optimization triggers
- client - gRPC client for the Rust Hardware Abstraction Layer
- cli - Command-line interface for pulse generation, execution, and calibration management
Installation
# From PyPI (when available)
pip install qubitos
# From source
git clone https://github.com/qubit-os/qubit-os-core.git
cd qubit-os-core
pip install -e ".[dev]"
Quick Start
Generate an X-gate pulse
from qubitos.pulsegen import generate_pulse
from qubitos.client import HALClient
# Generate optimized pulse
pulse = generate_pulse(gate="X", duration_ns=20, target_fidelity=0.999)
# Execute on simulator
async with HALClient("localhost:50051") as client:
result = await client.execute_pulse(
i_envelope=pulse.i_envelope.tolist(),
q_envelope=pulse.q_envelope.tolist(),
duration_ns=20,
target_qubits=[0],
num_shots=1000,
)
print(f"Counts: {result.bitstring_counts}")
if result.fidelity_estimate is not None:
print(f"Fidelity: {result.fidelity_estimate:.4f}")
CLI Usage
# Generate a pulse
qubit-os pulse generate --gate X --duration 20 --output x_gate.json
# Execute a pulse
qubit-os pulse execute x_gate.json --shots 1000
# Check backend health
qubit-os hal health
# Show calibration
qubit-os calibration show
Architecture
qubitos/
├── client/ # HAL gRPC client
├── pulsegen/ # Pulse optimization (GRAPE, DRAG)
├── calibrator/ # Calibration management
├── validation/ # AgentBible integration
└── cli/ # Command-line interface
Configuration
QubitOS uses a configuration hierarchy (later overrides earlier):
- Built-in defaults
- Environment variables (
QUBITOS_*) config.yaml- CLI arguments
# Environment variables
export QUBITOS_HAL_HOST=localhost
export QUBITOS_HAL_PORT=50051
export QUBITOS_LOG_LEVEL=info
Development
Setup
# Clone and install
git clone https://github.com/qubit-os/qubit-os-core.git
cd qubit-os-core
pip install -e ".[dev]"
# Run tests
pytest tests/
# Type checking
mypy src/qubitos/
# Linting
ruff check src/
ruff format src/
Running Tests
# All tests
pytest
# With coverage
pytest --cov=qubitos --cov-report=html
# Specific module
pytest tests/unit/test_grape.py
# Integration tests (requires HAL running)
pytest tests/integration/
Documentation
License
Apache 2.0 - See LICENSE for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 qubitos-0.3.0.tar.gz.
File metadata
- Download URL: qubitos-0.3.0.tar.gz
- Upload date:
- Size: 459.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31a4e069712e2091ea70280c4097c48737e795ec5507c9a13a4efced5da92a28
|
|
| MD5 |
4d417e31f814bd8e9a8a4a33f27bc9ac
|
|
| BLAKE2b-256 |
d1fd1499e78f2811e7d7655214105b3af82ec9ef2d2a5a308828c4e908d74dfc
|
Provenance
The following attestation bundles were made for qubitos-0.3.0.tar.gz:
Publisher:
release.yaml on qubit-os/qubit-os-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qubitos-0.3.0.tar.gz -
Subject digest:
31a4e069712e2091ea70280c4097c48737e795ec5507c9a13a4efced5da92a28 - Sigstore transparency entry: 929587387
- Sigstore integration time:
-
Permalink:
qubit-os/qubit-os-core@d3b572fab7636442117badf54d7f435aa6454026 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/qubit-os
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@d3b572fab7636442117badf54d7f435aa6454026 -
Trigger Event:
release
-
Statement type:
File details
Details for the file qubitos-0.3.0-py3-none-any.whl.
File metadata
- Download URL: qubitos-0.3.0-py3-none-any.whl
- Upload date:
- Size: 152.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
796d99f8a78ad73df7ffe245ff08b8858ad1d9a13467acf8e25f1b22cdf2e42a
|
|
| MD5 |
3c5bdc23576e60b6b97b87076bfcb19f
|
|
| BLAKE2b-256 |
f05a909a3c041975bfc897e3fe7e28fda7e5291d6eda39c78043e7396c304873
|
Provenance
The following attestation bundles were made for qubitos-0.3.0-py3-none-any.whl:
Publisher:
release.yaml on qubit-os/qubit-os-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qubitos-0.3.0-py3-none-any.whl -
Subject digest:
796d99f8a78ad73df7ffe245ff08b8858ad1d9a13467acf8e25f1b22cdf2e42a - Sigstore transparency entry: 929587402
- Sigstore integration time:
-
Permalink:
qubit-os/qubit-os-core@d3b572fab7636442117badf54d7f435aa6454026 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/qubit-os
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@d3b572fab7636442117badf54d7f435aa6454026 -
Trigger Event:
release
-
Statement type: