Skip to content

Commit 74884c6

Browse files
authored
Merge branch 'master' into unary_mapping
2 parents e9d6c59 + 9c1292d commit 74884c6

File tree

329 files changed

+9610
-11306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

329 files changed

+9610
-11306
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ body:
1010
value: |
1111
## Before posting a bug report
1212
Search existing GitHub issues to make sure the issue does not already exist:
13-
https://github.com/xanaduai/pennylane/issues
13+
https://github.com/PennyLaneAI/pennylane/issues
1414
1515
For general technical details check out our documentation:
16-
https://pennylane.readthedocs.io
16+
https://docs.pennylane.ai
1717
1818
# Issue description
1919
Description of the issue - include code snippets in the Source code section below and screenshots if relevant.

.github/ISSUE_TEMPLATE/feature_request.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ body:
99
value: |
1010
## Before posting a feature request
1111
Search existing GitHub issues to make sure the issue does not already exist:
12-
https://github.com/xanaduai/pennylane/issues
12+
https://github.com/PennyLaneAI/pennylane/issues
1313
1414
For general technical details check out our documentation:
15-
https://pennylane.readthedocs.io
15+
https://docs.pennylane.ai
1616
1717
# Feature description
1818
Description of the feature request - include code snippets and screenshots here if relevant.

.github/workflows/check_in_artifact.yml

+14-11
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ jobs:
9090
echo "has_changes=$(git status --porcelain | wc -l | awk '{print $1}')" >> $GITHUB_OUTPUT
9191
9292
- name: Prepare Commit Author
93+
id: prep_commit
9394
if: steps.changed.outputs.has_changes != '0'
9495
env:
9596
HEAD_BRANCH_NAME: ${{ inputs.pull_request_head_branch_name }}
@@ -104,9 +105,11 @@ jobs:
104105
if git ls-remote --exit-code origin "refs/heads/$HEAD_BRANCH_NAME"; then
105106
echo "$HEAD_BRANCH_NAME exists! Checking out..."
106107
git checkout "$HEAD_BRANCH_NAME"
108+
echo "branch_exists='true'" >> $GITHUB_OUTPUT
107109
else
108110
echo "$HEAD_BRANCH_NAME does not exist! Creating..."
109111
git checkout -b "$HEAD_BRANCH_NAME"
112+
echo "branch_exists='false'" >> $GITHUB_OUTPUT
110113
fi
111114
112115
- name: Stage changes
@@ -130,20 +133,20 @@ jobs:
130133
PR_BODY: ${{ inputs.pull_request_body }}
131134
run: |
132135
EXISTING_PR="$(gh pr list --state open --base master --head $HEAD_BRANCH_NAME --json 'url' --jq '.[].url' | head -n 1)"
136+
EXISTING_CLOSED_PR="$(gh pr list --state closed --base master --head $HEAD_BRANCH_NAME --json 'mergedAt,url' --jq '.[] | select(.mergedAt == null).url' | head -n 1)"
133137
134-
if [ -n "${EXISTING_PR}" ]; then
135-
echo "PR already exists ==> ${EXISTING_PR}"
136-
exit 0
137-
else
138+
if [ '${{ steps.prep_commit.outputs.branch_exists }}' = 'false' ]; then
138139
echo "Creating PR..."
139140
gh pr create --title "$PR_TITLE" --body "$PR_BODY"
140141
exit 0
141-
fi
142-
143-
EXISTING_CLOSED_PR="$(gh pr list --state closed --base master --head $HEAD_BRANCH_NAME --json 'mergedAt,url' --jq '.[] | select(.mergedAt == null).url' | head -n 1)"
144-
145-
if [ -n "${EXISTING_CLOSED_PR}" ]; then
146-
echo "Reopening PR... ${EXISTING_CLOSED_PR}"
147-
gh pr reopen "${EXISTING_CLOSED_PR}"
142+
elif [ -n $EXISTING_PR ]; then
143+
echo "Open PR already exists ==> $EXISTING_PR"
144+
echo "Editing with provided title and body..."
145+
gh pr edit --title "$PR_TITLE" --body "$PR_BODY"
146+
else
147+
echo "Reopening PR... $EXISTING_CLOSED_PR"
148+
gh pr reopen "$EXISTING_CLOSED_PR"
149+
echo "Editing with provided title and body..."
150+
gh pr edit --title "$PR_TITLE" --body "$PR_BODY"
148151
exit 0
149152
fi

