Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update reqs to 1.0 #536

Merged
merged 29 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ibmq_tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: IBMQ integration tests
name: IBMQ integration tests with Qiskit 1.0
on:
schedule:
- cron: '0 0 * * 0,4' # At 00:00 on Sunday and Thursday.
- cron: '1 0 * * 0,4' # At 01:00 on Sunday and Thursday.
workflow_dispatch:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 01:00? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh actually I don't know. I deleted the old tests and renamed this one and I guess they had a different schedule? If it matters I can always change it back 😅


jobs:
Expand All @@ -28,7 +28,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-ci-legacy.txt
pip install -r requirements-ci.txt
pip install wheel pytest pytest-cov pytest-mock flaky --upgrade
pip freeze

Expand Down
44 changes: 0 additions & 44 deletions .github/workflows/ibmq_tests_1.yml

This file was deleted.

17 changes: 6 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Tests for 1.0
on:
push:
branches:
Expand Down Expand Up @@ -30,7 +30,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install git+https://github.com/PennyLaneAI/pennylane.git
pip install -r requirements-ci-legacy.txt
pip install -r requirements-ci.txt
pip install wheel pytest pytest-cov pytest-mock flaky --upgrade
pip freeze

Expand All @@ -39,12 +39,9 @@ jobs:
pip install git+https://github.com/PennyLaneAI/pennylane-qiskit.git@${{ github.ref }}
pip freeze

- name: Run tests
# Skip IBMQ and Runtime tests as they depend on IBMQ's availability and
# easily result in timeouts
- name: Run standard Qiskit plugin tests
# Run the standard tests with the most recent version of Qiskit
run: python -m pytest tests -k 'not test_ibmq.py and not test_runtime.py' --cov=pennylane_qiskit --cov-report=term-missing --cov-report=xml -p no:warnings --tb=native
env:
IBMQX_TOKEN: ${{ secrets.IBMQX_TOKEN_TEST }}

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand Down Expand Up @@ -72,19 +69,17 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install git+https://github.com/PennyLaneAI/pennylane.git
pip install -r requirements-ci-legacy.txt
pip install -r requirements-ci.txt
pip install wheel pytest pytest-cov pytest-mock pytest-benchmark flaky --upgrade
pip freeze

- name: Install Plugin
run: |
python setup.py bdist_wheel
pip install dist/PennyLane*.whl
pip freeze

- name: Run tests
run: |
pl-device-test --device=qiskit.basicaer --tb=short --skip-ops --shots=20000 --device-kwargs backend=qasm_simulator
pl-device-test --device=qiskit.basicsim --tb=short --skip-ops --shots=20000 --device-kwargs backend=basic_simulator
pl-device-test --device=qiskit.aer --tb=short --skip-ops --shots=20000 --device-kwargs backend=qasm_simulator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any performance degradation for basicsim in comparison to basicaer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basicaer is deprecated in >1.0, and basicsim is the 1.0 replacement for it. Shouldn't be any performance degradation as far as I can tell.

pl-device-test --device=qiskit.aer --tb=short --skip-ops --shots=None --device-kwargs backend=statevector_simulator
pl-device-test --device=qiskit.aer --tb=short --skip-ops --shots=None --device-kwargs backend=unitary_simulator
Expand Down
91 changes: 0 additions & 91 deletions .github/workflows/tests_qiskit_1.yml

This file was deleted.

8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
### Improvements 🛠

### Breaking changes 💔
* Support has been removed for Qiskit versions below 0.46. The minimum required version for Qiskit is now 1.0.
If you want to continue to use older versions of Qiskit with the plugin, please use version 0.36 of
the Pennylane-Qiskit plugin.
[(#536)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/536)

* The test suite no longer runs for Qiskit versions below 0.46.
[(#536)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/536)

### Deprecations 👋

Expand All @@ -15,6 +22,7 @@
### Contributors ✍️

This release contains contributions from (in alphabetical order):
Austin Huang

---
# Release 0.36.0
Expand Down
5 changes: 0 additions & 5 deletions requirements-ci-legacy.txt

This file was deleted.

14 changes: 8 additions & 6 deletions tests/test_qiskit_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,16 @@ def test_warning_raised_for_hardware_backend_analytic_expval(self, recorder):
with pytest.warns(UserWarning) as record:
dev = qml.device("qiskit.aer", backend="aer_simulator", wires=2, shots=None)

# check that only one warning was raised
assert len(record) == 1
# check that the message matches
assert (
record[0].message.args[0] == "The analytic calculation of "
record[1].message.args[0] == "The analytic calculation of "
"expectations, variances and probabilities is only supported on "
f"statevector backends, not on the {dev.backend.name}. Such statistics obtained from this "
"device are estimates based on samples."
)

# Two warnings are being raised: one about analytic calculations and another about deprecation.
assert len(record) == 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We no longer check the message text?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can change the test so that it checks the message text still


@pytest.mark.parametrize("method", ["unitary", "statevector"])
def test_no_warning_raised_for_software_backend_analytic_expval(
self, method, recorder, recwarn
Expand All @@ -193,8 +193,10 @@ def test_no_warning_raised_for_software_backend_analytic_expval(

_ = qml.device("qiskit.aer", backend="aer_simulator", method=method, wires=2, shots=None)

# check that no warnings were raised
assert len(recwarn) == 0
# These simulators are being deprecated. Warning is raised in Qiskit 1.0
# Migrate to AerSimulator with AerSimulator(method=method) and append
# run circuits with the `save_state` instruction.
assert len(recwarn) == 1


class TestAerBackendOptions:
Expand Down
Loading