Skip to main content

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 simple_quantum_draw 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(box_facecolor="#ffe680",
        wire_labels=["|0⟩", "|+⟩", "|1⟩"])

Features

Category Highlights
Lightweight Single file; 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.
Styling Global box colour (box_facecolor), wire labels (pass wire_labels=[…]).
Matplotlib native Full access to fig, ax for annotation, export, theming.

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.

Testing & baselines

The tests/ package uses plain pytest, numpy, and Pillow. Pixel‑perfect regression tests compare freshly rendered figures against PNG baselines stored in tests/baseline/.

# create / refresh baseline images
env GENERATE=1 pytest -q tests/test_draw_baselines.py

# run the full test suite
pytest

Contributing

  1. Fork → hack → PR.
  2. Ensure pytest passes without regenerating baselines.
  3. Stick to the existing style.

Bug reports and feature ideas welcome in Issues.

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

pyqcircuit-0.1.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyqcircuit-0.1.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file pyqcircuit-0.1.0.tar.gz.

File metadata

  • Download URL: pyqcircuit-0.1.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for pyqcircuit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bd69001c12b1b18eb8b4b2b3e73b2375a072ffd32d7b9f86bd6aee6dad4aa7cb
MD5 e6402be2802b6fdd70f8517d54e55b63
BLAKE2b-256 304bb01dc543a0a5bc7125921d9fee6b4a9b48da43071a955ac89e75819b2432

See more details on using hashes here.

File details

Details for the file pyqcircuit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyqcircuit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for pyqcircuit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0710821439a0e80e5b8f6bd1a3440affe49457bc9a42dfcb68e8addef047c56
MD5 48a07d04f6e5bbf5a00562dc399c430c
BLAKE2b-256 728604dd516ce166e4e64bab102c027991034d9e5e373b476536b56869872dcb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page