Skip to content

Commit

Permalink
Fix missing comma (#120)
Browse files Browse the repository at this point in the history
* Fix: Missing comma(s) causes an error

In #119, we noted that the missing comma in
`qcs-api-client>=0.20.13<0.22.0` in `setup.py` was causing issues. With
the changes here, the reported problem disappears:

```python
>>> import pennylane as qml
>>> qml.device("rigetti.qpu", device="Aspen-M-2")
<QPUDevice device (wires=80, shots=1000) at 0x132e949d0>
```

What's more, with `pip install -e '.[test]'` in a virtual environment,
all unit tests pass.

* typo

* Fix: failing test

* fix: Format with latest black & move requirements into requirements.txt for workflows

* fix: Add requirements.txt back in

* fix: Include HALT instruction in test

* chore(changelog): Add changelog entry

* Update setup.py

* Update setup.py

* fix: Reinstitute requirements.txt, add requirements-test.txt

* fix(ci): update & pin dependencies

* fix(ci): simplify installation with pip install '.[test]'

* fix(ci): Revert back to quilc 1.23.0

---------

Co-authored-by: Albert Mitjans <a.mitjanscoma@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
  • Loading branch information
3 people committed Feb 13, 2023
1 parent f6f8dad commit 22a31f8
Show file tree
Hide file tree
Showing 10 changed files with 233 additions and 232 deletions.
52 changes: 26 additions & 26 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
name: Formatting check
on:
- pull_request

jobs:
black:
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.4.1
with:
access_token: ${{ github.token }}

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: pip install black

- uses: actions/checkout@v2

- name: Run Black
run: black -l 100 pennylane_rigetti/ --check
name: Formatting check
on:
- pull_request

jobs:
black:
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.4.1
with:
access_token: ${{ github.token }}

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: pip install black

- uses: actions/checkout@v2

- name: Run Black
run: black -l 100 pennylane_rigetti/ --check
2 changes: 1 addition & 1 deletion .github/workflows/post_release_version_bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pennylane
pip install -r requirements.txt
- name: Run version bump
run: >
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pre_release_version_bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
steps:
- name: Clone repository
uses: actions/checkout@v2

- name: Install Python
uses: actions/setup-python@v2
with:
Expand All @@ -18,7 +19,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pennylane
pip install -r requirements.txt
- name: Run version bump
run: >
Expand Down
186 changes: 87 additions & 99 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,99 +1,87 @@
name: Tests
on:
push:
branches:
- master
pull_request:

jobs:
tests:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.8", "3.10"]

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.4.1
with:
access_token: ${{ github.token }}

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Run Forest Quilc
run: docker run --rm -d -p 5555:5555 rigetti/quilc:1.23.0 -R

- name: Run Forest QVM
run: docker run --rm -d -p 5000:5000 rigetti/qvm -S

- uses: actions/checkout@v2

- name: Install requirements
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install wheel pytest pytest-cov pytest-mock flaky --upgrade
- name: Install Plugin
run: |
python setup.py bdist_wheel
pip install dist/PennyLane*.whl
- name: Run tests
run: python -m pytest tests --cov=pennylane_rigetti --cov-report=term-missing --cov-report=xml -p no:warnings --tb=native

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1.0.7
with:
file: ./coverage.xml

integration-tests:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.8", "3.10"]

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.4.1
with:
access_token: ${{ github.token }}

- name: Run Forest Quilc
run: docker run --rm -d -p 5555:5555 rigetti/quilc:1.23.0 -R

- name: Run Forest QVM
run: docker run --rm -d -p 5000:5000 rigetti/qvm -S

- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install requirements
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install wheel pytest pytest-cov pytest-mock flaky --upgrade
- name: Install Plugin
run: |
python setup.py bdist_wheel
pip install dist/PennyLane*.whl
- name: Run tests
run: |
pl-device-test --device=rigetti.numpy_wavefunction --tb=short --skip-ops --analytic=True
pl-device-test --device=rigetti.wavefunction --tb=short --skip-ops --analytic=False --shots=20000
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1.0.7
with:
file: ./coverage.xml
name: Tests
on:
push:
branches:
- master
pull_request:

jobs:
tests:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.8", "3.10"]

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.4.1
with:
access_token: ${{ github.token }}

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Run Forest Quilc
run: docker run --rm -d -p 5555:5555 rigetti/quilc:1.23.0 -R

- name: Run Forest QVM
run: docker run --rm -d -p 5000:5000 rigetti/qvm -S

- uses: actions/checkout@v2

- name: Install plugin and test requirements
run: |
python -m pip install --upgrade pip
pip install '.[test]'
- name: Run tests
run: python -m pytest tests --cov=pennylane_rigetti --cov-report=term-missing --cov-report=xml -p no:warnings --tb=native

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1.0.7
with:
file: ./coverage.xml

integration-tests:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.8", "3.10"]

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.4.1
with:
access_token: ${{ github.token }}

- name: Run Forest Quilc
run: docker run --rm -d -p 5555:5555 rigetti/quilc:1.23.0 -R

- name: Run Forest QVM
run: docker run --rm -d -p 5000:5000 rigetti/qvm -S

- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install plugin and test requirements
run: |
python -m pip install --upgrade pip
pip install '.[test]'
- name: Run tests
run: |
pl-device-test --device=rigetti.numpy_wavefunction --tb=short --skip-ops --analytic=True
pl-device-test --device=rigetti.wavefunction --tb=short --skip-ops --analytic=False --shots=20000
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1.0.7
with:
file: ./coverage.xml
77 changes: 36 additions & 41 deletions .github/workflows/upload.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,36 @@
name: Upload
on:
release:
types: [published]

jobs:
upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Run Forest Quilc
run: docker run --rm -d -p 5555:5555 rigetti/quilc:1.22.0 -R

- name: Run Forest QVM
run: docker run --rm -d -p 5000:5000 rigetti/qvm -S

- name: Build and install Plugin
run: |
python -m pip install --upgrade pip wheel
python setup.py bdist_wheel
pip install dist/PennyLane*.whl
- name: Install test dependencies
run: |
pip install wheel pytest pytest-cov pytest-mock flaky --upgrade
- name: Run tests
run: |
python -m pytest tests --tb=native
- name: Publish
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI }}
name: Upload
on:
release:
types: [published]

