From f9f0c8b70d6dcdbef7018206c91c9ea7fdbc1b28 Mon Sep 17 00:00:00 2001 From: David Yonge-Mallo Date: Mon, 8 Apr 2024 16:29:28 +0200 Subject: [PATCH 1/3] Replace call to `QuantumCircuit.qasm` with `qasm2.dumps`, as the former is deprecated in Qiskit v1.0. See: https://docs.quantum.ibm.com/api/migration-guides/qiskit-1.0-features#quantumcircuitqasm --- tests/test_qasm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_qasm.py b/tests/test_qasm.py index 59fafc1b..0ec91ea2 100644 --- a/tests/test_qasm.py +++ b/tests/test_qasm.py @@ -40,6 +40,7 @@ try: from qiskit import quantum_info, transpile from qiskit.circuit import QuantumCircuit + from qiskit.qasm2 import dumps from qiskit.qasm3 import loads except ImportError: QuantumCircuit = None @@ -244,7 +245,7 @@ def test_qiskit_transpile_pyzx_optimization_round_trip(self): qc1 = transpile(qc) t1 = quantum_info.Operator(qc1).data - c = Circuit.from_qasm(qc1.qasm()) + c = Circuit.from_qasm(dumps(qc1)) g = c.to_graph() full_reduce(g) qasm = extract_circuit(g).to_basic_gates().to_qasm() From 5dd11d3422d163cc72efc50511d7bd9637841cea Mon Sep 17 00:00:00 2001 From: David Yonge-Mallo Date: Mon, 8 Apr 2024 16:34:34 +0200 Subject: [PATCH 2/3] Ensure that Qiskit tests are run in CI/CD pipeline. --- .github/workflows/pythonpackage.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 19d85645..a08336e3 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -26,6 +26,7 @@ jobs: run: | python -m pip install --upgrade pip pip install mypy==1.5.1 + pip install qiskit~=1.0.0 if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: mypy run: | From 85499d13460f822a1db68676fb61fc448d5ff6a9 Mon Sep 17 00:00:00 2001 From: David Yonge-Mallo Date: Mon, 8 Apr 2024 16:52:00 +0200 Subject: [PATCH 3/3] Add a test_requirements.txt file and put qiskit dependencies in it. --- .github/workflows/pythonpackage.yml | 2 +- test_requirements.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 test_requirements.txt diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index a08336e3..b2b2d4aa 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -26,8 +26,8 @@ jobs: run: | python -m pip install --upgrade pip pip install mypy==1.5.1 - pip install qiskit~=1.0.0 if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f test_requirements.txt ]; then pip install -r test_requirements.txt; fi - name: mypy run: | mypy pyzx/ tests/ diff --git a/test_requirements.txt b/test_requirements.txt new file mode 100644 index 00000000..d1c50370 --- /dev/null +++ b/test_requirements.txt @@ -0,0 +1,2 @@ +qiskit~=1.0.0 +qiskit_qasm3_import~=0.4.2