From 6856ec4b4b05de70a20b777fd86d525e2dfe1d37 Mon Sep 17 00:00:00 2001 From: runora95 Date: Tue, 28 Oct 2025 14:58:17 -0400 Subject: [PATCH 01/15] Daily qml builds with RC environment --- .github/workflows/v2-build-rc-demos-daily.yml | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 .github/workflows/v2-build-rc-demos-daily.yml diff --git a/.github/workflows/v2-build-rc-demos-daily.yml b/.github/workflows/v2-build-rc-demos-daily.yml new file mode 100644 index 0000000000..14cf30597b --- /dev/null +++ b/.github/workflows/v2-build-rc-demos-daily.yml @@ -0,0 +1,110 @@ +name: Build Daily RC Demos +on: + schedule: + - cron: '0 11 * * 1-5' # Runs weekdays 6 am ET + workflow_dispatch: + +jobs: + check-for-rc-branches: + runs-on: ubuntu-latest + outputs: + branch_exists: ${{ steps.check-rc-branches.outputs.branch_exists }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + repository: PennyLaneAI/pennylane + + - name: Install latest setuptools + run: | + python -m pip install --upgrade pip + pip install --upgrade setuptools packaging + + - name: Check for RC branches + id: check-rc-branches + run: | + VERSION=$(python setup.py --version) + echo "Current version: $VERSION" + IFS=. read MAJ MIN PAT <<< "${VERSION%-dev[0-9]*}" + RC_BRANCH="v${MAJ}.$((MIN-2)).${PAT}-rc0" + if git ls-remote --exit-code origin "refs/heads/$RC_BRANCH"; then + echo "branch_exists=true" >> $GITHUB_OUTPUT + echo "rc_branch=$RC_BRANCH" >> $GITHUB_OUTPUT + else + echo "branch_exists=false" >> $GITHUB_OUTPUT + echo "No RC branch found." + fi + + build-demos-with-rc-branches: + runs-on: ubuntu-latest + needs: check-for-rc-branches + if: needs.check-for-rc-branches.outputs.branch_exists == 'true' + outputs: + pennylane-version: ${{ steps.setup-rc-versions.outputs.pennylane-version }} + lightning-version: ${{ steps.setup-rc-versions.outputs.lightning-version }} + catalyst-version: ${{ steps.setup-rc-versions.outputs.catalyst-version }} + rc-build-branch: ${{ steps.setup-rc-versions.outputs.rc-build-branch }} + steps: + - name: Checkout QML repository + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Set up rc versions + id: setup-rc-versions + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + rc_build_branch=rc-daily-build-$(date +'%Y-%m-%d-%H%M%S') + git checkout -b $rc_build_branch + python -m pip index versions pennylane 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || true + pennylane_version=$(python -m pip index versions pennylane 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || true) + lightning_version=$(python -m pip index versions pennylane-lightning 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 ||true ) + catalyst_version=$(python -m pip index versions pennylane-catalyst 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || true) + echo "lightning-version=$lightning_version" >> $GITHUB_OUTPUT + echo "catalyst-version=$catalyst_version" >> $GITHUB_OUTPUT + echo "pennylane-version=$pennylane_version" >> $GITHUB_OUTPUT + echo "rc-build-branch=$rc_build_branch" >> $GITHUB_OUTPUT + echo "PennyLane version: $pennylane_version, PennyLane-Lightning version: $lightning_version, PennyLane-Catalyst version: $catalyst_version" + + - name: Update demo versions + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + sed -i -E "s#git\+https://github.com/PennyLaneAI/pennylane.git\#egg=pennylane\",#pennylane<=${{ steps.setup-rc-versions.outputs.pennylane-version }}\",\\n\\t\\t\\t\"—extra-index-url\",\\n\\t\\t\\t\"https://test.pypi.org/simple/\",\\n\\t\\t\\tpre=True,#" lib/qml/lib/demo.py + sed -i "s/PennyLane-Lightning/pennylane-lightning<=${{ steps.setup-rc-versions.outputs.lightning-version }}/" lib/qml/lib/demo.py + sed -i "s/PennyLane-Catalyst/pennylane-catalyst<=${{ steps.setup-rc-versions.outputs.catalyst-version }}/" lib/qml/lib/demo.py + git commit -am "Set up RC versions for demo builds" + git push --set-upstream origin ${{ steps.setup-rc-versions.outputs.rc-build-branch }} + + build-demos: + needs: build-demos-with-rc-branches + uses: ./.github/workflows/v2-build-demos.yml + with: + ref: '${{ needs.build-demos-with-rc-branches.outputs.rc-build-branch }}' + demo-names: '' + execute: true + dev: false + save-artifact: true + artifact-name: 'demo-build-use-rc' + artifact-retention: 10 + keep-going: false + quiet: false + batch_size: 10 + + cleanup: + runs-on: ubuntu-latest + needs: + - build-demos + - build-demos-with-rc-branches + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Cleanup branch + run: | + echo "Cleaning up branch '${{ needs.build-demos-with-rc-branches.outputs.rc-build-branch }}'" + git push origin --delete '${{ needs.build-demos-with-rc-branches.outputs.rc-build-branch }}'|| true From 26f8c8c4350402b09b35fcd7b267bf53102708be Mon Sep 17 00:00:00 2001 From: runora95 Date: Mon, 10 Nov 2025 17:39:24 -0500 Subject: [PATCH 02/15] input variables --- .github/workflows/v2-build-rc-demos-daily.yml | 11 +++-- lib/qml/lib/demo.py | 49 +++++++++++++++++-- 2 files changed, 54 insertions(+), 6 deletions(-) diff --git a/.github/workflows/v2-build-rc-demos-daily.yml b/.github/workflows/v2-build-rc-demos-daily.yml index 14cf30597b..af631ce1d2 100644 --- a/.github/workflows/v2-build-rc-demos-daily.yml +++ b/.github/workflows/v2-build-rc-demos-daily.yml @@ -15,6 +15,11 @@ jobs: with: repository: PennyLaneAI/pennylane + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Install latest setuptools run: | python -m pip install --upgrade pip @@ -31,7 +36,7 @@ jobs: echo "branch_exists=true" >> $GITHUB_OUTPUT echo "rc_branch=$RC_BRANCH" >> $GITHUB_OUTPUT else - echo "branch_exists=false" >> $GITHUB_OUTPUT + echo "branch_exists=true" >> $GITHUB_OUTPUT # TODO change to false echo "No RC branch found." fi @@ -78,7 +83,7 @@ jobs: sed -i "s/PennyLane-Lightning/pennylane-lightning<=${{ steps.setup-rc-versions.outputs.lightning-version }}/" lib/qml/lib/demo.py sed -i "s/PennyLane-Catalyst/pennylane-catalyst<=${{ steps.setup-rc-versions.outputs.catalyst-version }}/" lib/qml/lib/demo.py git commit -am "Set up RC versions for demo builds" - git push --set-upstream origin ${{ steps.setup-rc-versions.outputs.rc-build-branch }} + # git push --set-upstream origin ${{ steps.setup-rc-versions.outputs.rc-build-branch }} build-demos: needs: build-demos-with-rc-branches @@ -107,4 +112,4 @@ jobs: - name: Cleanup branch run: | echo "Cleaning up branch '${{ needs.build-demos-with-rc-branches.outputs.rc-build-branch }}'" - git push origin --delete '${{ needs.build-demos-with-rc-branches.outputs.rc-build-branch }}'|| true + # git push origin --delete '${{ needs.build-demos-with-rc-branches.outputs.rc-build-branch }}'|| true diff --git a/lib/qml/lib/demo.py b/lib/qml/lib/demo.py index d27b82909f..5d8cd07f60 100644 --- a/lib/qml/lib/demo.py +++ b/lib/qml/lib/demo.py @@ -15,10 +15,50 @@ import lxml.html from qml.context import Context import sphobjinv as soi +import argparse logger = getLogger("qml") +def parse_extra_args(): + parser = argparse.ArgumentParser() + parser.add_argument( + "--lightning-version", + type=str, + default="PennyLane-Lightning", + help="Specify the version of PennyLane-Lightning to install (default: PennyLane-Lightning)", + ) + parser.add_argument( + "--catalyst-version", + type=str, + default="PennyLane-Catalyst", + help="Specify the version of PennyLane-Catalyst to install (default: PennyLane-Catalyst)", + ) + parser.add_argument( + "--pennylane-version", + type=str, + default="git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane", + help="Specify the version of PennyLane to install (default: git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane)" + ) + parser.add_argument( + "--extra-index-url", + type=str, + default=None, + help="Specify an additional index URL for pip to use (default: None)", + ) + parser.add_argument( + "--testpypi", + type=str, + default=None, + help="Use TestPyPI as an additional package index (default: False)", + ) + parser.add_argument( + "--prerelease-packages", + type=bool, + default=False, + help="Allow installation of pre-release packages (default: False)", + ) + return parser.parse_args() class BuildTarget(Enum): """Sphinx-build targets.""" @@ -296,7 +336,7 @@ def _build_demo( "--upgrade", "--extra-index-url", "https://test.pypi.org/simple/", - "PennyLane-Catalyst", + parse_extra_args().catalyst_version, # TODO use_uv=False, quiet=False, pre=True, @@ -307,7 +347,7 @@ def _build_demo( "--upgrade", "--extra-index-url", "https://test.pypi.org/simple/", - "PennyLane-Lightning", + parse_extra_args().lightning_version, use_uv=False, quiet=False, pre=True, @@ -317,9 +357,12 @@ def _build_demo( cmds.pip_install( build_venv.python, "--upgrade", - "git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane", + parse_extra_args().pennylane_version, # TODO + parse_extra_args().testpypi, + parse_extra_args().extra_index_url, use_uv=False, quiet=False, + pre=parse_extra_args().prerelease_packages, ) stage_dir = ctx.build_dir / "demonstrations" From e5b85bb2c29ebc22524ae637f8e1c75c918eb5fd Mon Sep 17 00:00:00 2001 From: runora95 Date: Mon, 10 Nov 2025 17:43:19 -0500 Subject: [PATCH 03/15] run --- .github/workflows/v2-build-rc-demos-daily.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/v2-build-rc-demos-daily.yml b/.github/workflows/v2-build-rc-demos-daily.yml index af631ce1d2..fa8dcd6d88 100644 --- a/.github/workflows/v2-build-rc-demos-daily.yml +++ b/.github/workflows/v2-build-rc-demos-daily.yml @@ -3,6 +3,7 @@ on: schedule: - cron: '0 11 * * 1-5' # Runs weekdays 6 am ET workflow_dispatch: + push: jobs: check-for-rc-branches: @@ -43,7 +44,7 @@ jobs: build-demos-with-rc-branches: runs-on: ubuntu-latest needs: check-for-rc-branches - if: needs.check-for-rc-branches.outputs.branch_exists == 'true' + # if: needs.check-for-rc-branches.outputs.branch_exists == 'true' outputs: pennylane-version: ${{ steps.setup-rc-versions.outputs.pennylane-version }} lightning-version: ${{ steps.setup-rc-versions.outputs.lightning-version }} From 3b26909e6354df69e6c7e577d9e74aa1bbb3853e Mon Sep 17 00:00:00 2001 From: runora95 Date: Mon, 10 Nov 2025 17:50:34 -0500 Subject: [PATCH 04/15] push --- .github/workflows/v2-build-rc-demos-daily.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/v2-build-rc-demos-daily.yml b/.github/workflows/v2-build-rc-demos-daily.yml index fa8dcd6d88..ae0c17e3e4 100644 --- a/.github/workflows/v2-build-rc-demos-daily.yml +++ b/.github/workflows/v2-build-rc-demos-daily.yml @@ -84,7 +84,7 @@ jobs: sed -i "s/PennyLane-Lightning/pennylane-lightning<=${{ steps.setup-rc-versions.outputs.lightning-version }}/" lib/qml/lib/demo.py sed -i "s/PennyLane-Catalyst/pennylane-catalyst<=${{ steps.setup-rc-versions.outputs.catalyst-version }}/" lib/qml/lib/demo.py git commit -am "Set up RC versions for demo builds" - # git push --set-upstream origin ${{ steps.setup-rc-versions.outputs.rc-build-branch }} + git push --set-upstream origin ${{ steps.setup-rc-versions.outputs.rc-build-branch }} build-demos: needs: build-demos-with-rc-branches @@ -113,4 +113,4 @@ jobs: - name: Cleanup branch run: | echo "Cleaning up branch '${{ needs.build-demos-with-rc-branches.outputs.rc-build-branch }}'" - # git push origin --delete '${{ needs.build-demos-with-rc-branches.outputs.rc-build-branch }}'|| true + git push origin --delete '${{ needs.build-demos-with-rc-branches.outputs.rc-build-branch }}'|| true From f984654679b161996c185e387e63fdc9cfd35b22 Mon Sep 17 00:00:00 2001 From: runora95 Date: Tue, 11 Nov 2025 14:02:12 -0500 Subject: [PATCH 05/15] typo --- lib/qml/lib/demo.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/qml/lib/demo.py b/lib/qml/lib/demo.py index 5d8cd07f60..4c8d1c1e1f 100644 --- a/lib/qml/lib/demo.py +++ b/lib/qml/lib/demo.py @@ -27,36 +27,42 @@ def parse_extra_args(): type=str, default="PennyLane-Lightning", help="Specify the version of PennyLane-Lightning to install (default: PennyLane-Lightning)", + nargs='?' ) parser.add_argument( "--catalyst-version", type=str, default="PennyLane-Catalyst", help="Specify the version of PennyLane-Catalyst to install (default: PennyLane-Catalyst)", + nargs='?' ) parser.add_argument( "--pennylane-version", type=str, default="git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane", - help="Specify the version of PennyLane to install (default: git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane)" + help="Specify the version of PennyLane to install (default: git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane)", + nargs='?' ) parser.add_argument( "--extra-index-url", type=str, default=None, help="Specify an additional index URL for pip to use (default: None)", + nargs='?' ) parser.add_argument( "--testpypi", type=str, default=None, help="Use TestPyPI as an additional package index (default: False)", + nargs='?' ) parser.add_argument( "--prerelease-packages", type=bool, default=False, help="Allow installation of pre-release packages (default: False)", + nargs='?' ) return parser.parse_args() From 8adf3c905aa396415635840d44f46f09d2df272b Mon Sep 17 00:00:00 2001 From: runora95 Date: Tue, 11 Nov 2025 16:34:38 -0500 Subject: [PATCH 06/15] rmv todo --- lib/qml/lib/demo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/qml/lib/demo.py b/lib/qml/lib/demo.py index 4c8d1c1e1f..350b1351aa 100644 --- a/lib/qml/lib/demo.py +++ b/lib/qml/lib/demo.py @@ -342,7 +342,7 @@ def _build_demo( "--upgrade", "--extra-index-url", "https://test.pypi.org/simple/", - parse_extra_args().catalyst_version, # TODO + parse_extra_args().catalyst_version, use_uv=False, quiet=False, pre=True, @@ -363,7 +363,7 @@ def _build_demo( cmds.pip_install( build_venv.python, "--upgrade", - parse_extra_args().pennylane_version, # TODO + parse_extra_args().pennylane_version, parse_extra_args().testpypi, parse_extra_args().extra_index_url, use_uv=False, From 083987a93b9503898d25975206eee425fba6015f Mon Sep 17 00:00:00 2001 From: runora95 Date: Wed, 19 Nov 2025 09:40:59 -0500 Subject: [PATCH 07/15] update inputs --- .github/workflows/v2-build-demos.yml | 69 +++++++++++++- .github/workflows/v2-build-rc-demos-daily.yml | 28 +++--- lib/qml/app/app.py | 28 ++++++ lib/qml/lib/demo.py | 94 ++++++++----------- 4 files changed, 151 insertions(+), 68 deletions(-) diff --git a/.github/workflows/v2-build-demos.yml b/.github/workflows/v2-build-demos.yml index 7d4bfe9c95..441ba0e1a4 100644 --- a/.github/workflows/v2-build-demos.yml +++ b/.github/workflows/v2-build-demos.yml @@ -54,6 +54,36 @@ on: description: Number of demos to build per job. type: number default: 10 + lightning-version: + description: Specify the version of PennyLane-Lightning to install (default PennyLane-Lightning). + required: false + type: string + default: "PennyLane-Lightning" + catalyst-version: + description: Specify the version of PennyLane-Catalyst to install (default PennyLane-Catalyst). + required: false + type: string + default: "PennyLane-Catalyst" + pennylane-version: + description: Specify the version of PennyLane to install (default git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane). + required: false + type: string + default: "git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane" + extra-index-url: + description: Specify an additional index URL for pip to use (default None). + required: false + type: string + default: null + testpypi: + description: Use TestPyPI as an additional package index (default None). + required: false + type: string + default: null + prerelease-packages: + description: Allow installation of pre-release packages (default False). + required: false + type: boolean + default: false outputs: artifact-name: description: "Name of the artifact containing the built demos" @@ -110,6 +140,36 @@ on: description: Number of demos to build per job. type: number default: 10 + lightning-version: + description: Specify the version of PennyLane-Lightning to install (default PennyLane-Lightning). + required: false + type: string + default: "PennyLane-Lightning" + catalyst-version: + description: Specify the version of PennyLane-Catalyst to install (default PennyLane-Catalyst). + required: false + type: string + default: "PennyLane-Catalyst" + pennylane-version: + description: Specify the version of PennyLane to install (default git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane). + required: false + type: string + default: "git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane" + extra-index-url: + description: Specify an additional index URL for pip to use (default None). + required: false + type: string + default: null + testpypi: + description: Use TestPyPI as an additional package index (default None). + required: false + type: string + default: null + prerelease-packages: + description: Allow installation of pre-release packages (default False). + required: false + type: boolean + default: false jobs: generate-build-variables: @@ -168,6 +228,7 @@ jobs: - name: Install pandoc, opencl, and graphviz run: | + sudo apt-get update sudo apt-get install -y \ ocl-icd-opencl-dev \ pandoc \ @@ -193,7 +254,13 @@ jobs: ${{ inputs.keep-going && '--keep-going' || '--no-keep-going' }} \ ${{ inputs.quiet && '--quiet' || '--no-quiet' }} \ ${{ steps.demo-name-list.outputs.demo-names }} \ - ${{ inputs.dev && '--dev' || '--no-dev' }} + ${{ inputs.dev && '--dev' || '--no-dev' }} \ + --lightning-version "${{ inputs.lightning-version }}" \ + --catalyst-version "${{ inputs.catalyst-version }}" \ + --pennylane-version "${{ inputs.pennylane-version }}" \ + --extra-index-url "${{ inputs.extra-index-url }}" \ + --testpypi "${{ inputs.testpypi }}" + --prerelease-packages "${{ inputs.prerelease-packages }}" - name: Upload artifacts id: upload-artifacts diff --git a/.github/workflows/v2-build-rc-demos-daily.yml b/.github/workflows/v2-build-rc-demos-daily.yml index ae0c17e3e4..a8d4becd26 100644 --- a/.github/workflows/v2-build-rc-demos-daily.yml +++ b/.github/workflows/v2-build-rc-demos-daily.yml @@ -76,30 +76,36 @@ jobs: echo "rc-build-branch=$rc_build_branch" >> $GITHUB_OUTPUT echo "PennyLane version: $pennylane_version, PennyLane-Lightning version: $lightning_version, PennyLane-Catalyst version: $catalyst_version" - - name: Update demo versions - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - sed -i -E "s#git\+https://github.com/PennyLaneAI/pennylane.git\#egg=pennylane\",#pennylane<=${{ steps.setup-rc-versions.outputs.pennylane-version }}\",\\n\\t\\t\\t\"—extra-index-url\",\\n\\t\\t\\t\"https://test.pypi.org/simple/\",\\n\\t\\t\\tpre=True,#" lib/qml/lib/demo.py - sed -i "s/PennyLane-Lightning/pennylane-lightning<=${{ steps.setup-rc-versions.outputs.lightning-version }}/" lib/qml/lib/demo.py - sed -i "s/PennyLane-Catalyst/pennylane-catalyst<=${{ steps.setup-rc-versions.outputs.catalyst-version }}/" lib/qml/lib/demo.py - git commit -am "Set up RC versions for demo builds" - git push --set-upstream origin ${{ steps.setup-rc-versions.outputs.rc-build-branch }} + # - name: Update demo versions + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # run: | + # sed -i -E "s#git\+https://github.com/PennyLaneAI/pennylane.git\#egg=pennylane\",#pennylane<=${{ steps.setup-rc-versions.outputs.pennylane-version }}\",\\n\\t\\t\\t\"—extra-index-url\",\\n\\t\\t\\t\"https://test.pypi.org/simple/\",\\n\\t\\t\\tpre=True,#" lib/qml/lib/demo.py + # sed -i "s/PennyLane-Lightning/pennylane-lightning<=${{ steps.setup-rc-versions.outputs.lightning-version }}/" lib/qml/lib/demo.py + # sed -i "s/PennyLane-Catalyst/pennylane-catalyst<=${{ steps.setup-rc-versions.outputs.catalyst-version }}/" lib/qml/lib/demo.py + # git commit -am "Set up RC versions for demo builds" + # git push --set-upstream origin ${{ steps.setup-rc-versions.outputs.rc-build-branch }} build-demos: needs: build-demos-with-rc-branches uses: ./.github/workflows/v2-build-demos.yml with: - ref: '${{ needs.build-demos-with-rc-branches.outputs.rc-build-branch }}' + ref: sc-101692-dailyrcbuild #'${{ needs.build-demos-with-rc-branches.outputs.rc-build-branch }}' demo-names: '' execute: true - dev: false + dev: true save-artifact: true artifact-name: 'demo-build-use-rc' artifact-retention: 10 keep-going: false quiet: false batch_size: 10 + pennylane-version: '${{ needs.build-demos-with-rc-branches.outputs.pennylane-version }}' + lightning-version: '${{ needs.build-demos-with-rc-branches.outputs.lightning-version }}' + catalyst-version: '${{ needs.build-demos-with-rc-branches.outputs.catalyst-version }}' + extra-index-url: 'https://test.pypi.org/simple/' + testpypi: true + prerelease-packages: true cleanup: runs-on: ubuntu-latest diff --git a/lib/qml/app/app.py b/lib/qml/app/app.py index d8e474086a..8d99a1c4d9 100644 --- a/lib/qml/app/app.py +++ b/lib/qml/app/app.py @@ -55,6 +55,24 @@ def build( bool, typer.Option(help="Continue if sphinx-build fails for a demo") ] = False, dev: Annotated[bool, typer.Option(help="Whether to use dev dependencies")] = False, + lightning_version: Annotated[ + Optional[str], typer.Option(help="Version of Lightning to use") + ] = "PennyLane-Lightning", + catalyst_version: Annotated[ + Optional[str], typer.Option(help="Version of Catalyst to use") + ] = "PennyLane-Catalyst", + pennylane_version: Annotated[ + Optional[str], typer.Option(help="Version of PennyLane to use") + ] = "git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane", + extra_index_url: Annotated[ + Optional[str], typer.Option(help="Extra PyPI index URL for dependencies") + ] = "", + testpypi: Annotated[ + Optional[str], typer.Option(help="TestPyPI URL for dependencies") + ] = "", + prerelease_packages: Annotated[ + bool, typer.Option(help="Allow installation of pre-release packages") + ] = False, ) -> None: """ Build the named demos. @@ -96,6 +114,10 @@ def build( logger.error(f"Failed to copy static files: {e}") raise typer.Exit(1) + final_pennylane_version = pennylane_version or "pennylane" + final_catalyst_version = catalyst_version or "pennylane-catalyst" + final_lightning_version = lightning_version or "pennylane-lightning" + demo.build( ctx, demos=demos, @@ -104,6 +126,12 @@ def build( quiet=quiet, keep_going=keep_going, dev=dev, + catalyst_version=final_catalyst_version, + pennylane_version=final_pennylane_version, + lightning_version=final_lightning_version, + # extra_index_url=extra_index_url, + # testpypi=testpypi, + # prerelease_packages=prerelease_packages, ) except Exception as e: diff --git a/lib/qml/lib/demo.py b/lib/qml/lib/demo.py index 350b1351aa..0beba508f7 100644 --- a/lib/qml/lib/demo.py +++ b/lib/qml/lib/demo.py @@ -20,52 +20,6 @@ logger = getLogger("qml") -def parse_extra_args(): - parser = argparse.ArgumentParser() - parser.add_argument( - "--lightning-version", - type=str, - default="PennyLane-Lightning", - help="Specify the version of PennyLane-Lightning to install (default: PennyLane-Lightning)", - nargs='?' - ) - parser.add_argument( - "--catalyst-version", - type=str, - default="PennyLane-Catalyst", - help="Specify the version of PennyLane-Catalyst to install (default: PennyLane-Catalyst)", - nargs='?' - ) - parser.add_argument( - "--pennylane-version", - type=str, - default="git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane", - help="Specify the version of PennyLane to install (default: git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane)", - nargs='?' - ) - parser.add_argument( - "--extra-index-url", - type=str, - default=None, - help="Specify an additional index URL for pip to use (default: None)", - nargs='?' - ) - parser.add_argument( - "--testpypi", - type=str, - default=None, - help="Use TestPyPI as an additional package index (default: False)", - nargs='?' - ) - parser.add_argument( - "--prerelease-packages", - type=bool, - default=False, - help="Allow installation of pre-release packages (default: False)", - nargs='?' - ) - return parser.parse_args() - class BuildTarget(Enum): """Sphinx-build targets.""" @@ -198,6 +152,12 @@ def build( quiet: bool = False, keep_going: bool = False, dev: bool = False, + lightning_version: str = "PennyLane-Lightning", + catalyst_version: str = "PennyLane-Catalyst", + pennylane_version: str = "git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane", + extra_index_url: str = None, + testpypi: str = None, + prerelease_packages: bool = False, ) -> None: """Build the provided demos using 'sphinx-build', optionally executing them to generate plots and cell outputs. @@ -235,6 +195,7 @@ def build( ) try: + logger.info("lightning_version:- ", lightning_version) _build_demo( ctx, build_venv=build_venv, @@ -244,6 +205,12 @@ def build( package=target is BuildTarget.JSON, quiet=quiet, dev=dev, + lightning_version=lightning_version, + catalyst_version=catalyst_version, + pennylane_version=pennylane_version, + extra_index_url=extra_index_url, + testpypi=testpypi, + prerelease_packages=prerelease_packages, ) except subprocess.CalledProcessError as exc: if not keep_going: @@ -288,9 +255,10 @@ def build( def generate_requirements( - ctx: Context, demo: Demo, dev: bool, output_file: Path + ctx: Context, demo: Demo, dev: bool, output_file: Path, pennylane_version: str, catalyst_version: str, lightning_version: str, ) -> None: constraints = [ctx.build_requirements_file] + if dev: constraints.append(ctx.dev_constraints_file) else: @@ -306,7 +274,7 @@ def generate_requirements( *requirements_in, constraints_files=constraints, quiet=False, - prerelease=dev, + prerelease=dev, ) @@ -319,11 +287,17 @@ def _build_demo( package: bool, quiet: bool, dev: bool, + lightning_version: str, + catalyst_version: str, + pennylane_version: str, + extra_index_url: str, + testpypi: str, + prerelease_packages: bool, ): out_dir = ctx.repo_root / "demos" fs.clean_dir(out_dir) - generate_requirements(ctx, demo, dev, out_dir / "requirements.txt") + generate_requirements(ctx, demo, dev, out_dir / "requirements.txt", pennylane_version, catalyst_version, lightning_version) if execute: cmds.pip_install( build_venv.python, @@ -332,17 +306,20 @@ def _build_demo( quiet=False, pre=dev, ) - + logger.info("lightning_version inside _build_demo:- ", lightning_version) # If dev, we need to re-install the latest Catalyst, then Lightning, then PennyLane # in that order, regardless of conflicts/warnings. if dev: # Catalyst + logger.info("lightning_version inside dev:-", lightning_version) cmds.pip_install( build_venv.python, "--upgrade", "--extra-index-url", "https://test.pypi.org/simple/", - parse_extra_args().catalyst_version, + "sphinx==8.1", + # catalyst_version, + "pennylane-catalyst<=0.13.0", use_uv=False, quiet=False, pre=True, @@ -353,7 +330,8 @@ def _build_demo( "--upgrade", "--extra-index-url", "https://test.pypi.org/simple/", - parse_extra_args().lightning_version, + # lightning_version, + "pennylane-lightning<=0.43.0", use_uv=False, quiet=False, pre=True, @@ -363,12 +341,16 @@ def _build_demo( cmds.pip_install( build_venv.python, "--upgrade", - parse_extra_args().pennylane_version, - parse_extra_args().testpypi, - parse_extra_args().extra_index_url, + "sphinx==8.1", + # "pennylane<=0.43.0", + "--extra-index-url", + "https://test.pypi.org/simple/", + "pennylane<=0.43.0", + # testpypi, + # extra_index_url, use_uv=False, quiet=False, - pre=parse_extra_args().prerelease_packages, + pre=True, ) stage_dir = ctx.build_dir / "demonstrations" From 7e13ac2aeb3def995081fa66eb16582902cadd17 Mon Sep 17 00:00:00 2001 From: runora95 Date: Wed, 19 Nov 2025 09:45:40 -0500 Subject: [PATCH 08/15] rmv some inputs --- .github/workflows/v2-build-demos.yml | 30 ---------------------------- 1 file changed, 30 deletions(-) diff --git a/.github/workflows/v2-build-demos.yml b/.github/workflows/v2-build-demos.yml index 441ba0e1a4..71c7754bd9 100644 --- a/.github/workflows/v2-build-demos.yml +++ b/.github/workflows/v2-build-demos.yml @@ -140,36 +140,6 @@ on: description: Number of demos to build per job. type: number default: 10 - lightning-version: - description: Specify the version of PennyLane-Lightning to install (default PennyLane-Lightning). - required: false - type: string - default: "PennyLane-Lightning" - catalyst-version: - description: Specify the version of PennyLane-Catalyst to install (default PennyLane-Catalyst). - required: false - type: string - default: "PennyLane-Catalyst" - pennylane-version: - description: Specify the version of PennyLane to install (default git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane). - required: false - type: string - default: "git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane" - extra-index-url: - description: Specify an additional index URL for pip to use (default None). - required: false - type: string - default: null - testpypi: - description: Use TestPyPI as an additional package index (default None). - required: false - type: string - default: null - prerelease-packages: - description: Allow installation of pre-release packages (default False). - required: false - type: boolean - default: false jobs: generate-build-variables: From 2a8fdcf20e50e325e86223c878e1530763324645 Mon Sep 17 00:00:00 2001 From: runora95 Date: Wed, 19 Nov 2025 09:52:18 -0500 Subject: [PATCH 09/15] add pre back --- lib/qml/app/app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/qml/app/app.py b/lib/qml/app/app.py index 8d99a1c4d9..61e96b1157 100644 --- a/lib/qml/app/app.py +++ b/lib/qml/app/app.py @@ -129,9 +129,9 @@ def build( catalyst_version=final_catalyst_version, pennylane_version=final_pennylane_version, lightning_version=final_lightning_version, - # extra_index_url=extra_index_url, - # testpypi=testpypi, - # prerelease_packages=prerelease_packages, + extra_index_url=extra_index_url, + testpypi=testpypi, + prerelease_packages=prerelease_packages, ) except Exception as e: From 30ebd6cfc70f761b35d6f8bb8cddcf3faffb7f99 Mon Sep 17 00:00:00 2001 From: runora95 Date: Wed, 19 Nov 2025 10:01:57 -0500 Subject: [PATCH 10/15] qiskit --- dependencies/constraints-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/constraints-dev.txt b/dependencies/constraints-dev.txt index af83a93d0b..d3ce857623 100644 --- a/dependencies/constraints-dev.txt +++ b/dependencies/constraints-dev.txt @@ -27,7 +27,7 @@ openfermionpyscf==0.5 openqaoa-core==0.2.5 qiskit>=2.0 qiskit-aer>=0.17 -qiskit_ibm_runtime==0.41.1 +qiskit_ibm_runtime>=0.41.1 torch==2.1.2+cpu ; sys_platform != 'darwin' torch==2.1.2 ; sys_platform == 'darwin' torchvision==0.16.2+cpu ; sys_platform != 'darwin' From 2fff40de48b67e58678c82acffc1fe4ec18bb3bd Mon Sep 17 00:00:00 2001 From: runora95 Date: Wed, 19 Nov 2025 10:17:28 -0500 Subject: [PATCH 11/15] use variables --- lib/qml/lib/demo.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/qml/lib/demo.py b/lib/qml/lib/demo.py index 0beba508f7..e6997bedfe 100644 --- a/lib/qml/lib/demo.py +++ b/lib/qml/lib/demo.py @@ -318,8 +318,7 @@ def _build_demo( "--extra-index-url", "https://test.pypi.org/simple/", "sphinx==8.1", - # catalyst_version, - "pennylane-catalyst<=0.13.0", + catalyst_version, use_uv=False, quiet=False, pre=True, @@ -330,8 +329,7 @@ def _build_demo( "--upgrade", "--extra-index-url", "https://test.pypi.org/simple/", - # lightning_version, - "pennylane-lightning<=0.43.0", + lightning_version, use_uv=False, quiet=False, pre=True, @@ -342,12 +340,11 @@ def _build_demo( build_venv.python, "--upgrade", "sphinx==8.1", - # "pennylane<=0.43.0", "--extra-index-url", "https://test.pypi.org/simple/", - "pennylane<=0.43.0", - # testpypi, - # extra_index_url, + pennylane_version, + testpypi, + extra_index_url, use_uv=False, quiet=False, pre=True, From 2fc73cc4d9c999f770058d65cdb09ef8572ffeb1 Mon Sep 17 00:00:00 2001 From: runora95 Date: Wed, 19 Nov 2025 10:29:47 -0500 Subject: [PATCH 12/15] fix typo in inputs --- .github/workflows/v2-build-rc-demos-daily.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/v2-build-rc-demos-daily.yml b/.github/workflows/v2-build-rc-demos-daily.yml index a8d4becd26..995344bcdd 100644 --- a/.github/workflows/v2-build-rc-demos-daily.yml +++ b/.github/workflows/v2-build-rc-demos-daily.yml @@ -100,9 +100,9 @@ jobs: keep-going: false quiet: false batch_size: 10 - pennylane-version: '${{ needs.build-demos-with-rc-branches.outputs.pennylane-version }}' - lightning-version: '${{ needs.build-demos-with-rc-branches.outputs.lightning-version }}' - catalyst-version: '${{ needs.build-demos-with-rc-branches.outputs.catalyst-version }}' + pennylane-version: 'pennylane<=${{ needs.build-demos-with-rc-branches.outputs.pennylane-version }}' + lightning-version: 'pennylane-lightning<=${{ needs.build-demos-with-rc-branches.outputs.lightning-version }}' + catalyst-version: 'pennylane-catalyst<=${{ needs.build-demos-with-rc-branches.outputs.catalyst-version }}' extra-index-url: 'https://test.pypi.org/simple/' testpypi: true prerelease-packages: true From 69e5f62ded87d5309706bdfa6f147572290186a9 Mon Sep 17 00:00:00 2001 From: runora95 Date: Wed, 19 Nov 2025 10:44:51 -0500 Subject: [PATCH 13/15] rmv extra ind url --- lib/qml/lib/demo.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/qml/lib/demo.py b/lib/qml/lib/demo.py index e6997bedfe..f6b283bb16 100644 --- a/lib/qml/lib/demo.py +++ b/lib/qml/lib/demo.py @@ -343,8 +343,6 @@ def _build_demo( "--extra-index-url", "https://test.pypi.org/simple/", pennylane_version, - testpypi, - extra_index_url, use_uv=False, quiet=False, pre=True, From 6d8aed6b2033acded1187afbbae53e22fe51f6b0 Mon Sep 17 00:00:00 2001 From: runora95 Date: Wed, 19 Nov 2025 11:50:57 -0500 Subject: [PATCH 14/15] rmv extra args --- lib/qml/app/app.py | 12 ------------ lib/qml/lib/demo.py | 15 +++------------ 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/lib/qml/app/app.py b/lib/qml/app/app.py index 61e96b1157..48a5a0e3ad 100644 --- a/lib/qml/app/app.py +++ b/lib/qml/app/app.py @@ -64,15 +64,6 @@ def build( pennylane_version: Annotated[ Optional[str], typer.Option(help="Version of PennyLane to use") ] = "git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane", - extra_index_url: Annotated[ - Optional[str], typer.Option(help="Extra PyPI index URL for dependencies") - ] = "", - testpypi: Annotated[ - Optional[str], typer.Option(help="TestPyPI URL for dependencies") - ] = "", - prerelease_packages: Annotated[ - bool, typer.Option(help="Allow installation of pre-release packages") - ] = False, ) -> None: """ Build the named demos. @@ -129,9 +120,6 @@ def build( catalyst_version=final_catalyst_version, pennylane_version=final_pennylane_version, lightning_version=final_lightning_version, - extra_index_url=extra_index_url, - testpypi=testpypi, - prerelease_packages=prerelease_packages, ) except Exception as e: diff --git a/lib/qml/lib/demo.py b/lib/qml/lib/demo.py index f6b283bb16..7acd8cb56f 100644 --- a/lib/qml/lib/demo.py +++ b/lib/qml/lib/demo.py @@ -154,10 +154,7 @@ def build( dev: bool = False, lightning_version: str = "PennyLane-Lightning", catalyst_version: str = "PennyLane-Catalyst", - pennylane_version: str = "git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane", - extra_index_url: str = None, - testpypi: str = None, - prerelease_packages: bool = False, + pennylane_version: str = "git+https://github.com/PennyLaneAI/pennylane.git#egg=pennylane", ) -> None: """Build the provided demos using 'sphinx-build', optionally executing them to generate plots and cell outputs. @@ -207,10 +204,7 @@ def build( dev=dev, lightning_version=lightning_version, catalyst_version=catalyst_version, - pennylane_version=pennylane_version, - extra_index_url=extra_index_url, - testpypi=testpypi, - prerelease_packages=prerelease_packages, + pennylane_version=pennylane_version, ) except subprocess.CalledProcessError as exc: if not keep_going: @@ -289,10 +283,7 @@ def _build_demo( dev: bool, lightning_version: str, catalyst_version: str, - pennylane_version: str, - extra_index_url: str, - testpypi: str, - prerelease_packages: bool, + pennylane_version: str, ): out_dir = ctx.repo_root / "demos" fs.clean_dir(out_dir) From ba0d9fc47fe7f4445897d3a6240e631c7ad5cbdc Mon Sep 17 00:00:00 2001 From: runora95 Date: Wed, 19 Nov 2025 11:54:40 -0500 Subject: [PATCH 15/15] rmv extra args --- .github/workflows/v2-build-demos.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/v2-build-demos.yml b/.github/workflows/v2-build-demos.yml index 39b31bcee5..8bba8a7116 100644 --- a/.github/workflows/v2-build-demos.yml +++ b/.github/workflows/v2-build-demos.yml @@ -228,11 +228,8 @@ jobs: ${{ inputs.dev && '--dev' || '--no-dev' }} \ --lightning-version "${{ inputs.lightning-version }}" \ --catalyst-version "${{ inputs.catalyst-version }}" \ - --pennylane-version "${{ inputs.pennylane-version }}" \ - --extra-index-url "${{ inputs.extra-index-url }}" \ - --testpypi "${{ inputs.testpypi }}" - --prerelease-packages "${{ inputs.prerelease-packages }}" - + --pennylane-version "${{ inputs.pennylane-version }}" + - name: Upload artifacts id: upload-artifacts if: ${{ inputs.save-artifact }}