diff --git a/.github/workflows/python_tox.yml b/.github/workflows/python_tox.yml index 12770af..7705ddc 100644 --- a/.github/workflows/python_tox.yml +++ b/.github/workflows/python_tox.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 874d3b9..f205307 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: diff --git a/README.md b/README.md index a416eed..971e8c1 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/SECURITY.md b/SECURITY.md index ccfa4b9..08c56d2 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -3,6 +3,6 @@ ## Supported Versions | Version | Supported | -| ------- | ------------------ | -| >= 0.3 | :white_check_mark: | -| < 0.2 | :x: | +|---------| ------------------ | +| >= 0.5 | :white_check_mark: | +| < 0.4 | :x: | diff --git a/docs/qiskit_class_converter.html b/docs/qiskit_class_converter.html index 6712c35..250484f 100644 --- a/docs/qiskit_class_converter.html +++ b/docs/qiskit_class_converter.html @@ -3,7 +3,7 @@ - + qiskit_class_converter API documentation @@ -638,7 +638,7 @@
Inherited Members
__VERSION__ = -'0.4.1' +'0.5.0'
@@ -650,7 +650,7 @@
Inherited Members
__QISKIT_VERSION__ = -'0.44.2' +'1.0.1'
@@ -662,7 +662,7 @@
Inherited Members
__FULL_VERSION__ = -{'Qiskit': '0.44.2', 'Lib': '0.4.1'} +{'Qiskit': '1.0.1', 'Lib': '0.5.0'}
diff --git a/pyproject.toml b/pyproject.toml index 3cbca6d..e4a1c71 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" }, ] @@ -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] diff --git a/qiskit_class_converter/converters/quantum_circuit_to_matrix.py b/qiskit_class_converter/converters/quantum_circuit_to_matrix.py index 092fb9f..da7037b 100644 --- a/qiskit_class_converter/converters/quantum_circuit_to_matrix.py +++ b/qiskit_class_converter/converters/quantum_circuit_to_matrix.py @@ -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() diff --git a/requirements-dev.txt b/requirements-dev.txt index 056796e..6918bcf 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -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 \ No newline at end of file +pdoc==14.4.0 +notebook==7.1.1 diff --git a/requirements.txt b/requirements.txt index fcd62e3..1aaa9bf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 \ No newline at end of file +numpy==1.26.4 \ No newline at end of file diff --git a/scripts/migration_to_1.0.sh b/scripts/migration_to_1.0.sh new file mode 100644 index 0000000..fef993d --- /dev/null +++ b/scripts/migration_to_1.0.sh @@ -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 \ No newline at end of file diff --git a/tox.ini b/tox.ini index 3265b48..3c95553 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 3.9 -envlist = py39, py310, py311, lint, coverage +envlist = py39, py310, py311, py312, lint, coverage skipsdist = True [gh-actions] @@ -8,6 +8,7 @@ python = 3.9: py39 3.10: py310 3.11: py311 + 3.12: py312 [testenv] usedevelop = true