Skip to main content

qex

qex logo

A lightweight experiment-runner and lab notebook for quantum computing, built on top of Cirq.


qex decouples your quantum experiment definitions from execution backends, persisting your runs in a local SQLite database and providing a visual web dashboard to analyze state metrics, density matrices, and compare state fidelities side-by-side.

Key Features

  • 🧪 Experiment Abstraction: Define parameterized quantum circuits independent of physical backends.
  • 💾 SQLite Lab Notebook: All runs, timestamps, parameters, backends, and density matrices are tracked and stored automatically.
  • 📉 Noisy Simulation Backend: Run ideal simulations or inject custom physical depolarizing noise.
  • 📐 Quantum State Metrics: Real-time evaluation of Purity and Von Neumann Entropy for simulated mixed states.
  • 📊 Interactive Web Dashboard: Beautiful dark-mode SPA visualizer containing a 3D Bloch sphere (Three.js), density matrix grids, and run creators.
  • ⚖️ Side-by-Side Run Comparison: Compare any two runs side-by-side and compute their quantum State Fidelity.
  • 💻 Robust CLI Tool: Start the UI server, list runs, execute experiments, and open visualizations from the terminal.
  • 📡 Multi-Qubit Scaling: Simulate circuits from 1 up to 10 qubits ($1024 \times 1024$ density matrix dimension) with grid rendering performance optimization.

Installation

pip install qex

Quick Start

1. Define and Run an Experiment in Python

import cirq
from qex import CirqBackend, Runner, ResultStore, Experiment

# 1. Define a parameterized experiment (e.g. Hadamard on N qubits)
def multi_hadamard():
    def builder(qubits, params):
        return cirq.Circuit(cirq.H(q) for q in qubits)
    return Experiment(name="multi_hadamard", builder=builder)

# 2. Setup the runner and database store
backend = CirqBackend()
runner = Runner(backend, base_dir="qex_data")
store = ResultStore("qex_data/qex.db")

# 3. Simulate a 3-qubit execution
qubits = [cirq.GridQubit(0, i) for i in range(3)]
record = runner.run(multi_hadamard(), params={}, config={"qubits": qubits})

# 4. Save to your lab notebook
store.save_run(record)
store.close()

2. Control via CLI

# List all executed runs in the notebook
qex list

# Execute a new run with depolarizing noise (p = 0.05) on 4 qubits
qex run hadamard --qubits 4 --noise 0.05

# Open a 3D Bloch Sphere visualization in the browser
qex view <run_id>

3. Open the Interactive Web Dashboard

qex ui

This launches a local server on port 8000. Use the visual dashboard to run new circuits, view 3D Bloch vectors, analyze purity/entropy, and toggle Compare Mode to check quantum state fidelity between different ideal and noisy runs.

Requirements

  • Python >= 3.12
  • Cirq >= 1.6.1
  • NumPy >= 1.24.0

License

Apache License 2.0

FYI / Disclaimer

[!NOTE] The author is not a professional physicist. This library is built as an exploratory workspace, educational tool, and local lab notebook. It may contain bugs, experimental behaviors, or mathematical/physical inconsistencies. Contributions and corrections are highly welcome!

Metadata

Release files for qex 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qex 1.1.0
File Size Uploaded Provenance
qex-1.1.0.tar.gz 38.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for qex 1.1.0
File Interpreter ABI Platform
qex-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 78.4 kB

Release files / qex-1.1.0.tar.gz

Download URL qex-1.1.0.tar.gz
Size 38.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2dac1e410f30905aff6a115d7ffe4bd46dea6f71a0abf00f9855ea3ee1875edd
BLAKE2b-256 checksum
How to use checksums
6c7d5dafae0cb4eddc82d61055a2e4de963b1573fa96a922c8f1bdd134cecaa3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.

Transparency log

Release files / qex-1.1.0-py3-none-any.whl

Download URL qex-1.1.0-py3-none-any.whl
Size 39.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9377875814fdb4c019d47d56478437c72cda7be29f8d48565f5cb29208fbb4b
BLAKE2b-256 checksum
How to use checksums
b9b8b50b6b6488a9897cee82b27544cea203a7643e985f4964b4c39b3a0421e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.

Transparency log

Security for qex 1.1.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for qex-1.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page