.github/workflows/interface-unit-tests.yml

+13-18
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ on:
5454
required: false
5555
type: string
5656
default: ''
57-
disable_new_opmath:
58-
description: Whether to disable the new op_math or not when running the tests
59-
required: false
60-
type: string
61-
default: "False"
6257
additional_python_packages:
6358
description: Additional Python packages to install separated by a space
6459
required: false
@@ -246,7 +241,7 @@ jobs:
246241
${{ needs.default-dependency-versions.outputs.pytorch-version }}
247242
${{ inputs.additional_python_packages }}
248243
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
249-
pytest_additional_args: --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
244+
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
250245
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
251246
pytest_markers: torch and not qcut and not finite-diff and not param-shift
252247
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'torch.txt' || '' }}
@@ -282,7 +277,7 @@ jobs:
282277
additional_pip_packages: ${{ inputs.additional_python_packages }}
283278
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
284279
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
285-
pytest_additional_args: --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
280+
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
286281
pytest_markers: autograd and not qcut and not finite-diff and not param-shift
287282

288283

@@ -320,7 +315,7 @@ jobs:
320315
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
321316
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
322317
pytest_markers: tf and not qcut and not finite-diff and not param-shift
323-
pytest_additional_args: --splits 3 --group ${{ matrix.group }} --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
318+
pytest_additional_args: --splits 3 --group ${{ matrix.group }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
324319
pytest_durations_file_path: '.github/durations/tf_tests_durations.json'
325320
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'tf.txt' || '' }}
326321

@@ -358,7 +353,7 @@ jobs:
358353
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
359354
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
360355
pytest_markers: jax and not qcut and not finite-diff and not param-shift
361-
pytest_additional_args: --dist=loadscope --splits 4 --group ${{ matrix.group }} --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
356+
pytest_additional_args: --dist=loadscope --splits 4 --group ${{ matrix.group }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
362357
pytest_durations_file_path: '.github/durations/jax_tests_durations.json'
363358
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'jax.txt' || '' }}
364359

@@ -395,7 +390,7 @@ jobs:
395390
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
396391
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
397392
pytest_markers: core and not qcut and not finite-diff and not param-shift
398-
pytest_additional_args: --splits 6 --group ${{ matrix.group }} --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
393+
pytest_additional_args: --splits 6 --group ${{ matrix.group }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
399394
pytest_durations_file_path: '.github/durations/core_tests_durations.json'
400395
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'core.txt' || '' }}
401396

@@ -435,7 +430,7 @@ jobs:
435430
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
436431
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
437432
pytest_markers: all_interfaces
438-
pytest_additional_args: --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
433+
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
439434
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'all_interfaces.txt' || '' }}
440435

441436

