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.

Example output:

Example circuit

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


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.3.0.tar.gz (16.2 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.3.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyqcircuit-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b457dc5a23af359f48a8d12fe4c76201e4bc0d90a1dad81d3a8d13ef156ee325
MD5 c8d268542fd6f76fead50d901aa2521e
BLAKE2b-256 aa837a1f748ed43a3f42c92f96ecc858d9116bff9007591f3bd31902ec172e39

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyqcircuit-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 15.1 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 546536e12e40eb23f57950eac0456ceabee560f9e89d9e2b45a6b56f7dc3f781
MD5 7bece14ba58f8c9daee9a7f6c4dfdba6
BLAKE2b-256 c3930352c2092d869de8124784191b6fbd3ef16e23faa24074f451a1af363e58

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