jobs:
upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Run Forest Quilc
run: docker run --rm -d -p 5555:5555 rigetti/quilc:1.23.0 -R

- name: Run Forest QVM
run: docker run --rm -d -p 5000:5000 rigetti/qvm -S

- name: Install plugin and test dependencies
run: |
python -m pip install --upgrade pip
pip install '.[test]'
- name: Run tests
run: |
python -m pytest tests --tb=native
- name: Publish
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ notebooks/*
.pytest_cache/*
.vscode/*
doc/code/api/*
.eggs
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

### Breaking changes

* Build dependency specification is now solely in `requirements.txt`, which is read
by `setup.py`. What's more, a missing comma has been added to the version bounds
on `qcs-api-client`, fixing ([#120](https://github.com/PennyLaneAI/pennylane-rigetti/pull/120))
a bug ([#119](https://github.com/PennyLaneAI/pennylane-rigetti/issues/119)) that
was causing errors when trying to use the package.

* `pennylane-rigetti` no longer supports `python3.7`. A newer python version is required.
[(#121)](https://github.com/PennyLaneAI/pennylane-rigetti/pull/121)

Expand All @@ -21,6 +27,7 @@
This release contains contributions from (in alphabetical order):

Albert Mitjans Coma
Graham Enos

---

Expand Down
5 changes: 5 additions & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
flaky>=3.7.0
pytest>=7.2.1
pytest-cov>=4.0.0
pytest-mock>=3.10.0
wheel>=0.38.4
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pyquil>=3.0.0,<4.0.0
numpy>=1.21,<1.24
networkx>=2.5,<3.0
pennylane>=0.18
qcs-api-client>=0.20.13<0.22.0
networkx
flaky
pyquil>=3.0.0,<4.0.0
qcs-api-client>=0.20.13,<0.22.0

0 comments on commit 22a31f8

Please sign in to comment.