Metadata-Version: 2.4
Name: pyqcircuit
Version: 0.3.0
Author: Damien Crielaard
License: The Clear BSD License
        
        Copyright (c) 2025 Damien Crielaard
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted (subject to the limitations in the disclaimer
        below) provided that the following conditions are met:
        
             * Redistributions of source code must retain the above copyright notice,
             this list of conditions and the following disclaimer.
        
             * Redistributions in binary form must reproduce the above copyright
             notice, this list of conditions and the following disclaimer in the
             documentation and/or other materials provided with the distribution.
        
             * Neither the name of the copyright holder nor the names of its
             contributors may be used to endorse or promote products derived from this
             software without specific prior written permission.
        
        NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
        THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
        CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
        PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
        CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
        EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
        PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
        BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
        IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
        ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
        POSSIBILITY OF SUCH DAMAGE.
        
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Quantum Computing
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: matplotlib
Provides-Extra: dev
Requires-Dist: ruff; extra == "dev"
Requires-Dist: mypy<2.0,>=1.0; extra == "dev"
Requires-Dist: black<25.0,>=23.0; extra == "dev"
Requires-Dist: isort<5.14,>=5.12; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-sphinx; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: twine>=1.11.0; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: setuptools; extra == "dev"
Requires-Dist: wheel; extra == "dev"
Requires-Dist: Sphinx<9.0,>=6.0; extra == "dev"
Requires-Dist: furo==2024.8.6; extra == "dev"
Requires-Dist: myst-parser>=1.0; extra == "dev"
Requires-Dist: sphinx-copybutton; extra == "dev"
Requires-Dist: sphinx-autobuild; extra == "dev"
Requires-Dist: sphinx-autodoc-typehints==1.23.3; extra == "dev"
Requires-Dist: packaging; extra == "dev"
Dynamic: license-file

# 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:
<div align="center">
  <img src="./images/example_circuit.png"
       alt="Example circuit" width="320">
</div>


---

## Installation

```bash
pip install pyqcircuit             # if you don’t already have it
```

---

## Quick demo

```python
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:

```bash
# 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.:

```cmd
set GENERATE=1
pytest -q tests/test_draw_baselines.py
set GENERATE=0
pytest
```

or using PowerShell:

```powershell
$env:GENERATE = "1"
pytest -q tests/test_draw_baselines.py
$env:GENERATE = "0"
pytest
```
