Skip to content

Commit

Permalink
Merge pull request #75 from KMU-quantum-classroom/develop
Browse files Browse the repository at this point in the history
compatible with Qiskit 1.0.0
  • Loading branch information
minwook-shin authored Mar 6, 2024
2 parents 273b643 + f1f69c7 commit efbe090
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python_tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# CHANGELOG.md

## 0.5.0 (2024-03-06)

The Version has been updated to be compatible with **Qiskit 1.0.0** and **Python 3.12**.

Qiskit Dependencies:

- **Bump qiskit from 0.45.1 to 1.0.1**
- changes in Qiskit 1.0.0
- read the release notes for more information
- https://docs.quantum.ibm.com/api/qiskit/release-notes/1.0
- Bump qiskit-aer from 0.13.1 to 0.13.3

Other Dependencies:

- Bump numpy from 1.26.2 to 1.26.4
- Bump notebook from 7.0.6 to 7.1.1
- Bump pdoc from 14.1.0 to 14.4.0
- Bump pylint from 3.0.2 to 3.1.0
- Bump coverage from 7.3.2 to 7.4.3

Changes:

- Updated the QuantumCircuitToMatrixConverter class to be compatible with Qiskit 1.0.0.
- The Bit class in Qiskit 1.0.0 no longer has register and index attributes.
- The actual_convert_action method of the QuantumCircuitToMatrixConverter class has been updated to use QuantumCircuit.find_bit() instead of directly accessing the index attribute of a Bit object.
- optimized the code to be compatible with qiskit 1.0.0
- added unittest to be compatible with python 3.12

## 0.4.3 (2023-12-02)

Qiskit Dependencies:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# qiskit-classroom-converter
Qiskit classroom Converter

> 0.5.0 (2024-03-06) : The Version has been updated to be compatible with **Qiskit 1.0.0** and **Python 3.12**.

## Documents

https://kmu-quantum-classroom.github.io/qiskit-classroom-converter/qiskit_class_converter.html
Expand Down
6 changes: 3 additions & 3 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
## Supported Versions

| Version | Supported |
| ------- | ------------------ |
| >= 0.3 | :white_check_mark: |
| < 0.2 | :x: |
|---------| ------------------ |
| >= 0.5 | :white_check_mark: |
| < 0.4 | :x: |
8 changes: 4 additions & 4 deletions docs/qiskit_class_converter.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="generator" content="pdoc 14.1.0"/>
<meta name="generator" content="pdoc 14.4.0"/>
<title>qiskit_class_converter API documentation</title>

<style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style>
Expand Down Expand Up @@ -638,7 +638,7 @@ <h5>Inherited Members</h5>
<section id="__VERSION__">
<div class="attr variable">
<span class="name">__VERSION__</span> =
<span class="default_value">&#39;0.4.1&#39;</span>
<span class="default_value">&#39;0.5.0&#39;</span>


</div>
Expand All @@ -650,7 +650,7 @@ <h5>Inherited Members</h5>
<section id="__QISKIT_VERSION__">
<div class="attr variable">
<span class="name">__QISKIT_VERSION__</span> =
<span class="default_value">&#39;0.44.2&#39;</span>
<span class="default_value">&#39;1.0.1&#39;</span>


