quantum-circuit-drawer 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. quantum_circuit_drawer-0.2.1/LICENSE +21 -0
  2. quantum_circuit_drawer-0.2.1/MANIFEST.in +3 -0
  3. quantum_circuit_drawer-0.2.1/PKG-INFO +153 -0
  4. quantum_circuit_drawer-0.2.1/README.md +107 -0
  5. quantum_circuit_drawer-0.2.1/THIRD_PARTY_LICENSES.md +67 -0
  6. quantum_circuit_drawer-0.2.1/pyproject.toml +128 -0
  7. quantum_circuit_drawer-0.2.1/setup.cfg +4 -0
  8. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/__init__.py +100 -0
  9. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/_draw_managed.py +496 -0
  10. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/_draw_managed_slider.py +95 -0
  11. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/_draw_managed_viewport.py +233 -0
  12. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/_draw_managed_zoom.py +190 -0
  13. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/_draw_pipeline.py +228 -0
  14. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/_draw_request.py +257 -0
  15. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/_matrix_support.py +326 -0
  16. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/_version.py +5 -0
  17. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/adapters/__init__.py +16 -0
  18. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/adapters/_cudaq_quake_parser.py +411 -0
  19. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/adapters/_helpers.py +423 -0
  20. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/adapters/base.py +49 -0
  21. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/adapters/cirq_adapter.py +486 -0
  22. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/adapters/cudaq_adapter.py +85 -0
  23. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/adapters/ir_adapter.py +23 -0
  24. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/adapters/myqlm_adapter.py +495 -0
  25. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/adapters/pennylane_adapter.py +355 -0
  26. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/adapters/qiskit_adapter.py +443 -0
  27. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/adapters/registry.py +130 -0
  28. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/api.py +207 -0
  29. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/exceptions.py +29 -0
  30. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/hover.py +109 -0
  31. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/ir/__init__.py +21 -0
  32. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/ir/circuit.py +78 -0
  33. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/ir/classical_conditions.py +31 -0
  34. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/ir/measurements.py +41 -0
  35. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/ir/operations.py +161 -0
  36. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/ir/wires.py +36 -0
  37. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/layout/__init__.py +8 -0
  38. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/layout/_classical_conditions.py +29 -0
  39. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/layout/_layering.py +68 -0
  40. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/layout/_layout_scaffold.py +263 -0
  41. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/layout/_operation_layout.py +691 -0
  42. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/layout/_operation_text.py +61 -0
  43. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/layout/engine.py +90 -0
  44. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/layout/engine_3d.py +745 -0
  45. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/layout/routing.py +24 -0
  46. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/layout/scene.py +163 -0
  47. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/layout/scene_3d.py +129 -0
  48. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/layout/spacing.py +90 -0
  49. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/layout/topology_3d.py +380 -0
  50. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/py.typed +1 -0
  51. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/renderers/__init__.py +28 -0
  52. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/renderers/_matplotlib_figure.py +290 -0
  53. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/renderers/_matplotlib_hover.py +308 -0
  54. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/renderers/_matplotlib_page_projection.py +111 -0
  55. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/renderers/_render_support.py +122 -0
  56. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/renderers/base.py +31 -0
  57. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/renderers/matplotlib_primitives.py +1209 -0
  58. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/renderers/matplotlib_renderer.py +445 -0
  59. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/renderers/matplotlib_renderer_3d.py +1545 -0
  60. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/style/__init__.py +7 -0
  61. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/style/defaults.py +37 -0
  62. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/style/theme.py +88 -0
  63. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/style/validators.py +73 -0
  64. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/typing.py +73 -0
  65. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/utils/__init__.py +5 -0
  66. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer/utils/formatting.py +40 -0
  67. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer.egg-info/PKG-INFO +153 -0
  68. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer.egg-info/SOURCES.txt +94 -0
  69. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer.egg-info/dependency_links.txt +1 -0
  70. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer.egg-info/requires.txt +27 -0
  71. quantum_circuit_drawer-0.2.1/src/quantum_circuit_drawer.egg-info/top_level.txt +1 -0
  72. quantum_circuit_drawer-0.2.1/tests/test_adapter_helpers.py +478 -0
  73. quantum_circuit_drawer-0.2.1/tests/test_adapter_registry.py +120 -0
  74. quantum_circuit_drawer-0.2.1/tests/test_api_3d.py +80 -0
  75. quantum_circuit_drawer-0.2.1/tests/test_api_contracts.py +274 -0
  76. quantum_circuit_drawer-0.2.1/tests/test_api_managed_rendering.py +1211 -0
  77. quantum_circuit_drawer-0.2.1/tests/test_benchmark_script.py +433 -0
  78. quantum_circuit_drawer-0.2.1/tests/test_cirq_adapter.py +247 -0
  79. quantum_circuit_drawer-0.2.1/tests/test_clean_script.py +145 -0
  80. quantum_circuit_drawer-0.2.1/tests/test_cudaq_adapter.py +357 -0
  81. quantum_circuit_drawer-0.2.1/tests/test_cudaq_adapter_integration.py +94 -0
  82. quantum_circuit_drawer-0.2.1/tests/test_draw_pipeline.py +304 -0
  83. quantum_circuit_drawer-0.2.1/tests/test_example_support.py +470 -0
  84. quantum_circuit_drawer-0.2.1/tests/test_examples_runner.py +546 -0
  85. quantum_circuit_drawer-0.2.1/tests/test_formatting.py +36 -0
  86. quantum_circuit_drawer-0.2.1/tests/test_ir.py +160 -0
  87. quantum_circuit_drawer-0.2.1/tests/test_layout.py +883 -0
  88. quantum_circuit_drawer-0.2.1/tests/test_layout_3d.py +1591 -0
  89. quantum_circuit_drawer-0.2.1/tests/test_matplotlib_figure_support.py +67 -0
  90. quantum_circuit_drawer-0.2.1/tests/test_matplotlib_renderer.py +1690 -0
  91. quantum_circuit_drawer-0.2.1/tests/test_myqlm_adapter.py +481 -0
  92. quantum_circuit_drawer-0.2.1/tests/test_optional_imports.py +219 -0
  93. quantum_circuit_drawer-0.2.1/tests/test_package_import.py +68 -0
  94. quantum_circuit_drawer-0.2.1/tests/test_pennylane_adapter.py +381 -0
  95. quantum_circuit_drawer-0.2.1/tests/test_qiskit_adapter.py +531 -0
  96. quantum_circuit_drawer-0.2.1/tests/test_style_validation.py +72 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alejandro Mata Ali
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ include THIRD_PARTY_LICENSES.md
2
+ # README image URL maps to this path locally; setuptools would else add it to the sdist.
3
+ prune docs/images
@@ -0,0 +1,153 @@
1
+ Metadata-Version: 2.4
2
+ Name: quantum-circuit-drawer
3
+ Version: 0.2.1
4
+ Summary: Backend-agnostic quantum circuit drawing library with Matplotlib as the first renderer.
5
+ Author: Alejandro Mata Ali
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/DOKOS-TAYOS/quantum-circuit-drawer
8
+ Project-URL: Documentation, https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/index.md
9
+ Project-URL: Repository, https://github.com/DOKOS-TAYOS/quantum-circuit-drawer
10
+ Project-URL: Issues, https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/issues
11
+ Project-URL: Changelog, https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/CHANGELOG.md
12
+ Keywords: quantum,qiskit,cirq,matplotlib,visualization
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Python: >=3.11
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ License-File: THIRD_PARTY_LICENSES.md
26
+ Requires-Dist: matplotlib>=3.7
27
+ Requires-Dist: numpy>=1.24
28
+ Provides-Extra: qiskit
29
+ Requires-Dist: qiskit>=1.0; extra == "qiskit"
30
+ Provides-Extra: cirq
31
+ Requires-Dist: cirq-core>=1.3; extra == "cirq"
32
+ Provides-Extra: pennylane
33
+ Requires-Dist: pennylane>=0.35; extra == "pennylane"
34
+ Provides-Extra: myqlm
35
+ Requires-Dist: myqlm>=1.11; extra == "myqlm"
36
+ Provides-Extra: cudaq
37
+ Requires-Dist: cudaq>=0.13; platform_system == "Linux" and extra == "cudaq"
38
+ Provides-Extra: dev
39
+ Requires-Dist: pytest>=8.0; extra == "dev"
40
+ Requires-Dist: pytest-cov>=5.0; extra == "dev"
41
+ Requires-Dist: ruff>=0.6; extra == "dev"
42
+ Requires-Dist: mypy>=1.11; extra == "dev"
43
+ Requires-Dist: build>=1.2; extra == "dev"
44
+ Requires-Dist: twine>=5.1; extra == "dev"
45
+ Dynamic: license-file
46
+
47
+ <p align="center">
48
+ <img
49
+ src="https://raw.githubusercontent.com/DOKOS-TAYOS/quantum-circuit-drawer/main/docs/images/Quantum_Circuit_Drawer_logo.png"
50
+ alt="Quantum Circuit Drawer — neon logo with a circuit-style atom icon and glowing typography (transparent background)"
51
+ width="560"
52
+ />
53
+ </p>
54
+
55
+ # quantum-circuit-drawer
56
+
57
+ [![PyPI version](https://img.shields.io/pypi/v/quantum-circuit-drawer)](https://pypi.org/project/quantum-circuit-drawer/)
58
+ [![Python versions](https://img.shields.io/pypi/pyversions/quantum-circuit-drawer)](https://pypi.org/project/quantum-circuit-drawer/)
59
+ [![CI](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/actions/workflows/ci.yml/badge.svg)](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/actions/workflows/ci.yml)
60
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
61
+
62
+ `quantum-circuit-drawer` is a small Python library for drawing quantum circuits from different ecosystems with one consistent Matplotlib-based visual style.
63
+
64
+ It gives you one public entry point, `draw_quantum_circuit(...)`, for supported Qiskit, Cirq, PennyLane, MyQLM, CUDA-Q, and internal IR inputs. The goal is simple: keep your visualization code stable even when the circuit source changes.
65
+
66
+ ## Why this library
67
+
68
+ Quantum frameworks do not all expose the same drawing workflow. This project focuses on the visualization layer, so you can:
69
+
70
+ - keep the same look across different circuit frameworks
71
+ - save circuit diagrams for reports, notebooks, and documentation
72
+ - draw into your own Matplotlib figures when you need larger layouts
73
+ - use one typed API instead of several framework-specific drawing calls
74
+
75
+ ## Supported inputs
76
+
77
+ | Input path | Install | Typical object | Notes |
78
+ | --- | --- | --- | --- |
79
+ | Internal IR | `python -m pip install quantum-circuit-drawer` | `CircuitIR` | Included in the base package |
80
+ | Qiskit | `python -m pip install "quantum-circuit-drawer[qiskit]"` | `qiskit.QuantumCircuit` | Good default if you mainly use Qiskit |
81
+ | Cirq | `python -m pip install "quantum-circuit-drawer[cirq]"` | `cirq.Circuit` | Works with explicit or automatic framework detection |
82
+ | PennyLane | `python -m pip install "quantum-circuit-drawer[pennylane]"` | tape-like objects | Supports `QuantumTape`, `QuantumScript`, and wrappers exposing `.qtape` or `.tape` |
83
+ | MyQLM | `python -m pip install "quantum-circuit-drawer[myqlm]"` | `qat.core.Circuit` | Convert from `Program().to_circ()` first |
84
+ | CUDA-Q | `python -m pip install "quantum-circuit-drawer[cudaq]"` | closed CUDA-Q kernels | Linux or WSL2 oriented |
85
+
86
+ ## Install
87
+
88
+ Install the base package inside your virtual environment:
89
+
90
+ ```bash
91
+ python -m pip install quantum-circuit-drawer
92
+ ```
93
+
94
+ Install the framework extra you need, for example Qiskit:
95
+
96
+ ```bash
97
+ python -m pip install "quantum-circuit-drawer[qiskit]"
98
+ ```
99
+
100
+ For notebooks, install Jupyter tools in the same environment:
101
+
102
+ ```bash
103
+ python -m pip install jupyter ipykernel
104
+ ```
105
+
106
+ See the full [installation guide](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/installation.md) for Windows PowerShell commands, Linux/WSL commands, optional extras, CUDA-Q notes, and local editable installs.
107
+
108
+ ## Basic usage
109
+
110
+ ```python
111
+ from qiskit import QuantumCircuit
112
+
113
+ from quantum_circuit_drawer import draw_quantum_circuit
114
+
115
+ circuit = QuantumCircuit(2, 1)
116
+ circuit.h(0)
117
+ circuit.cx(0, 1)
118
+ circuit.measure(1, 0)
119
+
120
+ figure, axes = draw_quantum_circuit(circuit)
121
+ ```
122
+
123
+ By default, the library detects the circuit framework, creates a Matplotlib figure, uses the built-in `dark` theme, and shows the figure when the active Matplotlib backend is interactive.
124
+
125
+ For script-friendly output:
126
+
127
+ ```python
128
+ draw_quantum_circuit(circuit, output="bell.png", show=False)
129
+ ```
130
+
131
+ ## Documentation
132
+
133
+ - [Documentation index](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/index.md): the full map.
134
+ - [Getting started](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/getting-started.md): the shortest first successful example.
135
+ - [Installation](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/installation.md): virtual environments, extras, notebooks, and local installs.
136
+ - [API reference](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/api.md): `draw_quantum_circuit(...)`, style options, return values, and exceptions.
137
+ - [User guide](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/user-guide.md): workflows, examples, tips, 2D/3D views, sliders, and reports.
138
+ - [Frameworks](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/frameworks.md): Qiskit, Cirq, PennyLane, MyQLM, CUDA-Q, and internal IR notes.
139
+ - [Recipes](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/recipes.md): copy-paste solutions for common tasks.
140
+ - [Troubleshooting](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/troubleshooting.md): common errors and fixes.
141
+ - [Development](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/development.md): local checks, build commands, and benchmark notes.
142
+
143
+ Runnable example scripts live in [`examples/`](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/tree/main/examples), with more detail in [`examples/README.md`](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/examples/README.md).
144
+
145
+ ## Project links
146
+
147
+ - Repository: [github.com/DOKOS-TAYOS/quantum-circuit-drawer](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer)
148
+ - Issue tracker: [github.com/DOKOS-TAYOS/quantum-circuit-drawer/issues](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/issues)
149
+ - Changelog: [CHANGELOG.md](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/CHANGELOG.md)
150
+
151
+ ## License
152
+
153
+ This project is distributed under the [MIT License](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/LICENSE).
@@ -0,0 +1,107 @@
1
+ <p align="center">
2
+ <img
3
+ src="https://raw.githubusercontent.com/DOKOS-TAYOS/quantum-circuit-drawer/main/docs/images/Quantum_Circuit_Drawer_logo.png"
4
+ alt="Quantum Circuit Drawer — neon logo with a circuit-style atom icon and glowing typography (transparent background)"
5
+ width="560"
6
+ />
7
+ </p>
8
+
9
+ # quantum-circuit-drawer
10
+
11
+ [![PyPI version](https://img.shields.io/pypi/v/quantum-circuit-drawer)](https://pypi.org/project/quantum-circuit-drawer/)
12
+ [![Python versions](https://img.shields.io/pypi/pyversions/quantum-circuit-drawer)](https://pypi.org/project/quantum-circuit-drawer/)
13
+ [![CI](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/actions/workflows/ci.yml/badge.svg)](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/actions/workflows/ci.yml)
14
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
15
+
16
+ `quantum-circuit-drawer` is a small Python library for drawing quantum circuits from different ecosystems with one consistent Matplotlib-based visual style.
17
+
18
+ It gives you one public entry point, `draw_quantum_circuit(...)`, for supported Qiskit, Cirq, PennyLane, MyQLM, CUDA-Q, and internal IR inputs. The goal is simple: keep your visualization code stable even when the circuit source changes.
19
+
20
+ ## Why this library
21
+
22
+ Quantum frameworks do not all expose the same drawing workflow. This project focuses on the visualization layer, so you can:
23
+
24
+ - keep the same look across different circuit frameworks
25
+ - save circuit diagrams for reports, notebooks, and documentation
26
+ - draw into your own Matplotlib figures when you need larger layouts
27
+ - use one typed API instead of several framework-specific drawing calls
28
+
29
+ ## Supported inputs
30
+
31
+ | Input path | Install | Typical object | Notes |
32
+ | --- | --- | --- | --- |
33
+ | Internal IR | `python -m pip install quantum-circuit-drawer` | `CircuitIR` | Included in the base package |
34
+ | Qiskit | `python -m pip install "quantum-circuit-drawer[qiskit]"` | `qiskit.QuantumCircuit` | Good default if you mainly use Qiskit |
35
+ | Cirq | `python -m pip install "quantum-circuit-drawer[cirq]"` | `cirq.Circuit` | Works with explicit or automatic framework detection |
36
+ | PennyLane | `python -m pip install "quantum-circuit-drawer[pennylane]"` | tape-like objects | Supports `QuantumTape`, `QuantumScript`, and wrappers exposing `.qtape` or `.tape` |
37
+ | MyQLM | `python -m pip install "quantum-circuit-drawer[myqlm]"` | `qat.core.Circuit` | Convert from `Program().to_circ()` first |
38
+ | CUDA-Q | `python -m pip install "quantum-circuit-drawer[cudaq]"` | closed CUDA-Q kernels | Linux or WSL2 oriented |
39
+
40
+ ## Install
41
+
42
+ Install the base package inside your virtual environment:
43
+
44
+ ```bash
45
+ python -m pip install quantum-circuit-drawer
46
+ ```
47
+
48
+ Install the framework extra you need, for example Qiskit:
49
+
50
+ ```bash
51
+ python -m pip install "quantum-circuit-drawer[qiskit]"
52
+ ```
53
+
54
+ For notebooks, install Jupyter tools in the same environment:
55
+
56
+ ```bash
57
+ python -m pip install jupyter ipykernel
58
+ ```
59
+
60
+ See the full [installation guide](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/installation.md) for Windows PowerShell commands, Linux/WSL commands, optional extras, CUDA-Q notes, and local editable installs.
61
+
62
+ ## Basic usage
63
+
64
+ ```python
65
+ from qiskit import QuantumCircuit
66
+
67
+ from quantum_circuit_drawer import draw_quantum_circuit
68
+
69
+ circuit = QuantumCircuit(2, 1)
70
+ circuit.h(0)
71
+ circuit.cx(0, 1)
72
+ circuit.measure(1, 0)
73
+
74
+ figure, axes = draw_quantum_circuit(circuit)
75
+ ```
76
+
77
+ By default, the library detects the circuit framework, creates a Matplotlib figure, uses the built-in `dark` theme, and shows the figure when the active Matplotlib backend is interactive.
78
+
79
+ For script-friendly output:
80
+
81
+ ```python
82
+ draw_quantum_circuit(circuit, output="bell.png", show=False)
83
+ ```
84
+
85
+ ## Documentation
86
+
87
+ - [Documentation index](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/index.md): the full map.
88
+ - [Getting started](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/getting-started.md): the shortest first successful example.
89
+ - [Installation](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/installation.md): virtual environments, extras, notebooks, and local installs.
90
+ - [API reference](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/api.md): `draw_quantum_circuit(...)`, style options, return values, and exceptions.
91
+ - [User guide](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/user-guide.md): workflows, examples, tips, 2D/3D views, sliders, and reports.
92
+ - [Frameworks](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/frameworks.md): Qiskit, Cirq, PennyLane, MyQLM, CUDA-Q, and internal IR notes.
93
+ - [Recipes](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/recipes.md): copy-paste solutions for common tasks.
94
+ - [Troubleshooting](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/troubleshooting.md): common errors and fixes.
95
+ - [Development](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/development.md): local checks, build commands, and benchmark notes.
96
+
97
+ Runnable example scripts live in [`examples/`](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/tree/main/examples), with more detail in [`examples/README.md`](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/examples/README.md).
98
+
99
+ ## Project links
100
+
101
+ - Repository: [github.com/DOKOS-TAYOS/quantum-circuit-drawer](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer)
102
+ - Issue tracker: [github.com/DOKOS-TAYOS/quantum-circuit-drawer/issues](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/issues)
103
+ - Changelog: [CHANGELOG.md](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/CHANGELOG.md)
104
+
105
+ ## License
106
+
107
+ This project is distributed under the [MIT License](https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/LICENSE).
@@ -0,0 +1,67 @@
1
+ # Third-party software (declared dependencies)
2
+
3
+ This document lists third-party software declared directly in
4
+ `pyproject.toml` as build, runtime, or optional extra dependencies.
5
+
6
+ It is a practical inventory, not legal advice. If you need formal compliance
7
+ for a commercial or redistributed product, review the upstream license texts
8
+ and seek legal review if needed.
9
+
10
+ The license for this repository is in `LICENSE` (MIT).
11
+
12
+ ## Runtime dependencies (`[project] dependencies`)
13
+
14
+ | Package (PyPI) | License | Primary source |
15
+ |----------------|---------|----------------|
16
+ | `matplotlib` | Python Software Foundation License | [PyPI metadata](https://pypi.org/project/matplotlib/) and [upstream license](https://github.com/matplotlib/matplotlib/tree/main/LICENSE) |
17
+ | `numpy` | PyPI currently publishes the license expression `BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0` | [PyPI metadata](https://pypi.org/project/numpy/) and [upstream license](https://github.com/numpy/numpy/blob/main/LICENSE.txt) |
18
+
19
+ ## Optional extras (`[project.optional-dependencies]`)
20
+
21
+ These only apply if you install the corresponding extra, for example
22
+ `pip install "quantum-circuit-drawer[qiskit]"`.
23
+
24
+ | Extra | Package (PyPI) | License | Primary source |
25
+ |-------|----------------|---------|----------------|
26
+ | `qiskit` | `qiskit` | Apache-2.0 | [PyPI metadata](https://pypi.org/project/qiskit/) and [upstream license](https://github.com/Qiskit/qiskit/blob/main/LICENSE.txt) |
27
+ | `cirq` | `cirq-core` | Apache-2.0 | [PyPI metadata](https://pypi.org/project/cirq-core/) and [upstream license](https://github.com/quantumlib/Cirq/blob/main/LICENSE) |
28
+ | `pennylane` | `pennylane` | Apache-2.0 | [PyPI metadata](https://pypi.org/project/pennylane/) and [upstream license](https://github.com/PennyLaneAI/pennylane/blob/master/LICENSE) |
29
+ | `cudaq` | `cudaq` | Apache-2.0. CUDA-Q also indicates that it uses the NVIDIA cuQuantum SDK under its own license. Review that separately if your release process redistributes or directly depends on that stack. | [PyPI metadata](https://pypi.org/project/cudaq/) and [upstream license](https://github.com/NVIDIA/cuda-quantum/blob/main/LICENSE) |
30
+
31
+ ## Review required before release
32
+
33
+ | Extra | Package (PyPI) | Status | Primary source |
34
+ |-------|----------------|--------|----------------|
35
+ | `myqlm` | `myqlm` | Review required for the PyPI/GitHub release checklist. The official myQLM documentation describes a mixed model: proprietary runtime under an EULA and open-source components under Apache-2.0. Do not treat this extra as a standard permissive dependency until this is reviewed. | [myQLM license documentation](https://myqlm.github.io/01_getting_started/%3Amyqlm%3Alicense.html) |
36
+
37
+ ## Development and publishing tools (`dev`)
38
+
39
+ These are used for local development, CI, and publishing. They are not runtime
40
+ dependencies of the wheel published for end users.
41
+
42
+ | Package (PyPI) | License |
43
+ |----------------|---------|
44
+ | `pytest` | MIT |
45
+ | `pytest-cov` | MIT |
46
+ | `ruff` | MIT |
47
+ | `mypy` | MIT |
48
+ | `build` | MIT |
49
+ | `twine` | Apache-2.0 |
50
+
51
+ ## Build toolchain (`[build-system] requires`)
52
+
53
+ These are needed to build the project from source code, not to use the library
54
+ once it is installed.
55
+
56
+ | Package (PyPI) | License |
57
+ |----------------|---------|
58
+ | `setuptools` | MIT |
59
+ | `wheel` | MIT |
60
+
61
+ ---
62
+
63
+ Installing with `pip` may pull in additional transitive dependencies. They are
64
+ not listed here because they are not declared directly in our
65
+ `pyproject.toml`. For a complete inventory of the environment, use whichever
66
+ tool you prefer (`pip-licenses`, SBOM export, etc.) against the exact
67
+ environment you plan to distribute or audit.
@@ -0,0 +1,128 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "quantum-circuit-drawer"
7
+ description = "Backend-agnostic quantum circuit drawing library with Matplotlib as the first renderer."
8
+ readme = "README.md"
9
+ requires-python = ">=3.11"
10
+ license = "MIT"
11
+ license-files = ["LICENSE", "THIRD_PARTY_LICENSES.md"]
12
+ dynamic = ["version"]
13
+ authors = [
14
+ { name = "Alejandro Mata Ali" },
15
+ ]
16
+ keywords = ["quantum", "qiskit", "cirq", "matplotlib", "visualization"]
17
+ classifiers = [
18
+ "Development Status :: 4 - Beta",
19
+ "Intended Audience :: Developers",
20
+ "Intended Audience :: Science/Research",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3 :: Only",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Topic :: Scientific/Engineering",
26
+ "Topic :: Software Development :: Libraries :: Python Modules",
27
+ ]
28
+ dependencies = [
29
+ "matplotlib>=3.7",
30
+ "numpy>=1.24",
31
+ ]
32
+
33
+ [project.urls]
34
+ Homepage = "https://github.com/DOKOS-TAYOS/quantum-circuit-drawer"
35
+ Documentation = "https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/docs/index.md"
36
+ Repository = "https://github.com/DOKOS-TAYOS/quantum-circuit-drawer"
37
+ Issues = "https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/issues"
38
+ Changelog = "https://github.com/DOKOS-TAYOS/quantum-circuit-drawer/blob/main/CHANGELOG.md"
39
+
40
+ [project.optional-dependencies]
41
+ qiskit = [
42
+ "qiskit>=1.0",
43
+ ]
44
+ cirq = [
45
+ "cirq-core>=1.3",
46
+ ]
47
+ pennylane = [
48
+ "pennylane>=0.35",
49
+ ]
50
+ myqlm = [
51
+ "myqlm>=1.11",
52
+ ]
53
+ cudaq = [
54
+ "cudaq>=0.13; platform_system == 'Linux'",
55
+ ]
56
+ dev = [
57
+ "pytest>=8.0",
58
+ "pytest-cov>=5.0",
59
+ "ruff>=0.6",
60
+ "mypy>=1.11",
61
+ "build>=1.2",
62
+ "twine>=5.1",
63
+ ]
64
+
65
+ [tool.setuptools]
66
+ package-dir = { "" = "src" }
67
+
68
+ [tool.setuptools.packages.find]
69
+ where = ["src"]
70
+
71
+ [tool.setuptools.package-data]
72
+ quantum_circuit_drawer = ["py.typed"]
73
+
74
+ [tool.setuptools.dynamic]
75
+ version = { attr = "quantum_circuit_drawer._version.__version__" }
76
+
77
+ [tool.pytest.ini_options]
78
+ minversion = "8.0"
79
+ testpaths = ["tests"]
80
+ addopts = "-ra --strict-markers -p no:cacheprovider --cov=quantum_circuit_drawer --cov-report=term-missing --cov-fail-under=90"
81
+
82
+ [tool.ruff]
83
+ target-version = "py311"
84
+ line-length = 100
85
+ src = ["src", "tests", "examples"]
86
+ extend-exclude = [".pytest_tmp", "test_tmp"]
87
+
88
+ [tool.ruff.lint]
89
+ select = ["E", "F", "I", "UP"]
90
+ ignore = ["E501"]
91
+
92
+ [tool.ruff.lint.per-file-ignores]
93
+ "tests/test_cudaq_adapter_integration.py" = ["F821"]
94
+ "tests/test_cirq_adapter.py" = ["E402"]
95
+ "tests/test_qiskit_adapter.py" = ["E402"]
96
+
97
+ [tool.mypy]
98
+ python_version = "3.11"
99
+ files = ["src/quantum_circuit_drawer"]
100
+ mypy_path = "src"
101
+ check_untyped_defs = true
102
+ disallow_untyped_defs = true
103
+ no_implicit_optional = true
104
+ warn_redundant_casts = true
105
+ warn_unused_ignores = true
106
+
107
+ [[tool.mypy.overrides]]
108
+ module = [
109
+ "cirq",
110
+ "cudaq",
111
+ "pennylane",
112
+ "qat",
113
+ "qat.*",
114
+ "qiskit",
115
+ "qiskit.*",
116
+ ]
117
+ ignore_missing_imports = true
118
+
119
+ [tool.coverage.run]
120
+ source = ["quantum_circuit_drawer"]
121
+ omit = [
122
+ "*/adapters/qiskit_adapter.py",
123
+ "*/adapters/cirq_adapter.py",
124
+ ]
125
+
126
+ [tool.coverage.report]
127
+ fail_under = 90
128
+ show_missing = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,100 @@
1
+ """Public package exports for :mod:`quantum_circuit_drawer`.
2
+
3
+ The package-level namespace intentionally stays small: the convenience
4
+ ``draw_quantum_circuit(...)`` entrypoint, style types, version information,
5
+ and the exception types that callers are most likely to handle directly.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from collections.abc import Mapping
11
+ from typing import TYPE_CHECKING, Literal
12
+
13
+ from ._version import __version__
14
+ from .exceptions import (
15
+ LayoutError,
16
+ QuantumCircuitDrawerError,
17
+ RenderingError,
18
+ StyleValidationError,
19
+ UnsupportedBackendError,
20
+ UnsupportedFrameworkError,
21
+ UnsupportedOperationError,
22
+ )
23
+ from .hover import HoverOptions
24
+ from .style import DrawStyle, DrawTheme
25
+
26
+ if TYPE_CHECKING:
27
+ from matplotlib.axes import Axes
28
+
29
+ from .typing import LayoutEngine3DLike, LayoutEngineLike, OutputPath, RenderResult
30
+
31
+
32
+ def draw_quantum_circuit(
33
+ circuit: object,
34
+ framework: str | None = None,
35
+ *,
36
+ style: DrawStyle | Mapping[str, object] | None = None,
37
+ layout: LayoutEngineLike | LayoutEngine3DLike | None = None,
38
+ backend: str = "matplotlib",
39
+ ax: Axes | None = None,
40
+ output: OutputPath | None = None,
41
+ show: bool = True,
42
+ figsize: tuple[float, float] | None = None,
43
+ page_slider: bool = False,
44
+ composite_mode: str = "compact",
45
+ view: Literal["2d", "3d"] = "2d",
46
+ topology: Literal["line", "grid", "star", "star_tree", "honeycomb"] = "line",
47
+ direct: bool = True,
48
+ hover: bool | HoverOptions | Mapping[str, object] = False,
49
+ **options: object,
50
+ ) -> RenderResult:
51
+ """Draw a supported circuit through the package-level convenience API.
52
+
53
+ This wrapper preserves the full public signature while deferring the
54
+ internal API import until call time.
55
+
56
+ Returns:
57
+ ``(figure, axes)`` when the library manages the Matplotlib figure, or
58
+ the caller-provided axes when ``ax=...`` is used.
59
+
60
+ Notes:
61
+ ``page_slider=True`` requires a managed 2D figure.
62
+ ``view="3d"`` requires a 3D Matplotlib axes when ``ax`` is provided.
63
+ """
64
+
65
+ from .api import draw_quantum_circuit as _draw_quantum_circuit
66
+
67
+ return _draw_quantum_circuit(
68
+ circuit,
69
+ framework,
70
+ style=style,
71
+ layout=layout,
72
+ backend=backend,
73
+ ax=ax,
74
+ output=output,
75
+ show=show,
76
+ figsize=figsize,
77
+ page_slider=page_slider,
78
+ composite_mode=composite_mode,
79
+ view=view,
80
+ topology=topology,
81
+ direct=direct,
82
+ hover=hover,
83
+ **options,
84
+ )
85
+
86
+
87
+ __all__ = [
88
+ "DrawStyle",
89
+ "DrawTheme",
90
+ "HoverOptions",
91
+ "LayoutError",
92
+ "QuantumCircuitDrawerError",
93
+ "RenderingError",
94
+ "StyleValidationError",
95
+ "UnsupportedBackendError",
96
+ "UnsupportedFrameworkError",
97
+ "UnsupportedOperationError",
98
+ "__version__",
99
+ "draw_quantum_circuit",
100
+ ]