@@ -468,9 +463,9 @@ jobs:
468463
python_version: ${{ matrix.python-version }}
469464
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
470465
pytest_markers: external
471-
pytest_additional_args: --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
466+
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
472467
additional_pip_packages: |
473-
pyzx matplotlib stim quimb mitiq ply
468+
pyzx matplotlib stim quimb==1.8.4 mitiq ply
474469
git+https://github.com/PennyLaneAI/pennylane-qiskit.git@master
475470
${{ needs.default-dependency-versions.outputs.jax-version }}
476471
${{ needs.default-dependency-versions.outputs.tensorflow-version }}
@@ -515,7 +510,7 @@ jobs:
515510
python_version: ${{ matrix.python-version }}
516511
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
517512
pytest_markers: qcut
518-
pytest_additional_args: --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
513+
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
519514
additional_pip_packages: |
520515
kahypar==1.1.7
521516
opt_einsum
@@ -557,7 +552,7 @@ jobs:
557552
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
558553
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
559554
pytest_markers: qchem
560-
pytest_additional_args: --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
555+
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
561556
additional_pip_packages: |
562557
openfermionpyscf basis-set-exchange
563558
${{ inputs.additional_python_packages }}
@@ -592,7 +587,7 @@ jobs:
592587
branch: ${{ inputs.branch }}
593588
coverage_artifact_name: gradients-${{ matrix.config.suite }}-coverage
594589
python_version: ${{ matrix.python-version }}
595-
pytest_additional_args: --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
590+
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
596591
additional_pip_packages: |
597592
${{ needs.default-dependency-versions.outputs.jax-version }}
598593
${{ needs.default-dependency-versions.outputs.tensorflow-version }}
@@ -632,7 +627,7 @@ jobs:
632627
python_version: ${{ matrix.python-version }}
633628
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
634629
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
635-
pytest_additional_args: --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
630+
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
636631
pytest_markers: data
637632
additional_pip_packages: |
638633
h5py
@@ -681,7 +676,7 @@ jobs:
681676
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
682677
pytest_test_directory: pennylane/devices/tests
683678
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
684-
pytest_additional_args: --device=${{ matrix.config.device }} --shots=${{ matrix.config.shots }} --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
679+
pytest_additional_args: --device=${{ matrix.config.device }} --shots=${{ matrix.config.shots }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
685680

686681

687682
upload-to-codecov:

.github/workflows/legacy_op_math.yml

-16
This file was deleted.

.github/workflows/tests.yml

-20
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,3 @@ jobs:
5454
```
5555
git commit --allow-empty -m 'trigger ci'
5656
```
57-
58-
# TODO: This will be added separately in a future PR
59-
# upload-durations-files:
60-
# needs: tests
61-
# uses: ./.github/workflows/check_in_artifact.yml
62-
# if: github.event_name == 'push'
63-
# with:
64-
# artifact_name_pattern: '*-durations.json'
65-
# artifact_save_path: '.github/durations/'
66-
# pull_request_head_branch_name: bot/durations-update
67-
# commit_message_description: Durations Update
68-
# pull_request_title: Update durations files
69-
# pull_request_body: |
70-
# Automatic update of durations files to snapshot valid python environments.
71-
72-
# Because bots are not able to trigger CI on their own, please do so by pushing an empty commit to this branch using the following command:
73-
74-
# ```
75-
# git commit --allow-empty -m 'trigger ci'
76-
# ```
+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# This workflow is designed to run unit tests and open a pull request to update
2+
# JSON files that store test durations for better load balancing
3+
4+
name: Update Durations
5+
on:
6+
workflow_dispatch:
7+
# Scheduled trigger every Saturday at 2:47am UTC
8+
schedule:
9+
- cron: '47 2 * * 6'
10+
11+
concurrency:
12+
group: update-durations-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
update-durations:
17+
uses: ./.github/workflows/interface-unit-tests.yml
18+
secrets:
19+
codecov_token: ${{ secrets.CODECOV_TOKEN }}
20+
with:
21+
branch: master
22+
upload_to_codecov: false
23+
run_lightened_ci: true
24+
skip_ci_test_jobs: 'torch-tests,autograd-tests,all-interfaces-tests,external-libraries-tests,qcut-tests,qchem-tests,gradients-tests,data-tests,device-tests'
25+
26+
merge-durations-files:
27+
needs: update-durations
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Download artifacts
31+
uses: actions/download-artifact@v4
32+
with:
33+
pattern: durations-*
34+
path: ./
35+
merge-multiple: false
36+
37+
- name: Merge artifacts into single file
38+
run: |
39+
mkdir durations
40+
jq -s 'add' durations-core-*/*.json > durations/core_tests_durations.json
41+
jq -s 'add' durations-jax-*/*.json > durations/jax_tests_durations.json
42+
jq -s 'add' durations-tf-*/*.json > durations/tf_tests_durations.json
43+
44+
- name: Upload combined durations artifacts
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: merged-durations
48+
path: ./durations
49+
include-hidden-files: true
50+
51+
upload-durations:
52+
needs:
53+
- update-durations
54+
- merge-durations-files
55+
uses: ./.github/workflows/check_in_artifact.yml
56+
with:
57+
artifact_name_pattern: "merged-durations"
58+
artifact_save_path: ".github/durations"
59+
merge_multiple: true
60+
pull_request_head_branch_name: bot/update-durations
61+
commit_message_description: Update test durations
62+
pull_request_title: Update test durations
63+
pull_request_body: Automatic update of test duration files

doc/code/qml_utils.rst

-14
This file was deleted.

doc/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@
113113
# built documents.
114114

115115
import pennylane
116+
pennylane.Hamiltonian = pennylane.ops.op_math.linear_combination.Hamiltonian
116117

117-
pennylane.Hamiltonian = pennylane.ops.Hamiltonian
118118

119119
# The full version, including alpha/beta/rc tags.
120120
release = pennylane.__version__

0 commit comments

Comments
 (0)