PyQASM 0.3.0
Release 0.3.0 (Mar 18, 2025)
Summary
Added
- Added logic to
bump-version.yml
workflow that automatically updatesCITATION.cff
upon new release (#147) - Added
pyqasm.draw()
function that draws quantum circuit (#122):
from pyqasm import draw
qasm = """
OPENQASM 3.0;
include "stdgates.inc";
qubit[3] q;
bit[3] b;
h q[0];
z q[1];
rz(pi/1.1) q[0];
cx q[0], q[1];
swap q[0], q[1];
ccx q[0], q[1], q[2];
b = measure q;
"""
draw(qasm, output='mpl')
- Currently, only the mpl
(matplotlib) output format is supported.
- Use draw(..., idle_wires=False)
to draw circuit without empty qubit/classical bit registers.
- Save the visualization to a file by specifying output='mpl'
and a filename
:
draw(..., output='mpl', filename='/path/to/circuit.png')
- The draw method accepts either a str
(QASM source) or a QasmModule
. The following are equivalent:
from pyqasm import loads, draw
from pyqasm.printer import mpl_draw
module = loads(qasm_str)
draw(module, output='mpl')
draw(qasm_str, output='mpl')
draw(module)
draw(qasm_str)
Fixed
- Fixed bug in release workflow(s) that caused discrepancy between
pyqasm.__version__
andimportlib.metadata.version
(#147) - Fixed a bug in broadcast operation for duplicate qubits so that the following -
OPENQASM 3.0;
include "stdgates.inc";
qubit[3] q;
qubit[2] q2;
cx q[0], q[1], q[1], q[2];
cx q2, q2;
will unroll correctly to -
OPENQASM 3.0;
include "stdgates.inc";
qubit[3] q;
qubit[2] q2;
// cx q[0], q[1], q[1], q[2];
cx q[0], q[1];
cx q[1], q[2];
// cx q2, q2;
cx q2[0], q2[1];
cx q2[0], q2[1];
The logic for duplicate qubit detection is moved out of the QasmVisitor._get_op_bits
into Qasm3Analyzer
class and is executed post gate broadcast operation (#155).
Other
- Updated license from GPL-3.0 to Apache-2.0 (#158)
- Added GitHub actions for publishing to GitHub pages, and updated docs pages from Readthedocs to GitHub pages links. (#158)
PRs Merged
- write version file test pypi by @ryanhill1 in #145
- fix typo in write_version_file.py [no ci] by @ryanhill1 in #146
- Versioning fixes cont + citation by @ryanhill1 in #147
- Add yaml dep to bump-version [no ci] by @ryanhill1 in #148
- Update bump-version.yml [no ci] by @ryanhill1 in #149
- Update bump-version.yml [no ci] by @ryanhill1 in #151
- Update sphinx requirement from <8.2.0,>=7.3.7 to >=7.3.7,<8.3.0 by @dependabot in #153
- Update sphinx-autodoc-typehints requirement from <3.1,>=1.24 to >=1.24,<3.2 by @dependabot in #154
- Add check for duplicate qubits post gate broadcast by @TheGupta2012 in #155
- Change license to Apache-2.0 by @ryanhill1 in #158
- Bump codecov/codecov-action from 4.4.1 to 5.4.0 by @dependabot in #159
- Update README.md [no ci] by @ryanhill1 in #160
- Reset CHANGELOG.md [no ci] by @ryanhill1 in #161
- QasmModule Circuit Drawer by @arulandu in #122
- Add
pyqasm.draw()
to changelog [no ci] by @ryanhill1 in #162 - Bump project version to 0.3.0 by @github-actions in #163
Full Changelog: v0.2.1...v0.3.0