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 15 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: Ensures module-level imports are valid
mlxd marked this conversation as resolved.
Show resolved Hide resolved
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
jobs:
tach:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
mlxd marked this conversation as resolved.
Show resolved Hide resolved

- name: Set up Python
uses: actions/setup-python@v3
mlxd marked this conversation as resolved.
Show resolved Hide resolved
with:
python-version: "3.10"

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

- uses: actions/checkout@v4
mlxd marked this conversation as resolved.
Show resolved Hide resolved

- 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)

* PennyLane is now compatible with NumPy 2.0.
[(#6061)](https://github.com/PennyLaneAI/pennylane/pull/6061)
[(#6258)](https://github.com/PennyLaneAI/pennylane/pull/6258)
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__ = []
1 change: 1 addition & 0 deletions requirements-ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ matplotlib
requests
rich
tomli # Drop once minimum Python version is 3.11
tach
mlxd marked this conversation as resolved.
Show resolved Hide resolved
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