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

Updating capabilities dictionary, requirements.txt and black CI check #45

Merged
merged 10 commits into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ jobs:

- name: Get required Python packages
run: |
pip install numpy pybind11 pytest pytest-cov pytest-mock flaky
cd main
python -m pip install --upgrade pip
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added pip upgrades just for making sure all is good...

pip install git+https://github.com/PennyLaneAI/pennylane.git
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is temporary. Need the latest PennyLane with the update of capabilities. Need to revert before release.

pip install -r requirements.txt
Copy link
Contributor Author

Choose a reason for hiding this comment

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

was discovered by Maria, that we were not depending on requirements.txt here


- name: Install lightning.qubit device
run: |
Expand Down
24 changes: 19 additions & 5 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,22 @@ jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Black Code Formatter
uses: lgeiger/black-action@v1.0.1
with:
args: "-l 100 pennylane_lightning/ --check"
- name: Cancel Previous Runs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the black update that was needed for each PennyLane plugin

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:
python -m pip install --upgrade pip
pip install black

- uses: actions/checkout@v2

- name: Run Black
run: black -l 100 pennylane_lightning/ --check
2 changes: 2 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ jobs:

- name: Install cibuildwheel
run: |
python -m pip install --upgrade pip
pip install git+https://github.com/PennyLaneAI/pennylane.git
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will be removed

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's not forget all the places we'll need to shortly change back!

python -m pip install cibuildwheel==1.5.5

- name: Install Eigen on Windows
Expand Down
16 changes: 14 additions & 2 deletions pennylane_lightning/lightning_qubit.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class LightningQubit(DefaultQubit):
pennylane_requires = ">=0.11"
version = __version__
author = "Xanadu Inc."
_capabilities = {"inverse_operations": False} # we should look at supporting

operations = {
"BasisState",
Expand Down Expand Up @@ -94,9 +93,22 @@ def __init__(self, wires, *, shots=1000, analytic=True):

if self.num_wires > self._MAX_WIRES:
warnings.warn(
"The number of wires exceeds 16, reverting to NumPy-based evaluation.", UserWarning,
"The number of wires exceeds 16, reverting to NumPy-based evaluation.",
UserWarning,
Comment on lines +96 to +97
Copy link
Contributor Author

Choose a reason for hiding this comment

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

black

)

@classmethod
def capabilities(cls):
capabilities = super().capabilities().copy()
capabilities.update(
model="qubit",
supports_reversible_diff=False,
supports_inverse_operations=False,
supports_analytic_computation=True,
returns_state=True,
)
return capabilities

def apply(self, operations, rotations=None, **kwargs):

if self.num_wires > self._MAX_WIRES:
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
flaky
numpy
pennylane>=0.11
Copy link
Contributor

Choose a reason for hiding this comment

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

When should we pin this, I guess in a follow up PR we'd pin this to ==0.12?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, in the version bump PR. Note, that that PR should pass checks only when PL v0.12 has been released.

pybind11
pytest
pytest-cov
pytest-mock
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ def build_extensions(self):

requirements = [
"numpy",
"pennylane>=0.11.0",
"pennylane @ git+https://github.com/PennyLaneAI/pennylane.git",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will be reverted

"pybind11",
]


Expand Down