</div>
Expand All @@ -662,7 +662,7 @@ <h5>Inherited Members</h5>
<section id="__FULL_VERSION__">
<div class="attr variable">
<span class="name">__FULL_VERSION__</span> =
<span class="default_value">{&#39;Qiskit&#39;: &#39;0.44.2&#39;, &#39;Lib&#39;: &#39;0.4.1&#39;}</span>
<span class="default_value">{&#39;Qiskit&#39;: &#39;1.0.1&#39;, &#39;Lib&#39;: &#39;0.5.0&#39;}</span>


</div>
Expand Down
16 changes: 8 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exclude = ['qiskit_class_converter*tests']

[project]
name = "qiskit-classroom-converter"
version = "0.4.3"
version = "0.5.0"
authors = [
{ name = "KMU-quantum-classroom" },
]
Expand All @@ -26,23 +26,23 @@ classifiers = [
"Operating System :: OS Independent",
]
dependencies = [
"qiskit==0.45.1",
"qiskit-aer==0.13.1",
"qiskit==1.0.1",
"qiskit-aer==0.13.3",
"loguru==0.7.2",
"sympy==1.12",
"antlr4-python3-runtime==4.11",
"ipython==8.18.1",
"numpy==1.26.2"
"numpy==1.26.4"
]

[project.optional-dependencies]
dev = [
"coverage==7.3.2",
"pylint==3.0.2",
"coverage==7.4.3",
"pylint==3.1.0",
"tox==4.11.4",
"build==1.0.3",
"pdoc==14.1.0",
"notebook==7.0.7"
"pdoc==14.4.0",
"notebook==7.1.1"
]

[project.urls]
Expand Down
30 changes: 6 additions & 24 deletions qiskit_class_converter/converters/quantum_circuit_to_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,30 +64,12 @@ def actual_convert_action(self):
"gate_qubits": []}
for _inst in circuit.data:
_inst_upper_name = _inst[0].name.upper()
if _inst[0].num_qubits == 2:
gate_name = (_inst_upper_name +
"_{q" + str(_inst.qubits[0].index) +
", q" + str(_inst.qubits[1].index) + "}")
self.__programmable_variable_per_qubit["gate_qubits"].append(
{"name": gate_name,
"qubit": [_inst.qubits[0].index, _inst.qubits[1].index]}
)
elif _inst[0].num_qubits == 3:
gate_name = (_inst_upper_name +
"_{q" + str(_inst.qubits[0].index) +
", q" + str(_inst.qubits[1].index) +
", q" + str(_inst.qubits[2].index) + "}")
self.__programmable_variable_per_qubit["gate_qubits"].append(
{"name": gate_name,
"qubit": [_inst.qubits[0].index,
_inst.qubits[1].index,
_inst.qubits[2].index]}
)
else:
gate_name = _inst_upper_name + "_{q" + str(_inst.qubits[0].index) + "}"
self.__programmable_variable_per_qubit["gate_qubits"].append(
{"name": gate_name, "qubit": [_inst.qubits[0].index]}
)
qubit_indices = [circuit.find_bit(qubit)[0] for qubit in _inst[1]]
gate_name = (_inst_upper_name +
"_{" + ", ".join(f"q{i}" for i in qubit_indices) + "}")
self.__programmable_variable_per_qubit["gate_qubits"].append(
{"name": gate_name, "qubit": qubit_indices}
)
matrix_list["name"].append((layer_index, self.insert_i_gate()))
layer_index += 1
matrix_list["result"] = self.qiskit.quantum_info.Operator(self.input_value).to_matrix()
Expand Down
8 changes: 4 additions & 4 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
coverage==7.3.2
pylint==3.0.2
coverage==7.4.3
pylint==3.1.0
tox==4.11.4
build==1.0.3
pdoc==14.1.0
notebook==7.0.7
pdoc==14.4.0
notebook==7.1.1
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
qiskit==0.45.1
qiskit-aer==0.13.1
qiskit==1.0.1
qiskit-aer==0.13.3
loguru==0.7.2
sympy==1.12
antlr4-python3-runtime==4.11
ipython==8.18.1
numpy==1.26.2
numpy==1.26.4
11 changes: 11 additions & 0 deletions scripts/migration_to_1.0.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Make new environment and install
python -m venv .flake8-qiskit-migration-venv
source .flake8-qiskit-migration-venv/bin/activate
pip install flake8-qiskit-migration

# Run plugin on Python code
flake8 --select QKT100 ../qiskit_class_converter/*

# Deactivate and delete environment
deactivate
rm -r .flake8-qiskit-migration-venv
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
[tox]
minversion = 3.9
envlist = py39, py310, py311, lint, coverage
envlist = py39, py310, py311, py312, lint, coverage
skipsdist = True

[gh-actions]
python =
3.9: py39
3.10: py310
3.11: py311
3.12: py312

[testenv]
usedevelop = true
Expand Down

0 comments on commit efbe090

Please sign in to comment.