Highly Customizable Quantum Circuit SVG Visualizer
Project description
Quantum QuirkVis 🙃
A python package that draws quantum circuits written in qasm/OpenQASM 3.0 and outputs as SVG with a strong focus on personalization.
Features
- SVG output
- Theming engine (JSON)
- Personalization (night mode, custom colors)
- Gate symbol substitutions (emojis, icons, animations)
- Awesome "dial" for parametrized gates
- Animations and other CSS filters
- Lightweight
Themes
Default
Night
Matrix
Emoji
Installation
pip install quirkvis
Usage
from quantum_quirkvis import draw
qasm_str = """
OPENQASM 3.0;
qubit[2] q;
h q[0];
cx q[0], q[1];
"""
draw(qasm_str, theme="matrix", filename="path/to/file.svg")
# or
svg = draw(qasm_str, theme="matrix")
Personalization
Check the themes json files to see how much you can customize, you can customize anything!
Then create your own theme, you don't need to overwrite all the file, you only have to change the values of interest, the rest if defaulted.
- mytheme.json
{
"name": "default",
"styles": {
"background": "#777777",
}
}
then simply
draw(qasm_str, theme="mytheme.json")
You can also use the cli provided which exposes the command qasmvis
qasmvis ghz.qasm -t matrix -o ghz.svg
or
qasmvis ghz.qasm -t matrix > ghz.svg
or
cat ghz.qasm | qasmvis -t night > ghz.svg
Libraries
The current package just requires pyqasm to parse the qasm files or string into the AST that is processed to create SVG with the selected theme.
License
MIT
Limitations
Currently the library "unrolls" the circuit, therefore complex or custom gates (like CY, Toffoli, CSWAP, etc) are drawn as their primitives.
U-n gates are not yet supported
unitaryDESIGN
This repo is currently running for a bounty on unitaryDESIGN hackathon
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quirkvis-0.1.1.tar.gz.
File metadata
- Download URL: quirkvis-0.1.1.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afcf609002075c68f0fc21f3c581a90d8fb875eafb69a85f5bd4d6f0e7acd4b9
|
|
| MD5 |
749b6cc5bec6b2e9e36b4b8156fd656c
|
|
| BLAKE2b-256 |
a0e7483f69e80bbcada4d23486082344a3c2703d306879edfa295b7cc3b6ff12
|
Provenance
The following attestation bundles were made for quirkvis-0.1.1.tar.gz:
Publisher:
release.yml on ljcamargo/quantum_quirkvis
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quirkvis-0.1.1.tar.gz -
Subject digest:
afcf609002075c68f0fc21f3c581a90d8fb875eafb69a85f5bd4d6f0e7acd4b9 - Sigstore transparency entry: 962451195
- Sigstore integration time:
-
Permalink:
ljcamargo/quantum_quirkvis@d707370f83d3daa14a0882d725f5ecae46aa6652 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/ljcamargo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d707370f83d3daa14a0882d725f5ecae46aa6652 -
Trigger Event:
push
-
Statement type:
File details
Details for the file quirkvis-0.1.1-py3-none-any.whl.
File metadata
- Download URL: quirkvis-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92096afe333849f4f68e27cdf69cbb006f71c67c15be19e7005c24b1746f360c
|
|
| MD5 |
684d7540eb8f497323cfe0fc27e098db
|
|
| BLAKE2b-256 |
6366be37c0fca108abc398c737de3cdc7bcf0892ba1fb6535904dad8da50c94f
|
Provenance
The following attestation bundles were made for quirkvis-0.1.1-py3-none-any.whl:
Publisher:
release.yml on ljcamargo/quantum_quirkvis
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quirkvis-0.1.1-py3-none-any.whl -
Subject digest:
92096afe333849f4f68e27cdf69cbb006f71c67c15be19e7005c24b1746f360c - Sigstore transparency entry: 962451199
- Sigstore integration time:
-
Permalink:
ljcamargo/quantum_quirkvis@d707370f83d3daa14a0882d725f5ecae46aa6652 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/ljcamargo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d707370f83d3daa14a0882d725f5ecae46aa6652 -
Trigger Event:
push
-
Statement type: