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

Add preliminary support for qml.labs module sandboxing #6369

Merged
merged 24 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from 22 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
35 changes: 35 additions & 0 deletions .github/workflows/module-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Validate module imports

on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
mlxd marked this conversation as resolved.
Show resolved Hide resolved

mlxd marked this conversation as resolved.
Show resolved Hide resolved
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
mlxd marked this conversation as resolved.
Show resolved Hide resolved
tach:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5

with:
python-version: "3.10"

- name: Install dependencies
run: pip install tach==0.13.1

- name: Run tach
run: |
tach report pennylane/labs
tach check

4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ repos:
"--filter-files",
]
files: ^(pennylane/|tests/)
- repo: https://github.com/gauge-sh/tach-pre-commit
rev: v0.13.1
hooks:
- id: tach
mlxd marked this conversation as resolved.
Show resolved Hide resolved
- repo: local
hooks:
- id: pylint
Expand Down
3 changes: 3 additions & 0 deletions doc/releases/changelog-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@

<h3>Improvements 🛠</h3>

* Module-level sandboxing added to `qml.labs` via pre-commit hooks.
[(#6369)](https://github.com/PennyLaneAI/pennylane/pull/6369)

* `qml.matrix` now works with empty objects (such as empty tapes, `QNode`s and quantum functions that do
not call operations, single operators with empty decompositions).
[(#6347)](https://github.com/PennyLaneAI/pennylane/pull/6347)
Expand Down
Empty file added pennylane/labs/README.md
Empty file.
3 changes: 3 additions & 0 deletions pennylane/labs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
# limitations under the License.
""":code:`pennylane/labs/` module contains experimental features enabling
advanced quantum computing research."""


__all__ = []

Check warning on line 18 in pennylane/labs/__init__.py

View check run for this annotation

Codecov / codecov/patch

pennylane/labs/__init__.py#L18

Added line #L18 was not covered by tests
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ tomli~=2.0.0 # Drop once minimum Python version is 3.11
isort==5.13.2
pylint==2.7.4
rich>=13.7.1
tach==0.13.1
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ opt_einsum~=3.3
requests~=2.31.0
typing_extensions~=4.5.0
tomli~=2.0.0 # Drop once minimum Python version is 3.11
tach~=0.13.1
mlxd marked this conversation as resolved.
Show resolved Hide resolved
16 changes: 16 additions & 0 deletions tach.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
exclude = [
".*__pycache__",
".*egg-info",
"docs",
"tests",
]
source_roots = [
".",
"pennylane",
]

[[modules]]
path = "pennylane.labs"
depends_on = [
{ path = "<root>" },
]
mlxd marked this conversation as resolved.
Show resolved Hide resolved
Loading