Skip to content

Commit

Permalink
Updating capabilities dictionary, requirements.txt and black CI check (
Browse files Browse the repository at this point in the history
…#45)

* Redefining capabilities

* Black CI check update

* Upgrade pip

* Temporarily PL master as requirement

* Update requirements.txt

* Formatting

* PL master in setup.py

* Temp PennyLane install

* Temp PennyLane install

* Correct typo
  • Loading branch information
antalszava authored Oct 13, 2020
1 parent 80580ff commit 049dfc4
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 9 deletions.
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
pip install git+https://github.com/PennyLaneAI/pennylane.git
pip install -r requirements.txt
- 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/[email protected]
with:
args: "-l 100 pennylane_lightning/ --check"
- name: Cancel Previous Runs
uses: styfle/[email protected]
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
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,
)

@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
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",
"pybind11",
]


Expand Down

0 comments on commit 049dfc4

Please sign in to comment.