# Qiskit Trebugger <img src = 'imgs/logo.png' align = "center" height = "40px" width = "40px">
[](http://unitary.fund)
A new take on debuggers for quantum transpilers.
This repository presents a debugger for the **qiskit transpiler** in the form of a light weight jupyter widget. Built as a project for the Qiskit Advocate Mentorship Program, Fall 2021.
## Installation
1. To install the debugger using pip (a python package manager), use -
```bash
pip install qiskit-trebugger
```
PIP will handle the dependencies required for the package automatically and would install the latest version.
2. To directly install via github follow the steps below after using `git clone`:
```bash
git clone https://github.com/TheGupta2012/qiskit-timeline-debugger.git
```
- Make sure `python3` and `pip` are installed in your system. It is recommended to use a python virtual environment to install and develop the debugger
- `cd` into the `qiskit-timeline-debugger` directory
- Use `pip install -r requirements.txt` to install the project dependencies
- Next, execute `pip install .` command to install the debugger
## Usage Instructions
- After installing the package, import the `Debugger` instance from `qiskit_trebugger` package.
- To run the debugger, simply replace the call to `transpile()` method of the qiskit module with `debug()` method of your debugger instance.
- The debugger provides two types of views namely *jupyter* and *cli*
- The **cli** view is the default view and recommender for users who want to use the debugger in a terminal environment
- The **jupyter** view is recommended for usage in a jupyter notebook and provides a more interactive and detailed view of the transpilation process.
- For an example -
```python
from qiskit.providers.fake_provider import FakeCasablanca
from qiskit.circuit.random import random_circuit
from qiskit_trebugger import Debugger
import warnings
warnings.simplefilter('ignore')
debugger = Debugger(view_type = "jupyter")
backend = FakeCasablanca()
circuit = random_circuit(num_qubits = 4, depth = 5 , seed = 44)
# replace transpile call
debugger.debug(circuit, optimization_level = 2, backend = backend, initial_layout = list(range(4)))
```
- On calling the debug method, a new jupyter widget is displayed providing a complete summary and details of the transpilation process for circuits of < 2000 depth
- With an easy to use and responsive interface, users can quickly see which transpiler passes ran when, how they changed the quantum circuit and what exactly changed.
## Feature Highlights
### `jupyter` view
<img src = 'imgs/jupyter/working.gif' width = '90%'>
#### 1. Circuit Evolution
- See your circuit changing while going through the transpilation process for a target quantum processor.
- A new custom feature enabling **visual diffs** for quantum circuits, allows you to see what exactly changed in your circuit using the matplotlib drawer of the qiskit module.
> Example
- Circuit 1
<img src='imgs/jupyter/diff-1.png' height = "20%" width = "47%">
- Circuit 2
<img src='imgs/jupyter/diff-2.png' height = "40%" width = "70%">
#### 2. Circuit statistics
- Allows users to quickly scan through how the major properties of a circuit transform during each transpilation pass.
- Helps to quickly isolate the passes which were responsible for the major changes in the resultant circuit.
<img src = 'imgs/jupyter/stats.png' height = '10%'>
#### 3. Transpiler Logs and Property sets
- Easily parse actions of the transpiler with logs emitted by each of its constituent passes and changes to the property set during transpilation
- Every log record is color coded according to the level of severity i.e. `DEBUG`, `INFO`, `WARNING` and `CRITICAL`.
<img src = 'imgs/jupyter/logs.png' height = '38%'>
### `cli` view
<img src="imgs/cli/working.gif" width = "90%">
#### 1. Transpilation Summary and Statistics
- A quick summary of the transpilation process for a given circuit.
- Faster access to information in the CLI view.
<img src="imgs/cli/full-view.png" width = "80%">
#### 2. Keyboard Shortcuts
- The CLI view provides keyboard shortcuts for easy navigation and access to transpiler information.
- An **interactive status bar** at the bottom of the screen provides information about the current state of the debugger.
<img src = "imgs/cli/status-main.png">
<img src = "imgs/cli/status-input.png">
<img src = "imgs/cli/status-idx.png">
#### 3. Transpiler Logs and Property sets
- Emits transpiler logs associated with each of the transpiler passes.
- Highlights addition to property set and its changes during the transpilation process.
<img src = "imgs/cli/indexed-1.png" width = "90%">
<img src = "imgs/cli/indexed-2.png" width = "90%">
## Demonstration and Blog
- Here is a [demonstration of TreBugger](https://drive.google.com/file/d/1oRstcov-OQWDpsM7Q53x7BfgFC-edtkT/view?usp=sharing) as a part of the final showcase for the Qiskit Advocate Mentorship Program, Fall 2021.
- You can also read about some more details of our project in the [Qiskit medium blog](https://medium.com/qiskit/qiskit-trebugger-f7242066d368)
## Contributors
- [Aboulkhair Foda](https://github.com/EgrettaThula)
- [Harshit Gupta](https://github.com/TheGupta2012)
Raw data
{
"_id": null,
"home_page": "https://github.com/TheGupta2012/qiskit-timeline-debugger",
"name": "qiskit-trebugger",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Egretta Thula, Harshit Gupta",
"author_email": "harshit.11235@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/a6/54/8897a3fcf75d8ad585fe618c4314ca1a2faf5eb0f4777de32b91f6023a6f/qiskit_trebugger-1.1.2.tar.gz",
"platform": null,
"description": "# Qiskit Trebugger <img src = 'imgs/logo.png' align = \"center\" height = \"40px\" width = \"40px\">\n\n[](http://unitary.fund)\n\nA new take on debuggers for quantum transpilers. \nThis repository presents a debugger for the **qiskit transpiler** in the form of a light weight jupyter widget. Built as a project for the Qiskit Advocate Mentorship Program, Fall 2021. \n\n\n## Installation\n1. To install the debugger using pip (a python package manager), use - \n\n```bash\npip install qiskit-trebugger\n``` \nPIP will handle the dependencies required for the package automatically and would install the latest version. \n\n2. To directly install via github follow the steps below after using `git clone`: \n ```bash\n git clone https://github.com/TheGupta2012/qiskit-timeline-debugger.git\n ```\n - Make sure `python3` and `pip` are installed in your system. It is recommended to use a python virtual environment to install and develop the debugger\n - `cd` into the `qiskit-timeline-debugger` directory\n - Use `pip install -r requirements.txt` to install the project dependencies\n - Next, execute `pip install .` command to install the debugger\n\n## Usage Instructions\n\n- After installing the package, import the `Debugger` instance from `qiskit_trebugger` package. \n- To run the debugger, simply replace the call to `transpile()` method of the qiskit module with `debug()` method of your debugger instance.\n- The debugger provides two types of views namely *jupyter* and *cli*\n- The **cli** view is the default view and recommender for users who want to use the debugger in a terminal environment \n- The **jupyter** view is recommended for usage in a jupyter notebook and provides a more interactive and detailed view of the transpilation process.\n- For an example - \n\n```python\nfrom qiskit.providers.fake_provider import FakeCasablanca\nfrom qiskit.circuit.random import random_circuit \nfrom qiskit_trebugger import Debugger\nimport warnings\n\nwarnings.simplefilter('ignore')\ndebugger = Debugger(view_type = \"jupyter\")\nbackend = FakeCasablanca()\ncircuit = random_circuit(num_qubits = 4, depth = 5 , seed = 44)\n# replace transpile call \ndebugger.debug(circuit, optimization_level = 2, backend = backend, initial_layout = list(range(4)))\n``` \n- On calling the debug method, a new jupyter widget is displayed providing a complete summary and details of the transpilation process for circuits of < 2000 depth\n- With an easy to use and responsive interface, users can quickly see which transpiler passes ran when, how they changed the quantum circuit and what exactly changed.\n\n\n## Feature Highlights\n\n### `jupyter` view\n\n<img src = 'imgs/jupyter/working.gif' width = '90%'>\n\n#### 1. Circuit Evolution\n- See your circuit changing while going through the transpilation process for a target quantum processor.\n- A new custom feature enabling **visual diffs** for quantum circuits, allows you to see what exactly changed in your circuit using the matplotlib drawer of the qiskit module.\n\n> Example \n- Circuit 1\n<img src='imgs/jupyter/diff-1.png' height = \"20%\" width = \"47%\">\n\n- Circuit 2\n<img src='imgs/jupyter/diff-2.png' height = \"40%\" width = \"70%\">\n\n\n\n#### 2. Circuit statistics\n- Allows users to quickly scan through how the major properties of a circuit transform during each transpilation pass. \n- Helps to quickly isolate the passes which were responsible for the major changes in the resultant circuit.\n\n<img src = 'imgs/jupyter/stats.png' height = '10%'>\n\n#### 3. Transpiler Logs and Property sets\n- Easily parse actions of the transpiler with logs emitted by each of its constituent passes and changes to the property set during transpilation\n- Every log record is color coded according to the level of severity i.e. `DEBUG`, `INFO`, `WARNING` and `CRITICAL`.\n\n\n<img src = 'imgs/jupyter/logs.png' height = '38%'>\n\n\n### `cli` view\n\n<img src=\"imgs/cli/working.gif\" width = \"90%\">\n\n#### 1. Transpilation Summary and Statistics\n- A quick summary of the transpilation process for a given circuit.\n- Faster access to information in the CLI view.\n\n<img src=\"imgs/cli/full-view.png\" width = \"80%\">\n\n#### 2. Keyboard Shortcuts \n\n- The CLI view provides keyboard shortcuts for easy navigation and access to transpiler information.\n- An **interactive status bar** at the bottom of the screen provides information about the current state of the debugger. \n\n<img src = \"imgs/cli/status-main.png\">\n<img src = \"imgs/cli/status-input.png\">\n<img src = \"imgs/cli/status-idx.png\">\n\n\n#### 3. Transpiler Logs and Property sets\n\n- Emits transpiler logs associated with each of the transpiler passes.\n- Highlights addition to property set and its changes during the transpilation process.\n\n<img src = \"imgs/cli/indexed-1.png\" width = \"90%\"> \n<img src = \"imgs/cli/indexed-2.png\" width = \"90%\">\n\n\n\n## Demonstration and Blog\n- Here is a [demonstration of TreBugger](https://drive.google.com/file/d/1oRstcov-OQWDpsM7Q53x7BfgFC-edtkT/view?usp=sharing) as a part of the final showcase for the Qiskit Advocate Mentorship Program, Fall 2021.\n- You can also read about some more details of our project in the [Qiskit medium blog](https://medium.com/qiskit/qiskit-trebugger-f7242066d368)\n\n## Contributors \n- [Aboulkhair Foda](https://github.com/EgrettaThula)\n- [Harshit Gupta](https://github.com/TheGupta2012)\n\n\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "A timeline debugger for the qiskit transpiler",
"version": "1.1.2",
"project_urls": {
"Homepage": "https://github.com/TheGupta2012/qiskit-timeline-debugger"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1b4815e9501e4e809f9801105628ba0b4c657b0f2db6787aa87355f0c63f6f54",
"md5": "5512345f4b189fe431b381e4d176b6bb",
"sha256": "7bb13f486d476f3b6db6084463115acddcd4b6e6f557e4c0b8dba792bada2a0b"
},
"downloads": -1,
"filename": "qiskit_trebugger-1.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5512345f4b189fe431b381e4d176b6bb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 65246,
"upload_time": "2023-08-22T16:20:04",
"upload_time_iso_8601": "2023-08-22T16:20:04.132202Z",
"url": "https://files.pythonhosted.org/packages/1b/48/15e9501e4e809f9801105628ba0b4c657b0f2db6787aa87355f0c63f6f54/qiskit_trebugger-1.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a6548897a3fcf75d8ad585fe618c4314ca1a2faf5eb0f4777de32b91f6023a6f",
"md5": "5d69916f3bf08d8880afa4456c68972b",
"sha256": "73bc48a327168d2bbd2d5661c33d4bac2b26bcb3210a38d61e36fb918a705e8e"
},
"downloads": -1,
"filename": "qiskit_trebugger-1.1.2.tar.gz",
"has_sig": false,
"md5_digest": "5d69916f3bf08d8880afa4456c68972b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 17855462,
"upload_time": "2023-08-22T16:20:24",
"upload_time_iso_8601": "2023-08-22T16:20:24.789234Z",
"url": "https://files.pythonhosted.org/packages/a6/54/8897a3fcf75d8ad585fe618c4314ca1a2faf5eb0f4777de32b91f6023a6f/qiskit_trebugger-1.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-22 16:20:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "TheGupta2012",
"github_project": "qiskit-timeline-debugger",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "ipython",
"specs": [
[
">=",
"8.12.0"
]
]
},
{
"name": "ipywidgets",
"specs": [
[
"==",
"7.6.5"
]
]
},
{
"name": "numpy",
"specs": [
[
"==",
"1.22.2"
]
]
},
{
"name": "qiskit",
"specs": [
[
"==",
"0.43.0"
]
]
},
{
"name": "qiskit_ignis",
"specs": [
[
"==",
"0.7.0"
]
]
},
{
"name": "tabulate",
"specs": [
[
"==",
"0.9.0"
]
]
},
{
"name": "matplotlib",
"specs": [
[
">=",
"3.3"
]
]
},
{
"name": "pylatexenc",
"specs": [
[
">=",
"1.4"
]
]
}
],
"lcname": "qiskit-trebugger"
}