diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index fc86e816cc..f6735aea26 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -17,12 +17,15 @@

Internal changes ⚙️

+- Update release script and use the Catalyst `rc` branch in CIs in the release season. + [(#1285)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1285) + - Updated CIs to use GCC 13. [(#1249)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1249) - Bumped the seed for pytests. [(#1276)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1276) - + - `scipy-openblas32` dependency can be set manually when installing from source using the `ENABLE_SCIPY_OPENBLAS` cmake flag. [(#1220)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1220) @@ -68,7 +71,7 @@ Joseph Lee - Raise exception when calling normalize or collapse method with `lightning.qubit`, `lightning.kokkos` and `lightning.gpu` when norm is close to 0. [(#1257)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1257) -- Worksize preference in `cuTensorNet` can now be set and updated when using `lightning.tensor` device to reduce memory usage or improve stability. +- Worksize preference in `cuTensorNet` can now be set and updated when using `lightning.tensor` device to reduce memory usage or improve stability. [(#1238)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1238) - **Migrated to Nanobind for Python bindings**, replacing pybind11 to enhance performance, modularity, and build system efficiency. @@ -115,7 +118,7 @@ Joseph Lee - Dropped support for Python 3.10. Supported Python versions are now 3.11, 3.12 and 3.13. [(#1224)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1224) -- Dropped testing support for `tensorflow` interface after deprecation in Pennylane. +- Dropped testing support for `tensorflow` interface after deprecation in Pennylane. [(#1225)](github.com/PennyLaneAI/pennylane-lightning/pull/1225)

Deprecations 👋

@@ -152,10 +155,10 @@ Joseph Lee - Updated test to skip MCM test for `lightning.tensor` and fix seed for deterministic test. [(#1281)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1281) -- Updated GitHub Actions to produce the release candidate wheels for all supported Python versions for MacOS-ARM. +- Updated GitHub Actions to produce the release candidate wheels for all supported Python versions for MacOS-ARM. [(#1273)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1273) -- Updated GitHub Actions to produce the release candidate wheels for all supported Python versions. +- Updated GitHub Actions to produce the release candidate wheels for all supported Python versions. [(#1264)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1264) - Support building `lightning.gpu` and `lightning.tensor` from source with CUDA 13. @@ -178,7 +181,7 @@ Joseph Lee - Updated Python to 3.12 and CIBuildWheel to 3.1.4 for CI. [(#1248)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1248) -- Updated decomposition stopping condition to no longer convert `C(SProd)` and `C(Exp)` to Qubit Unitary, since PennyLane can decompose these operators after [PR 8133](https://github.com/PennyLaneAI/pennylane/pull/8133). +- Updated decomposition stopping condition to no longer convert `C(SProd)` and `C(Exp)` to Qubit Unitary, since PennyLane can decompose these operators after [PR 8133](https://github.com/PennyLaneAI/pennylane/pull/8133). [(#1247)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1247) - Removed `--no-deps` for Lightning Qubit CI tests for stable version. @@ -189,7 +192,7 @@ Joseph Lee - Added script to automate the release process. [(#1231)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1231) - + - Stopped the wheels creation for no arch if the PR is draft. [(#1233)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1233) @@ -231,7 +234,7 @@ Amintor Dusko, David Ittah, Christina Lee, Joseph Lee, -Rashid N H M, +Rashid N H M, Anton Naim Ibrahim, Luis Alfredo Nuñez Meneses, Andrija Paurevic, @@ -270,9 +273,9 @@ Jake Zaia.

Breaking changes 💔

- The `LightningBaseStateVector`, `LightningBaseAdjointJacobian`, `LightningBaseMeasurements`, - `LightningInterpreter` and `QuantumScriptSerializer` base classes now can be found at `pennylane_lightning.lightning_base`. - The new `lightning_base` module further enables the relocation of core files from `pennylane_lightning/core/src/*` to `pennylane_lightning/core/*`. - The license classifier and `project.license` as a TOML table are deprecated in favor of a SPDX license expression and removed in `pyproject.toml`. + `LightningInterpreter` and `QuantumScriptSerializer` base classes now can be found at `pennylane_lightning.lightning_base`. + The new `lightning_base` module further enables the relocation of core files from `pennylane_lightning/core/src/*` to `pennylane_lightning/core/*`. + The license classifier and `project.license` as a TOML table are deprecated in favor of a SPDX license expression and removed in `pyproject.toml`. To speedup the recompilation of C++ source code, `ccache` is also added to `Makefile`. [(#1098)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1098) @@ -304,23 +307,23 @@ Jake Zaia. - Fixed the implementation of multi-controlled gates with a single target wire for arbitrary control values in `lightning.tensor`. [(#1169)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1169) -- Updated requirements to only download JAX version 0.5.3 for non-X86 MacOS. +- Updated requirements to only download JAX version 0.5.3 for non-X86 MacOS. [(#1163)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1163) -- Fixed Docker build for `lighting.kokkos` with ROCM library for AMD GPUs. Updated ROCM from 5.7 to 6.2.4. +- Fixed Docker build for `lighting.kokkos` with ROCM library for AMD GPUs. Updated ROCM from 5.7 to 6.2.4. [(#1158)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1158) -- Fixed use of Torch with `AmplitudeEmbedding` by applying `qml.broadcast_expand` before decomposition in the preprocessing stage. +- Fixed use of Torch with `AmplitudeEmbedding` by applying `qml.broadcast_expand` before decomposition in the preprocessing stage. [(#1175)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1175)

Internal changes ⚙️

- Updated tests with `device(..., shots=...)` to use `qml.set_shots` to ensure compatibility with the latest version of PennyLane. [(#1173)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1173) - + - Fixed `applyMultiRZ` for `lightning.kokkos` device to use Kokkos function instead of lambda. [(#1194)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1194) - + - Enabled `AmplitudeEmbedding` Python tests for `lightning.kokkos` and `lightning.gpu` devices. [(#1192)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1192) @@ -339,7 +342,7 @@ Jake Zaia. - Updated dev requirements to use JAX version 0.6.0 for CI tests. [(#1161)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1161) - + - Updated stable requirements to use JAX version 0.4.28 for CI tests. [(#1160)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1160) @@ -351,7 +354,7 @@ Jake Zaia. - Removed `max_workers` argument for `default.qubit` device in Python tests to reduce CI testing time. [(##1174)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1174) - + - Bumped Github action runner to use `Ubuntu-24.04` or `Ubuntu-latest`. Fixed all `ubuntu-latest` action runners to `ubuntu-24.04`. [(#1167)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1167) diff --git a/.github/workflows/tests_gpu_cpp.yml b/.github/workflows/tests_gpu_cpp.yml index ffa8db3a6e..8677c1d547 100644 --- a/.github/workflows/tests_gpu_cpp.yml +++ b/.github/workflows/tests_gpu_cpp.yml @@ -86,6 +86,15 @@ jobs: repository: PennyLaneAI/catalyst path: ${{ github.workspace}}/catalyst + - name: Switch to release build of Catalyst + if: inputs.lightning-version == 'release' + run: | + cd ${{ github.workspace}}/catalyst + git fetch --all + git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) + git log -1 --format='%H' + cd ${{ github.workspace }} + - uses: actions/setup-python@v5 id: setup_python name: Setup Python diff --git a/.github/workflows/tests_gpu_python.yml b/.github/workflows/tests_gpu_python.yml index 4016f9e587..9bf9227a92 100644 --- a/.github/workflows/tests_gpu_python.yml +++ b/.github/workflows/tests_gpu_python.yml @@ -97,6 +97,15 @@ jobs: repository: PennyLaneAI/catalyst path: ${{ github.workspace}}/catalyst + - name: Switch to release build of Catalyst + if: inputs.lightning-version == 'release' + run: | + cd ${{ github.workspace}}/catalyst + git fetch --all + git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) + git log -1 --format='%H' + cd ${{ github.workspace }} + - uses: actions/setup-python@v5 id: setup_python name: Install Python diff --git a/.github/workflows/tests_lgpumpi_cpp.yml b/.github/workflows/tests_lgpumpi_cpp.yml index b2e6433775..415a08420c 100644 --- a/.github/workflows/tests_lgpumpi_cpp.yml +++ b/.github/workflows/tests_lgpumpi_cpp.yml @@ -62,6 +62,15 @@ jobs: repository: PennyLaneAI/catalyst path: ${{ github.workspace}}/catalyst + - name: Switch to release build of Catalyst + if: inputs.lightning-version == 'release' + run: | + cd ${{ github.workspace}}/catalyst + git fetch --all + git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) + git log -1 --format='%H' + cd ${{ github.workspace }} + - name: Switch to stable build of Lightning-GPU if: inputs.lightning-version == 'stable' run: | diff --git a/.github/workflows/tests_lgpumpi_python.yml b/.github/workflows/tests_lgpumpi_python.yml index 8708edc7dd..b2f63bf40c 100644 --- a/.github/workflows/tests_lgpumpi_python.yml +++ b/.github/workflows/tests_lgpumpi_python.yml @@ -64,6 +64,15 @@ jobs: repository: PennyLaneAI/catalyst path: ${{ github.workspace}}/catalyst + - name: Switch to release build of Catalyst + if: inputs.lightning-version == 'release' + run: | + cd ${{ github.workspace}}/catalyst + git fetch --all + git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) + git log -1 --format='%H' + cd ${{ github.workspace }} + - name: Switch to release build of Lightning if: inputs.lightning-version == 'release' run: | diff --git a/.github/workflows/tests_linux_cpp.yml b/.github/workflows/tests_linux_cpp.yml index 98c538ab4d..b1e47f8d50 100644 --- a/.github/workflows/tests_linux_cpp.yml +++ b/.github/workflows/tests_linux_cpp.yml @@ -66,6 +66,15 @@ jobs: repository: PennyLaneAI/catalyst path: ${{ github.workspace}}/catalyst + - name: Switch to release build of Catalyst + if: inputs.lightning-version == 'release' + run: | + cd ${{ github.workspace}}/catalyst + git fetch --all + git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) + git log -1 --format='%H' + cd ${{ github.workspace }} + - name: Install dependencies run: | echo ${{ github.event_name }} && sudo apt-get update && sudo apt-get -y -q install cmake gcc-$GCC_VERSION g++-$GCC_VERSION ninja-build gcovr lcov @@ -144,6 +153,15 @@ jobs: repository: PennyLaneAI/catalyst path: ${{ github.workspace}}/catalyst + - name: Switch to release build of Catalyst + if: inputs.lightning-version == 'release' + run: | + cd ${{ github.workspace}}/catalyst + git fetch --all + git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) + git log -1 --format='%H' + cd ${{ github.workspace }} + - name: Install dependencies run: | sudo apt-get update && sudo apt-get -y -q install cmake gcc-$GCC_VERSION g++-$GCC_VERSION libopenblas-dev ninja-build gcovr lcov @@ -230,6 +248,15 @@ jobs: repository: PennyLaneAI/catalyst path: ${{ github.workspace}}/catalyst + - name: Switch to release build of Catalyst + if: inputs.lightning-version == 'release' + run: | + cd ${{ github.workspace}}/catalyst + git fetch --all + git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) + git log -1 --format='%H' + cd ${{ github.workspace }} + - name: Restoring cached dependencies id: kokkos-cache uses: actions/cache@v4 @@ -346,6 +373,15 @@ jobs: repository: PennyLaneAI/catalyst path: ${{ github.workspace}}/catalyst + - name: Switch to release build of Catalyst + if: inputs.lightning-version == 'release' + run: | + cd ${{ github.workspace}}/catalyst + git fetch --all + git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) + git log -1 --format='%H' + cd ${{ github.workspace }} + - name: Restoring cached dependencies id: kokkos-cache uses: actions/cache@v4 diff --git a/.github/workflows/tests_lkcpu_python.yml b/.github/workflows/tests_lkcpu_python.yml index b781214484..fc862ead4a 100644 --- a/.github/workflows/tests_lkcpu_python.yml +++ b/.github/workflows/tests_lkcpu_python.yml @@ -74,6 +74,15 @@ jobs: repository: PennyLaneAI/catalyst path: ${{ github.workspace}}/catalyst + - name: Switch to release build of Catalyst + if: inputs.lightning-version == 'release' + run: | + cd ${{ github.workspace}}/catalyst + git fetch --all + git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) + git log -1 --format='%H' + cd ${{ github.workspace }} + - name: Switch to release build of Lightning if: inputs.lightning-version == 'release' run: | @@ -195,6 +204,15 @@ jobs: repository: PennyLaneAI/catalyst path: ${{ github.workspace}}/catalyst + - name: Switch to release build of Catalyst + if: inputs.lightning-version == 'release' + run: | + cd ${{ github.workspace}}/catalyst + git fetch --all + git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) + git log -1 --format='%H' + cd ${{ github.workspace }} + - uses: actions/download-artifact@v4 with: name: ${{ matrix.pl_backend }}-${{ matrix.exec_model }}_name.txt diff --git a/.github/workflows/tests_lkcuda_cpp.yml b/.github/workflows/tests_lkcuda_cpp.yml index fd8e093ada..c15f53bf5c 100644 --- a/.github/workflows/tests_lkcuda_cpp.yml +++ b/.github/workflows/tests_lkcuda_cpp.yml @@ -155,6 +155,15 @@ jobs: repository: PennyLaneAI/catalyst path: ${{ github.workspace}}/catalyst + - name: Switch to release build of Catalyst + if: inputs.lightning-version == 'release' + run: | + cd ${{ github.workspace}}/catalyst + git fetch --all + git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) + git log -1 --format='%H' + cd ${{ github.workspace }} + - uses: actions/setup-python@v5 id: setup_python name: Install Python diff --git a/.github/workflows/tests_lkcuda_python.yml b/.github/workflows/tests_lkcuda_python.yml index 0ec9d021f2..8f1aba7ebf 100644 --- a/.github/workflows/tests_lkcuda_python.yml +++ b/.github/workflows/tests_lkcuda_python.yml @@ -248,6 +248,15 @@ jobs: repository: PennyLaneAI/catalyst path: ${{ github.workspace}}/catalyst + - name: Switch to release build of Catalyst + if: inputs.lightning-version == 'release' + run: | + cd ${{ github.workspace}}/catalyst + git fetch --all + git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) + git log -1 --format='%H' + cd ${{ github.workspace }} + - name: Install ML libraries for interfaces run: | python -m pip install --upgrade torch==$TORCH_VERSION --index-url https://download.pytorch.org/whl/cpu diff --git a/.github/workflows/tests_lkmpi_cuda_cpp.yml b/.github/workflows/tests_lkmpi_cuda_cpp.yml index 1cc03bdac1..560ba9afe2 100644 --- a/.github/workflows/tests_lkmpi_cuda_cpp.yml +++ b/.github/workflows/tests_lkmpi_cuda_cpp.yml @@ -64,6 +64,15 @@ jobs: repository: PennyLaneAI/catalyst path: ${{ github.workspace}}/catalyst + - name: Switch to release build of Catalyst + if: inputs.lightning-version == 'release' + run: | + cd ${{ github.workspace}}/catalyst + git fetch --all + git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) + git log -1 --format='%H' + cd ${{ github.workspace }} + - name: Switch to stable build of Lightning-Kokkos if: inputs.lightning-version == 'stable' run: | diff --git a/.github/workflows/tests_lkmpi_cuda_python.yml b/.github/workflows/tests_lkmpi_cuda_python.yml index 9e204c2558..2637182a52 100644 --- a/.github/workflows/tests_lkmpi_cuda_python.yml +++ b/.github/workflows/tests_lkmpi_cuda_python.yml @@ -66,6 +66,15 @@ jobs: repository: PennyLaneAI/catalyst path: ${{ github.workspace}}/catalyst + - name: Switch to release build of Catalyst + if: inputs.lightning-version == 'release' + run: | + cd ${{ github.workspace}}/catalyst + git fetch --all + git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) + git log -1 --format='%H' + cd ${{ github.workspace }} + - name: Switch to release build of Lightning if: inputs.lightning-version == 'release' run: | diff --git a/.github/workflows/tests_lqcpu_python.yml b/.github/workflows/tests_lqcpu_python.yml index 10c38ea14f..329859cf02 100644 --- a/.github/workflows/tests_lqcpu_python.yml +++ b/.github/workflows/tests_lqcpu_python.yml @@ -80,6 +80,15 @@ jobs: repository: PennyLaneAI/catalyst path: ${{ github.workspace}}/catalyst + - name: Switch to release build of Catalyst + if: inputs.lightning-version == 'release' + run: | + cd ${{ github.workspace}}/catalyst + git fetch --all + git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) + git log -1 --format='%H' + cd ${{ github.workspace }} + - name: Install System dependencies run: | sudo apt-get update && sudo apt-get -y -q install cmake gcc-$GCC_VERSION g++-$GCC_VERSION libopenblas-dev diff --git a/.github/workflows/tests_windows_cpp.yml b/.github/workflows/tests_windows_cpp.yml index 00bca45c10..acd53f43f9 100644 --- a/.github/workflows/tests_windows_cpp.yml +++ b/.github/workflows/tests_windows_cpp.yml @@ -44,6 +44,15 @@ jobs: repository: PennyLaneAI/catalyst path: ${{ github.workspace}}/catalyst + - name: Switch to release build of Catalyst + if: inputs.lightning-version == 'release' + run: | + cd ${{ github.workspace}}/catalyst + git fetch --all + git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) + git log -1 --format='%H' + cd ${{ github.workspace }} + - name: Kokkos execution strategy id: exec_model run: echo "exec_model=[\"SERIAL\"]" >> $GITHUB_OUTPUT # We may also adopt [OPENMP, THREADS] in later iterations diff --git a/.github/workflows/tests_without_binary.yml b/.github/workflows/tests_without_binary.yml index ad217b8d09..82123f84e8 100644 --- a/.github/workflows/tests_without_binary.yml +++ b/.github/workflows/tests_without_binary.yml @@ -109,6 +109,15 @@ jobs: repository: PennyLaneAI/catalyst path: ${{ github.workspace}}/catalyst + - name: Switch to release build of Catalyst + if: inputs.lightning-version == 'release' + run: | + cd ${{ github.workspace}}/catalyst + git fetch --all + git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) + git log -1 --format='%H' + cd ${{ github.workspace }} + - name: Install the pennylane_lightning core package (lightning_qubit) env: SKIP_COMPILATION: True diff --git a/pennylane_lightning/core/_version.py b/pennylane_lightning/core/_version.py index c05160fdaf..6eddbe3e1c 100644 --- a/pennylane_lightning/core/_version.py +++ b/pennylane_lightning/core/_version.py @@ -16,4 +16,4 @@ Version number (major.minor.patch[-label]) """ -__version__ = "0.44.0-dev8" +__version__ = "0.44.0-dev9" diff --git a/scripts/compare_changelog_commits.sh b/scripts/compare_changelog_commits.sh index 9b713015ee..96f0361fec 100644 --- a/scripts/compare_changelog_commits.sh +++ b/scripts/compare_changelog_commits.sh @@ -4,8 +4,8 @@ # It prints the authors of the merged PRs and the PRs in the CHANGELOG, and highlights any discrepancies. # Usage: -# Run the script with -# bash compare_changelog_commits.sh +# Run the script with +# bash compare_changelog_commits.sh # Root directory, should be the location of the pennylane-lightning repo ROOT_DIR="." @@ -43,9 +43,9 @@ contributors_begin=$(grep -n "

Contributors ✍️

" "${CHANGELOG_FILE}" extract_contributors_from_changelog() { # Extract the list of contributors from the CHANGELOG - contribution_list=$(sed -n "$((contributors_begin + 4)),$((changelog_lower_bound - 2))p" "${CHANGELOG_FILE}") + contribution_list=$(sed -n "$((contributors_begin + 4)),$((changelog_lower_bound - 2))p" "${CHANGELOG_FILE}") # Sort and format the contribution list - contribution_list=$(echo "$contribution_list" | sort | sed 's/.$/,/ ; s/,//; s/$/,/') + contribution_list=$(echo "$contribution_list" | sort | sed 's/.$/,/ ; s/,//') echo "$contribution_list" } @@ -58,17 +58,18 @@ extract_contributors_from_git() { } # Print list of Authors from Changelog and Git -echo "Authors in CHANGELOG / Authors in Git" +echo "Authors in CHANGELOG | Authors in Git" echo "---------------------------|---------------------------" +# Add | in the middle of the two columns paste <(extract_contributors_from_changelog) \ <(extract_contributors_from_git) \ - | column -t -s ',' + | sed 's/\t/ ,| /' | column -s ',' -t echo "---------------------------|---------------------------" echo "--------------------------------------------------------------------------------" # Create the list of merged PR list_merged_PRs(){ - # Get the list of merged PRs to master + # Get the list of merged PRs to master list_PRs=$(gh pr list --state merged --base master --search "merged:>=$LAST_RELEASE_DATE" -L 1000 ) # Extract the PR number and title, format it, and sort it list_PRs=$(echo "$list_PRs" | awk -F 'MERGED' '{print $1}' | sort -h) @@ -83,7 +84,7 @@ list_entries_in_changelog(){ # Format the list of PRs, replace 'pull/' with 'pull/_', and remove trailing parentheses list_entries=$(echo "$list_entries" | sed 's/--/\n/g; s|pull/|pull/_ |g ; s/)//g') # Add the PR number at the beginning of the line - list_entries=$(echo "$list_entries" | awk '{print $NF, " ", $0}') + list_entries=$(echo "$list_entries" | awk '{print $NF, " ", $0}') # Remove the PR link and sort the entries list_entries=$(echo "$list_entries" | sed 's|\[(.*||' | sort -h -k1) echo "$list_entries" > release_list_PR_in_changelog.txt @@ -91,7 +92,7 @@ list_entries_in_changelog(){ # Create the list of entries in the CHANGELOG and the merged PRs list_entries_in_changelog -list_merged_PRs +list_merged_PRs interleave_rows(){ file1="$1" diff --git a/scripts/create_lightning_rc.sh b/scripts/create_lightning_rc.sh index 8c66f1998e..7b28a99aae 100644 --- a/scripts/create_lightning_rc.sh +++ b/scripts/create_lightning_rc.sh @@ -3,15 +3,34 @@ # Exit immediately if a command exits with a non-zero status set -e -# This script creates a release candidate branch for PennyLane-Lightning -# How to use: -# 1. Make sure you have the latest changes from the main branch -# 2. Run the script with the desired options. For example: +# This script automates the creation of a release candidate branch for PennyLane-Lightning. # -# bash scripts/create_lightning_rc.sh -s 0.42.0 -r 0.43.99 -n 0.44.99 --create_rc -# bash scripts/create_lightning_rc.sh -s 0.42.0 -r 0.43.99 -n 0.44.99 --lightning_test -# bash scripts/create_lightning_rc.sh -s 0.42.0 -r 0.43.99 -n 0.44.99 --release -# bash scripts/create_lightning_rc.sh -s 0.42.0 -r 0.43.99 -n 0.44.99 --release_assets +# Prerequisites: +# - Be on the latest master branch in the root directory of pennylane-lightning/ +# - Have 'gh' CLI installed and authenticated with GitHub +# - Have 'jq' installed for JSON processing +# +# Usage Instructions: +# The script supports different phases of the release process. The script should run on the root +# directory of the pennylane-lightning repository and in master branch. +# Run them in sequence: +# +# 1. Create Release Candidate (creates branches and PRs): +# bash scripts/create_lightning_rc.sh -s 0.42.0 -r 0.43.0 -n 0.44.0 --create_rc +# +# 2. Test Lightning Installation (validates RC build): +# bash scripts/create_lightning_rc.sh -s 0.42.0 -r 0.43.0 -n 0.44.0 --lightning_test +# +# 3. Create Release (creates GitHub release): +# bash scripts/create_lightning_rc.sh -s 0.42.0 -r 0.43.0 -n 0.44.0 --release +# +# 4. Handle Release Assets (upload wheels and source distributions): +# bash scripts/create_lightning_rc.sh -s 0.42.0 -r 0.43.0 -n 0.44.0 --release_assets +# +# Version flags: +# -s/--stable_version: Current stable release (e.g., 0.42.0) +# -r/--release_version: Version being released (e.g., 0.43.0) +# -n/--next_version: Next development version (e.g., 0.44.0) # # Use the --help option to see all available options. @@ -25,13 +44,16 @@ IS_TEST=true # Debug option # To avoid pushing any branch or PR to GitHub. Set to true LOCAL_TEST=true -# To avoid publishing to TestPyPI. Set to false -PUSH_TESTPYPI=false -# Check if gh CLI is installed +# Check if gh CLI, and jq are installed if ! command -v gh &> /dev/null; then echo "gh CLI could not be found" - exit + exit 1 +fi + +if ! command -v jq &> /dev/null; then + echo "jq could not be found" + exit 1 fi # -------------------------------------------------------------------------------------------------- @@ -53,7 +75,7 @@ help(){ echo " -h, --help Show this help message" } -ROOT_DIR="$(pwd)" +ROOT_DIR="." if [ ! -d "${ROOT_DIR}/.git" ]; then echo "You should to run the script on the root directory of the repository" @@ -71,21 +93,25 @@ use_dry_run(){ if [ "$LOCAL_TEST" == "true" ]; then dry_run="--dry-run" fi - + echo $dry_run } -branch_name(){ - version=$1 - suffix=$2 +branch_name() { + local version=$1 + local suffix=$2 + local branch - branch=$(echo "v${version}_${suffix}" | tr '[:upper:]' '[:lower:]') + # The expression ${suffix:+_${suffix}} adds "_$suffix" ONLY if suffix is not empty. + branch="v${version}${suffix:+_${suffix}}" if [ "$IS_TEST" == "true" ]; then - branch="test_v${version}_${suffix}_alpha" + # The same logic applies here for the test branch. + branch="test_v${version}${suffix:+_${suffix}}_alpha" fi - echo $branch + # Convert to lowercase at the end. + echo "$branch" | tr '[:upper:]' '[:lower:]' } test_pennylane_version(){ @@ -128,6 +154,17 @@ create_release_notes(){ sed -i 's|^- |* |' ${ROOT_DIR}/release_notes.md } +add_CHANGELOG_entry(){ + # Add a new entry to the CHANGELOG + local changelog_entry=$1 + local PR_number=$2 + +sed -i "/

Internal changes ⚙️<\/h3>/a \\ +\\ +- $changelog_entry\\ + [(#${PR_number})](https://github.com/PennyLaneAI/pennylane-lightning/pull/${PR_number})" $CHANGELOG_FILE +} + # Release functions create_release_candidate_branch() { @@ -138,7 +175,7 @@ create_release_candidate_branch() { git checkout master git pull origin master - # Create branches + # Create branches for branch in base docs rc; do git checkout -b $(branch_name ${RELEASE_VERSION} ${branch}) if [ "$LOCAL_TEST" == "false" ]; then @@ -175,19 +212,6 @@ create_release_candidate_branch() { git add ${ROOT_DIR}/cmake/support_catalyst.cmake git commit -m "Set Catalyst dependency in cmake to commit ${last_catalyst_commit}." - # Update RNG salt - sed -i "/rng_salt = /d" ${ROOT_DIR}/tests/pytest.ini - echo "rng_salt = v${RELEASE_VERSION}" >> ${ROOT_DIR}/tests/pytest.ini - git add ${ROOT_DIR}/tests/pytest.ini - git commit -m "Set rng_salt to v${RELEASE_VERSION} in tests/pytest.ini." - - # Enable to upload the wheels to TestPyPI and GitHub Artifacts - if [ "$PUSH_TESTPYPI" == "true" ]; then - sed -i "s|event_name == 'release'|event_name == 'pull_request'|g" ${ROOT_DIR}/.github/workflows/wheel_* - git add ${ROOT_DIR}/.github/workflows/wheel_* - git commit -m "Update wheel workflows for pull request" - fi - if [ "$LOCAL_TEST" == "false" ]; then git push --set-upstream origin $(branch_name ${RELEASE_VERSION} rc) fi @@ -214,6 +238,10 @@ create_docs_review_PR(){ git commit -m "Modify docs for v${RELEASE_VERSION}" --allow-empty + if [ "$LOCAL_TEST" == "false" ]; then + git push --set-upstream origin $(branch_name ${RELEASE_VERSION} docs) + fi + if [ "$LOCAL_TEST" == "false" ]; then gh pr create $(use_dry_run) \ --title "Create v${RELEASE_VERSION} Doc branch" \ @@ -236,6 +264,10 @@ create_docker_PR(){ git add ${ROOT_DIR}/.github/workflows/compat-docker-release.yml git commit -m "Update compat-docker-release.yml to use v${RELEASE_VERSION}" + add_CHANGELOG_entry "Test Docker images for v${RELEASE_VERSION} RC branch." "0000" + git add $CHANGELOG_FILE + git commit -m "Add CHANGELOG entry for Docker test" + if [ "$LOCAL_TEST" == "false" ]; then git push --set-upstream origin $(branch_name ${RELEASE_VERSION} docker) @@ -288,7 +320,7 @@ echo "$new_changelog_text" } create_version_bump_PR(){ - # Create a PR for the new version + # Create a PR for the new version git checkout master git checkout -b $(branch_name ${RELEASE_VERSION} bump) @@ -338,19 +370,31 @@ create_version_bump_PR(){ git commit -m "Update CHANGELOG.md with new version entry." # Update minimum PennLane version in requirements.txt and configure_pyproject_toml.py - sed -i "s/pennylane>=v\?[0-9\.]\+/pennylane>=${RELEASE_VERSION%??}/" ${ROOT_DIR}/requirements.txt - sed -i "s/pennylane>=v\?[0-9\.]\+/pennylane>=${RELEASE_VERSION%??}/" ${ROOT_DIR}/scripts/configure_pyproject_toml.py + sed -i "s/pennylane>=v\?[0-9\.]\+/pennylane>=${STABLE_VERSION%??}/" ${ROOT_DIR}/requirements.txt + sed -i "s/pennylane>=v\?[0-9\.]\+/pennylane>=${STABLE_VERSION%??}/" ${ROOT_DIR}/scripts/configure_pyproject_toml.py + sed -i "s/pennylane>=v\?[0-9\.]\+/pennylane>=${STABLE_VERSION%??}/" ${ROOT_DIR}/pyproject.toml + + git add ${ROOT_DIR}/requirements.txt + git add ${ROOT_DIR}/scripts/configure_pyproject_toml.py + git add ${ROOT_DIR}/pyproject.toml - git add ${ROOT_DIR}/requirements.txt ${ROOT_DIR}/scripts/configure_pyproject_toml.py git commit -m "Update minimum PennyLane version to ${RELEASE_VERSION%??}" - + + # Update RNG salt + for i in ${ROOT_DIR}/tests/pytest.ini ${ROOT_DIR}/mpitests/pytest.ini ; do + sed -i "/rng_salt = /d" $i + echo "rng_salt = v${RELEASE_VERSION}" >> $i + git add $i + done + git commit -m "Set rng_salt to v${RELEASE_VERSION} in tests/pytest.ini and mpitests/pytest.ini." + if [ "$LOCAL_TEST" == "false" ]; then git push origin $(branch_name ${RELEASE_VERSION} bump) fi } test_install_lightning(){ - # Test Lightning installation + # Test Lightning installation git checkout master git checkout $(branch_name ${RELEASE_VERSION} rc) @@ -367,7 +411,7 @@ test_install_lightning(){ # Test installation of lightning custom compiles options - # Lightning Kokkos with CUDA and MPI + # Lightning Kokkos and MPI pip uninstall -y pennylane_lightning_kokkos PL_BACKEND="lightning_kokkos" python ${ROOT_DIR}/scripts/configure_pyproject_toml.py CMAKE_ARGS="-DENABLE_MPI=ON -DKokkos_ENABLE_CUDA=OFF -DKokkos_ENABLE_OPENMP=ON" python -m pip install . -v @@ -386,9 +430,9 @@ test_install_lightning(){ echo "Installed backends:" echo "- Lightning Default:" echo "$is_installed_backend" - echo "- Lightning Kokkos (MPI):" + echo "- Lightning Kokkos (MPI):" echo "$is_installed_kokkos_mpi" - echo "- Lightning GPU (MPI):" + echo "- Lightning GPU (MPI):" echo "$is_installed_gpu_mpi" } @@ -396,9 +440,9 @@ download_artifacts_gh(){ # Download the artifacts from the GitHub Actions runs wheels_runners=$(gh run list --branch $(branch_name ${RELEASE_VERSION} rc) \ - --json status,workflowName,workflowDatabaseId | jq '.[] | select(.workflowName | contains("Wheel"))') + --json status,workflowName,databaseId | jq '.[] | select(.workflowName | contains("Wheel"))') - completed_runners=$(echo "$wheels_runners" | jq -r '. | select(.status == "completed") | .workflowDatabaseId') + completed_runners=$(echo "$wheels_runners" | jq -r '. | select(.status == "completed") | .databaseId') incomplete_runners=$(echo "$wheels_runners" | jq -r '. | select(.status != "completed") ') @@ -418,8 +462,8 @@ test_wheels_for_unwanted_libraries(){ pushd Wheels - for wheel in *.zip; do - unzip -o -q "$wheel" + for wheel in *.zip/*.whl; do + cp "$wheel" . done python ${ROOT_DIR}/scripts/validate_attrs.py @@ -436,7 +480,7 @@ create_release_branch(){ gh pr comment $(branch_name ${RELEASE_VERSION} rc) \ --body "Forked as v${RELEASE_VERSION}_release to be released with tag v${RELEASE_VERSION}" fi - + # Create the release branch git checkout -b $(branch_name ${RELEASE_VERSION} release) @@ -448,13 +492,7 @@ create_release_branch(){ echo '__version__ = "'${RELEASE_VERSION}'"' >> $PL_VERSION_FILE fi - if [ "$PUSH_TESTPYPI" == "true" ]; then - # Disable to upload the wheels to TestPyPI and GitHub Artifacts - sed -i "s|event_name == 'pull_request'|event_name == 'release'|g" ${ROOT_DIR}/.github/workflows/wheel_* - fi - git add $PL_VERSION_FILE - git add ${ROOT_DIR}/.github/workflows/wheel_* git commit -m "Pre-release updates" if [ "$LOCAL_TEST" == "false" ]; then git push --set-upstream origin $(branch_name ${RELEASE_VERSION} release) @@ -484,9 +522,9 @@ create_GitHub_release(){ download_release_artifacts_gh(){ # Download the artifacts from the GitHub Actions runs wheels_runners=$(gh run list --event release --branch $(branch_name ${RELEASE_VERSION}) \ - --json status,workflowName,workflowDatabaseId | jq '.[] | select(.workflowName | contains("Wheel"))') + --json status,workflowName,databaseId | jq '.[] | select(.workflowName | contains("Wheel"))') - completed_runners=$(echo "$wheels_runners" | jq -r '. | select(.status == "completed") | .workflowDatabaseId') + completed_runners=$(echo "$wheels_runners" | jq -r '. | select(.status == "completed") | .databaseId') incomplete_runners=$(echo "$wheels_runners" | jq -r '. | select(.status != "completed") ') mkdir -p ${ROOT_DIR}/Release_Assets @@ -504,17 +542,21 @@ create_sdist(){ # Create the source distribution git checkout $(branch_name ${RELEASE_VERSION} "release") - PL_BACKEND=lightning_qubit python ${ROOT_DIR}/scripts/configure_pyproject_toml.py - python setup.py sdist mkdir -p ${ROOT_DIR}/Release_Assets + + for backend in qubit gpu kokkos tensor; do + PL_BACKEND=lightning_${backend} python ${ROOT_DIR}/scripts/configure_pyproject_toml.py + python setup.py sdist + done + cp dist/*.tar.gz ${ROOT_DIR}/Release_Assets/ } upload_release_assets_gh(){ # Upload the release assets - gh release upload $(branch_name ${RELEASE_VERSION} "0") ${ROOT_DIR}/Release_Assets/*.whl --clobber - gh release upload $(branch_name ${RELEASE_VERSION} "0") ${ROOT_DIR}/Release_Assets/*.tar.gz --clobber + gh release upload $(branch_name ${RELEASE_VERSION}) ${ROOT_DIR}/Release_Assets/*.whl --clobber + gh release upload $(branch_name ${RELEASE_VERSION}) ${ROOT_DIR}/Release_Assets/*.tar.gz --clobber } create_merge_branch(){ @@ -545,11 +587,15 @@ create_merge_branch(){ git commit -m "Restore Catalyst GIT_TAG to main" for i in release stable; do - sed -i "s|v${RELEASE_VERSION}|v${NEXT_VERSION}|g" ${ROOT_DIR}/.github/workflows/compat-docker-${i}.yml + sed -i "s|v${STABLE_VERSION}|v${RELEASE_VERSION}|g" ${ROOT_DIR}/.github/workflows/compat-docker-${i}.yml git add ${ROOT_DIR}/.github/workflows/compat-docker-${i}.yml done git commit -m "Update Docker workflows for new release version" + add_CHANGELOG_entry "Merge RC v${RELEASE_VERSION} rc to master" "0000" + git add $CHANGELOG_FILE + git commit -m "Add CHANGELOG entry for RC merge" + if [ "$LOCAL_TEST" == "false" ]; then git push --set-upstream origin $(branch_name ${RELEASE_VERSION} "rc_merge") fi @@ -640,7 +686,6 @@ set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters # If not a test run if [ "$IS_TEST" == "false" ]; then LOCAL_TEST=false - PUSH_TESTPYPI=true fi echo "STABLE_VERSION: $STABLE_VERSION"