No project description provided
Project description
pyqcircuit
A tiny pure‑Python helper for drawing quantum‑circuit diagrams with Matplotlib.
Why?
Most open‑source quantum SDKs bundle heavyweight drawing stacks or require you to adopt their full IR just to get a circuit picture. pyqcircuit keeps things… well, simple: with zero dependencies beyond Matplotlib.
Installation
pip install pyqcircuit # if you don’t already have it
Quick demo
from pyqcircuit import QuantumCircuit
qc = QuantumCircuit(3)
qc.h(0)
qc.x(2, step=1) # share column 1
qc.custom([0, 2], "Foo") # tall box spanning q0–q2
qc.cx(0, 1, step=3)
qc.draw()
Features
| Category | Highlights |
|---|---|
| Lightweight | No quantum SDKs; pure Python 3. |
| Gate set | H, X/Y/Z, S, T, ½‑rotations (X90 etc.), arbitrary R_x/y/z(θ), CNOT, CZ, SWAP, measurement. |
| Custom gates | qc.custom(qubits, "LABEL") draws one‑ or multi‑qubit labelled boxes. |
| Flexible layout | Explicit step= pinning or automatic sequential placement. |
API primer
| Call | Effect |
|---|---|
qc.h(0) |
One‑qubit Hadamard in next free column. |
qc.x(1, step=2) |
X gate pinned to column 2. |
qc.cx(0,1) |
CNOT; control on q0, target on q1. |
qc.custom([0,2], "U") |
One tall box spanning q0…q2. |
qc.measure([0,1]) |
Standard meter symbol on listed qubits. |
Development
To refresh the baseline images used in tests, run:
# create / refresh baseline images
env GENERATE=1 pytest -q tests/test_draw_baselines.py
# run the full test suite
pytest
For Windows users, you will need to set the GENERATE environment variable
to 1 before running the first command, e.g.:
set GENERATE=1
pytest -q tests/test_draw_baselines.py
set GENERATE=0
pytest
or using PowerShell:
$env:GENERATE = "1"
pytest -q tests/test_draw_baselines.py
$env:GENERATE = "0"
pytest
Project details
Release history Release notifications | RSS feed
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 pyqcircuit-0.2.0.tar.gz.
File metadata
- Download URL: pyqcircuit-0.2.0.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
035715b77ded238db97022c2c84fb2fae03d9b1ebc3cdb4b3c01d64be4b3366a
|
|
| MD5 |
db5a2d4caa12f99a81db174a71855ddb
|
|
| BLAKE2b-256 |
1cd38cfaa8c01eb291604adca4722f1ff5897e10923db17772eac87679ebbee0
|
File details
Details for the file pyqcircuit-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pyqcircuit-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6df5ccd5773b8df81aaf2a2f5dc0e40d8bfb357b0ee930f730f9ff8211b18a3
|
|
| MD5 |
5a7a41d5b0de710baaa7cd88eb661bba
|
|
| BLAKE2b-256 |
0dee0783e9611da25abb94946880c590e117e77443bb06ffc5265440cd0416a5
|