From de1dc09cd9fc315c4f796e4aca219528ef0bfa2b Mon Sep 17 00:00:00 2001 From: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com> Date: Mon, 12 Aug 2024 17:41:25 -0400 Subject: [PATCH] Update Lightning packaging to follow the PEP 517/518/621/660 standards (#832) **Context:** This PR updates the Lightning Python packaging to the latest standard. This allows us to eliminate pip~=22.0 from requirements*.txt, comply with up-to-date build practices, and fix the inability to build Lightning in place on newer Python environments. **Description of the Change:** Most of the building configuration was moved to the ``pyproject.toml`` file. We kept the ``setup.py`` file working with setuptools in part of the configuration pre-processing. A script with some pre-pre-processing was added to configure the ``pyproject.toml`` file for each backend. **Benefits:** Follow the new standard. Allows the use of more up-to-date pip versions. There will be no impact on the final user, as the installation of the wheels is unaffected by the change in packaging. **Possible Drawbacks:** When building and installing Lightning backends from scratch, we need to run the configuration script. If not the installation will default to ``lightning.qubit``, or the last configuration. **Related GitHub Issues:** [sc-65227] --------- Co-authored-by: ringo-but-quantum Co-authored-by: Lee James O'Riordan Co-authored-by: Vincent Michaud-Rioux --- .github/CHANGELOG.md | 5 +- .github/workflows/format.yml | 2 +- .github/workflows/tests_lgpu_python.yml | 11 +- .github/workflows/tests_lgpumpi_python.yml | 6 +- .github/workflows/tests_lkcpu_python.yml | 8 +- .github/workflows/tests_lkcuda_python.yml | 17 ++- .../workflows/tests_lmps_tncuda_python.yml | 38 +++---- .github/workflows/tests_lqcpu_python.yml | 5 +- .github/workflows/tests_windows_cpp.yml | 2 +- .github/workflows/tests_without_binary.yml | 29 ++--- .github/workflows/wheel_linux_aarch64.yml | 15 ++- .github/workflows/wheel_linux_ppc64le.yml | 9 +- .github/workflows/wheel_linux_x86_64.yml | 23 ++-- .github/workflows/wheel_linux_x86_64_cuda.yml | 18 ++-- .github/workflows/wheel_macos_arm64.yml | 17 +-- .github/workflows/wheel_macos_x86_64.yml | 13 ++- .github/workflows/wheel_noarch.yml | 43 ++++---- .github/workflows/wheel_win_x86_64.yml | 13 ++- .gitignore | 1 + .readthedocs.yml | 10 +- CMakeLists.txt | 8 +- MANIFEST.in | 4 + Makefile | 15 ++- README.rst | 44 ++++---- docker/Dockerfile | 21 ++-- pennylane_lightning/core/__init__.py | 2 +- pennylane_lightning/core/_version.py | 2 +- pennylane_lightning/lightning_gpu/__init__.py | 2 +- .../lightning_kokkos/__init__.py | 2 +- .../lightning_qubit/__init__.py | 2 +- pyproject.toml | 28 +++++ requirements-dev.txt | 2 +- scripts/backend_support.py | 56 ++++++++++ scripts/configure_pyproject_toml.py | 99 +++++++++++++++++ scripts/gen_pyver_matrix.py | 4 +- setup.py | 101 ++---------------- 36 files changed, 402 insertions(+), 275 deletions(-) create mode 100644 pyproject.toml create mode 100755 scripts/backend_support.py create mode 100755 scripts/configure_pyproject_toml.py mode change 100644 => 100755 scripts/gen_pyver_matrix.py diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 45a716643..9657e8129 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -3,7 +3,7 @@ ### New features since last release * Add `var` support to `lightning.tensor`. Note that `var` support is added via `obs**2` and this implementation scales `O(num_obs**2)`. - [(#804)](https://github.com/PennyLaneAI/pennylane-lightning/pull/804) + [(#804)](https://github.com/PennyLaneAI/pennylane-lightning/pull/804) ### Breaking changes @@ -16,6 +16,9 @@ * Do not run GPU tests and Docker workflows on release. [(#788)](https://github.com/PennyLaneAI/pennylane-lightning/pull/788) +* Update python packaging to follow PEP 517/518/621/660 standards. + [(#832)](https://github.com/PennyLaneAI/pennylane-lightning/pull/832) + ### Improvements * `ENABLE_LAPACK` is off by default for all Lightning backends. diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index bc29a7dfb..2fd60dda5 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -38,7 +38,7 @@ jobs: uses: actions/checkout@v4 - name: Install dependencies - run: sudo apt update && sudo apt -y install python3 python3-pip && python -m pip install pip~=22.0 && python3 -m pip install -r requirements-dev.txt + run: sudo apt update && sudo apt -y install python3 python3-pip python-is-python3 && python -m pip install -r requirements-dev.txt - name: Run formatter run: PATH=$PATH:/home/ubuntu/.local/bin/:$(dirname $(which python3))/ ./bin/format --check ./pennylane_lightning/core/src diff --git a/.github/workflows/tests_lgpu_python.yml b/.github/workflows/tests_lgpu_python.yml index 51f02859b..12b61392a 100644 --- a/.github/workflows/tests_lgpu_python.yml +++ b/.github/workflows/tests_lgpu_python.yml @@ -64,7 +64,6 @@ jobs: strategy: matrix: pl_backend: ["lightning_gpu"] - default_backend: ["lightning_qubit"] cuda_version: ["12"] name: Python Tests (${{ matrix.pl_backend }}, cuda-${{ matrix.cuda_version }}) @@ -129,8 +128,7 @@ jobs: echo "venv_name=${{ env.VENV_NAME }}" >> $GITHUB_OUTPUT echo "Python_ROOT_DIR=${{ env.VENV_NAME }}" >> $GITHUB_ENV echo "Python3_ROOT_DIR=${{ env.VENV_NAME }}" >> $GITHUB_ENV - - + # Adding venv site-packages to output for subsequent step to referecen if needed echo "site_packages_dir=$(${{ env.VENV_NAME }}/bin/python -c 'import sysconfig; print(sysconfig.get_path("platlib"))')" >> $GITHUB_OUTPUT @@ -179,12 +177,13 @@ jobs: run: | cd main rm -rf build - CMAKE_ARGS="-DPL_BACKEND=${{ matrix.default_backend }} -DENABLE_PYTHON=ON -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" \ + PL_BACKEND=lightning_qubit python scripts/configure_pyproject_toml.py + CMAKE_ARGS="-DENABLE_PYTHON=ON -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" \ python -m pip install . -vv - rm -rf build rm -rf build - CMAKE_ARGS="-DPL_BACKEND=${{ matrix.pl_backend }} -DENABLE_PYTHON=ON -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION) -DPython_EXECUTABLE=${{ steps.python_path.outputs.python }}" \ + PL_BACKEND=${{ matrix.pl_backend }} python scripts/configure_pyproject_toml.py + CMAKE_ARGS="-DENABLE_PYTHON=ON -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION) -DPython_EXECUTABLE=${{ steps.python_path.outputs.python }}" \ python -m pip install . -vv - name: Run PennyLane-Lightning-GPU unit tests diff --git a/.github/workflows/tests_lgpumpi_python.yml b/.github/workflows/tests_lgpumpi_python.yml index 9a27030a0..ab2eda478 100644 --- a/.github/workflows/tests_lgpumpi_python.yml +++ b/.github/workflows/tests_lgpumpi_python.yml @@ -110,7 +110,8 @@ jobs: python -m pip install -r requirements-dev.txt python -m pip install custatevec-cu${{ matrix.cuda_version_maj }} mpi4py openfermionpyscf - PL_BACKEND=lightning_qubit python -m pip install . -vv + PL_BACKEND=lightning_qubit python scripts/configure_pyproject_toml.py + python -m pip install . -vv - name: Checkout PennyLane for release build if: inputs.pennylane-version == 'release' @@ -132,8 +133,9 @@ jobs: CUQUANTUM_SDK: $(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum')") run: | source /etc/profile.d/modules.sh && module use /opt/modules/ && module load ${{ matrix.mpilib }}/cuda-${{ matrix.cuda_version_maj }}.${{ matrix.cuda_version_min }} + PL_BACKEND=lightning_gpu python scripts/configure_pyproject_toml.py CMAKE_ARGS="-DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx -DENABLE_MPI=ON -DCMAKE_CUDA_COMPILER=$(which nvcc) -DCMAKE_CUDA_ARCHITECTURES=${{ env.CI_CUDA_ARCH }} -DPython_EXECUTABLE=${{ steps.python_path.outputs.python }}" \ - PL_BACKEND=lightning_gpu python -m pip install . --verbose + python -m pip install . -vv # There are issues running py-cov with MPI. A solution is to use coverage as reported # [here](https://github.com/pytest-dev/pytest-cov/issues/237#issuecomment-544824228) diff --git a/.github/workflows/tests_lkcpu_python.yml b/.github/workflows/tests_lkcpu_python.yml index 1dbad0070..b7d674311 100644 --- a/.github/workflows/tests_lkcpu_python.yml +++ b/.github/workflows/tests_lkcpu_python.yml @@ -117,13 +117,14 @@ jobs: cd main python -m pip install -r requirements-dev.txt - - name: Create device wheel + - name: Configure and build device wheel env: PL_BACKEND: ${{ matrix.pl_backend }} run: | cd main - python setup.py build_ext -i --define="PL_BACKEND=${{ matrix.pl_backend }};CMAKE_PREFIX_PATH=${{ github.workspace }}/Kokkos;ENABLE_PYTHON=ON;CMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" - python setup.py bdist_wheel + python scripts/configure_pyproject_toml.py + CMAKE_ARGS="-DCMAKE_PREFIX_PATH=${{ github.workspace }}/Kokkos -DENABLE_PYTHON=ON -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" \ + python -m build cd dist WHEEL_NAME=$(ls *.whl) cp $WHEEL_NAME ${{ github.workspace }}/wheel_${{ matrix.pl_backend }}-${{ matrix.exec_model }}.whl @@ -211,6 +212,7 @@ jobs: python -m pip install -r requirements-dev.txt python -m pip install openfermionpyscf if [ '${{ inputs.lightning-version }}' != 'stable' ]; then + python scripts/configure_pyproject_toml.py SKIP_COMPILATION=True python -m pip install . -vv fi python -m pip install ${{ github.workspace }}/$WHEEL_NAME --no-deps diff --git a/.github/workflows/tests_lkcuda_python.yml b/.github/workflows/tests_lkcuda_python.yml index 45b012175..ac0646898 100644 --- a/.github/workflows/tests_lkcuda_python.yml +++ b/.github/workflows/tests_lkcuda_python.yml @@ -241,8 +241,12 @@ jobs: run: | ls -l ${{ github.workspace }}/Kokkos cd main - SKIP_COMPILATION=True PL_BACKEND="lightning_qubit" python -m pip install . -vv - CMAKE_ARGS="-DPL_BACKEND=${{ matrix.pl_backend }} -DCMAKE_PREFIX_PATH=${{ github.workspace }}/Kokkos -DENABLE_PYTHON=ON -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" \ + + PL_BACKEND=lightning_qubit python scripts/configure_pyproject_toml.py + SKIP_COMPILATION=True python -m pip install . -vv + + PL_BACKEND=${{ matrix.pl_backend }} python scripts/configure_pyproject_toml.py + CMAKE_ARGS="-DCMAKE_PREFIX_PATH=${{ github.workspace }}/Kokkos -DENABLE_PYTHON=ON -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" \ python -m pip install . -vv - name: Run PennyLane-Lightning unit tests @@ -262,10 +266,13 @@ jobs: if: ${{ matrix.pl_backend == 'all' }} run: | cd main - CMAKE_ARGS="-DPL_BACKEND="lightning_qubit" -DCMAKE_PREFIX_PATH=${{ github.workspace }}/Kokkos -DENABLE_PYTHON=ON -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" \ + + PL_BACKEND=lightning_qubit python scripts/configure_pyproject_toml.py + CMAKE_ARGS="-DENABLE_PYTHON=ON -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" \ python -m pip install . -vv - rm -rf build - CMAKE_ARGS="-DPL_BACKEND="lightning_kokkos" -DCMAKE_PREFIX_PATH=${{ github.workspace }}/Kokkos -DENABLE_PYTHON=ON -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" \ + + PL_BACKEND="lightning_kokkos" python scripts/configure_pyproject_toml.py + CMAKE_ARGS="-DCMAKE_PREFIX_PATH=${{ github.workspace }}/Kokkos -DENABLE_PYTHON=ON -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" \ python -m pip install . -vv - name: Run PennyLane-Lightning unit tests for lightning.qubit with all devices installed diff --git a/.github/workflows/tests_lmps_tncuda_python.yml b/.github/workflows/tests_lmps_tncuda_python.yml index 1bfec32e0..d10eb0254 100644 --- a/.github/workflows/tests_lmps_tncuda_python.yml +++ b/.github/workflows/tests_lmps_tncuda_python.yml @@ -60,7 +60,7 @@ jobs: echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV nvcc --version nvidia-smi - + pythontestswithMPSTNCuda: if: ${{ !contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }} needs: [builddeps] @@ -68,12 +68,11 @@ jobs: matrix: os: [ubuntu-22.04] pl_backend: ["lightning_tensor"] - default_backend: ["lightning_qubit"] pl_tensor_method: ["mps"] pl_tensor_backend: ["cutensornet"] cuda_version: ["12"] - name: Python Tests (${{ matrix.pl_backend }}, method-${{ matrix.pl_tensor_method }}, backend-${{ matrix.pl_tensor_backend }}, cuda-${{ matrix.cuda_version }}) + name: Python Tests (${{ matrix.pl_backend }}, method-${{ matrix.pl_tensor_method }}, backend-${{ matrix.pl_tensor_backend }}, cuda-${{ matrix.cuda_version }}) runs-on: - ${{ matrix.os }} - self-hosted @@ -92,14 +91,12 @@ jobs: - name: Checkout PennyLane-Lightning-Tensor-MPS-TNCuda uses: actions/checkout@v4 - with: - path: main - uses: actions/setup-python@v5 name: Install Python with: python-version: '3.9' - + # Since the self-hosted runner can be re-used. It is best to set up all package # installations in a virtual environment that gets cleaned at the end of each workflow run - name: Setup Python virtual environment @@ -116,13 +113,13 @@ jobs: # Add the venv to PATH for subsequent steps echo ${{ env.VENV_NAME }}/bin >> $GITHUB_PATH - + # Adding venv name as an output for subsequent steps to reference if needed source ${{ env.VENV_NAME }}/bin/activate echo "venv_name=${{ env.VENV_NAME }}" >> $GITHUB_OUTPUT echo "Python_ROOT_DIR=${{ env.VENV_NAME }}" >> $GITHUB_ENV echo "Python3_ROOT_DIR=${{ env.VENV_NAME }}" >> $GITHUB_ENV - + # Adding venv site-packages to output for subsequent step to referecen if needed echo "site_packages_dir=$(${{ env.VENV_NAME }}/bin/python -c 'import sysconfig; print(sysconfig.get_path("platlib"))')" >> $GITHUB_OUTPUT @@ -139,7 +136,6 @@ jobs: - name: Install required packages run: | - cd main python -m pip install -r requirements-dev.txt python -m pip install ninja cmake scipy custatevec-cu${{ matrix.cuda_version }} cutensornet-cu${{ matrix.cuda_version }} openfermionpyscf @@ -157,29 +153,25 @@ jobs: git fetch --all git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) python -m pip uninstall -y pennylane && python -m pip install . -vv --no-deps - + - name: Install Stable PennyLane if: inputs.pennylane-version == 'stable' run: | - cd main python -m pip uninstall -y pennylane && python -m pip install -U pennylane - - - name: Build and install package + + - name: Configure and install required backends run: | - cd main - rm -rf build - CMAKE_ARGS="-DPL_BACKEND=${{ matrix.default_backend }} -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" \ - python -m pip install . -vv rm -rf build - + PL_BACKEND=lightning_qubit python scripts/configure_pyproject_toml.py + CMAKE_ARGS="-DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" python -m pip install . -vv + rm -rf build - CMAKE_ARGS="-DPL_BACKEND=${{ matrix.pl_backend }} -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" \ - python -m pip install . -vv - + PL_BACKEND="${{ matrix.pl_backend }}" python scripts/configure_pyproject_toml.py + CMAKE_ARGS="-DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" python -m pip install . -vv + - name: Run PennyLane-Lightning-Tensor unit tests if: ${{ matrix.pl_backend != 'all'}} run: | - cd main/ DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"` PL_DEVICE=${DEVICENAME} python -m pytest tests $COVERAGE_FLAGS mv coverage.xml coverage-${{ github.job }}-${{ matrix.pl_backend }}.xml @@ -188,7 +180,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: ubuntu-codecov-results-python - path: ./main/coverage-${{ github.job }}-${{ matrix.pl_backend }}.xml + path: coverage-${{ github.job }}-${{ matrix.pl_backend }}.xml if-no-files-found: error diff --git a/.github/workflows/tests_lqcpu_python.yml b/.github/workflows/tests_lqcpu_python.yml index 80a9827f7..84307cbaa 100644 --- a/.github/workflows/tests_lqcpu_python.yml +++ b/.github/workflows/tests_lqcpu_python.yml @@ -86,8 +86,9 @@ jobs: id: create_lq_wheel run: | cd main - python setup.py build_ext -i --define="PL_BACKEND=${{ matrix.pl_backend }};ENABLE_BLAS=${{ matrix.blas }};LQ_ENABLE_KERNEL_OMP=ON;ENABLE_PYTHON=ON;CMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" - PL_BACKEND=${{ matrix.pl_backend }} python setup.py bdist_wheel + PL_BACKEND=${{ matrix.pl_backend }} python scripts/configure_pyproject_toml.py + CMAKE_ARGS="-DENABLE_BLAS=${{ matrix.blas }} -DLQ_ENABLE_KERNEL_OMP=ON -DENABLE_PYTHON=ON -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" \ + python -m build cd dist WHEEL_NAME=$(ls *.whl) cp $WHEEL_NAME ${{ github.workspace }}/wheel_${{ matrix.pl_backend }}-${{ matrix.blas }}.whl diff --git a/.github/workflows/tests_windows_cpp.yml b/.github/workflows/tests_windows_cpp.yml index 1b2e7522a..a35d2f0a4 100644 --- a/.github/workflows/tests_windows_cpp.yml +++ b/.github/workflows/tests_windows_cpp.yml @@ -114,7 +114,7 @@ jobs: python-version: '3.9' - name: Checkout PennyLane-Lightning - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install dependencies run: | diff --git a/.github/workflows/tests_without_binary.yml b/.github/workflows/tests_without_binary.yml index eb2745e6c..64c059bc2 100644 --- a/.github/workflows/tests_without_binary.yml +++ b/.github/workflows/tests_without_binary.yml @@ -46,19 +46,16 @@ jobs: uses: actions/checkout@v4 with: fetch-tags: true - path: main - name: Switch to release build of Lightning if: inputs.lightning-version == 'release' run: | - cd main git fetch --all git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) - name: Switch to stable build of Lightning if: inputs.lightning-version == 'stable' run: | - cd main git fetch --tags --force git checkout latest_release git log -1 --format='%H' @@ -72,7 +69,6 @@ jobs: - name: Get required Python packages run: | rm -fr $(python -m pip cache dir)/selfcheck/ - cd main python -m pip install -r requirements-dev.txt - name: Checkout PennyLane for release build @@ -93,39 +89,34 @@ jobs: - name: Install Stable PennyLane if: inputs.pennylane-version == 'stable' run: | - cd main python -m pip uninstall -y pennylane && python -m pip install -U pennylane - - name: Install the pennylane_lightning package - if: ${{ contains(fromJson('["lightning_kokkos", "lightning_gpu", "lightning_tensor"]'), matrix.pl_backend) }} + - name: Install the pennylane_lightning core package (lightning_qubit) + env: + SKIP_COMPILATION: True + PL_BACKEND: "lightning_qubit" run: | - cd main - SKIP_COMPILATION=True PL_BACKEND="lightning_qubit" python -m pip install . -vv + python scripts/configure_pyproject_toml.py + python -m pip install . -vv - - name: Install backend device - # FIXME: Remove this condition with v0.37.0 release - if: matrix.pl_backend != 'lightning_tensor' || inputs.lightning-version != 'stable' + - name: Install extra backend device + if: matrix.pl_backend != 'lightning_qubit' env: SKIP_COMPILATION: True PL_BACKEND: ${{ matrix.pl_backend }} run: | - cd main + python scripts/configure_pyproject_toml.py python -m pip install . -vv - name: Run PennyLane-Lightning unit tests for all backends - # FIXME: Remove this condition with v0.37.0 release - if: matrix.pl_backend != 'lightning_tensor' || inputs.lightning-version != 'stable' run: | - cd main/ DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"` PL_DEVICE=${DEVICENAME} python -m pytest tests/ $COVERAGE_FLAGS - name: Upload coverage to Codecov - # FIXME: Remove this condition with v0.37.0 release - if: matrix.pl_backend != 'lightning_tensor' || inputs.lightning-version != 'stable' uses: codecov/codecov-action@v4 with: - files: ./main/coverage.xml + files: coverage.xml fail_ci_if_error: true verbose: true token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/wheel_linux_aarch64.yml b/.github/workflows/wheel_linux_aarch64.yml index ec090d9f7..906e1ffc4 100644 --- a/.github/workflows/wheel_linux_aarch64.yml +++ b/.github/workflows/wheel_linux_aarch64.yml @@ -119,8 +119,11 @@ jobs: mkdir Kokkos cp -rf ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }}/* Kokkos/ - - name: Install cibuildwheel - run: python -m pip install cibuildwheel~=2.16.0 + - name: Install dependencies + run: python -m pip install cibuildwheel~=2.16.0 toml + + - name: Configure pyproject.toml file + run: PL_BACKEND="${{ matrix.pl_backend }}" python scripts/configure_pyproject_toml.py - uses: docker/setup-qemu-action@v2 name: Set up QEMU @@ -138,7 +141,7 @@ jobs: cat /etc/yum.conf | sed "s/\[main\]/\[main\]\ntimeout=5/g" > /etc/yum.conf python -m pip install ninja cmake~=3.24.0 - CIBW_ENVIRONMENT: PL_BACKEND="${{ matrix.pl_backend }}" CMAKE_ARGS="-DENABLE_LAPACK=OFF" + CIBW_ENVIRONMENT: CMAKE_ARGS="-DENABLE_LAPACK=OFF" CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28 @@ -146,7 +149,11 @@ jobs: CIBW_BEFORE_TEST: | python -m pip install -r requirements-tests.txt - if ${{ matrix.pl_backend == 'lightning_kokkos'}}; then SKIP_COMPILATION=True PL_BACKEND="lightning_qubit" python -m pip install . -vv; fi + if ${{ matrix.pl_backend == 'lightning_kokkos'}} + then + PL_BACKEND="lightning_qubit" python scripts/configure_pyproject_toml.py + SKIP_COMPILATION=True python -m pip install . -vv + fi CIBW_TEST_COMMAND: | DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"` diff --git a/.github/workflows/wheel_linux_ppc64le.yml b/.github/workflows/wheel_linux_ppc64le.yml index d305e5334..4fd172b22 100644 --- a/.github/workflows/wheel_linux_ppc64le.yml +++ b/.github/workflows/wheel_linux_ppc64le.yml @@ -118,12 +118,15 @@ jobs: mkdir Kokkos cp -rf ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }}/* Kokkos/ - - name: Install cibuildwheel - run: python -m pip install cibuildwheel~=2.16.0 + - name: Install dependencies + run: python -m pip install cibuildwheel~=2.16.0 toml - uses: docker/setup-qemu-action@v2 name: Set up QEMU + - name: Configure pyproject.toml file + run: PL_BACKEND="${{ matrix.pl_backend }}" python scripts/configure_pyproject_toml.py + - name: Build wheels env: CIBW_ARCHS_LINUX: ${{matrix.arch}} @@ -137,7 +140,7 @@ jobs: cat /etc/yum.conf | sed "s/\[main\]/\[main\]\ntimeout=5/g" > /etc/yum.conf python -m pip install ninja cmake~=3.24.0 - CIBW_ENVIRONMENT: PL_BACKEND="${{ matrix.pl_backend }}" CMAKE_ARGS="-DENABLE_LAPACK=OFF" + CIBW_ENVIRONMENT: CMAKE_ARGS="-DENABLE_LAPACK=OFF" CIBW_MANYLINUX_PPC64LE_IMAGE: manylinux_2_28 diff --git a/.github/workflows/wheel_linux_x86_64.yml b/.github/workflows/wheel_linux_x86_64.yml index f91ff34e8..1d078a3fa 100644 --- a/.github/workflows/wheel_linux_x86_64.yml +++ b/.github/workflows/wheel_linux_x86_64.yml @@ -53,7 +53,7 @@ jobs: steps: - name: Cache installation directories id: kokkos-cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: /root/Kokkos_install/${{ matrix.exec_model }} key: ${{ matrix.container_img }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }} @@ -115,13 +115,13 @@ jobs: steps: - name: Restoring cached dependencies id: kokkos-cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: /root/Kokkos_install/${{ matrix.exec_model }} key: ${{ matrix.container_img }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }} - name: Checkout PennyLane-Lightning - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Copy cached libraries if: steps.kokkos-cache.outputs.cache-hit == 'true' @@ -134,8 +134,11 @@ jobs: run: | dnf update -y && dnf install -y podman - - name: Install cibuildwheel - run: python3.9 -m pip install cibuildwheel~=2.16.0 + - name: Install dependencies + run: python3.9 -m pip install cibuildwheel~=2.16.0 toml + + - name: Configure pyproject.toml file + run: PL_BACKEND="${{ matrix.pl_backend }}" python3.9 scripts/configure_pyproject_toml.py - name: Build wheels env: @@ -156,13 +159,15 @@ jobs: source /opt/rh/gcc-toolset-13/enable -y PATH="/opt/rh/gcc-toolset-13/root/usr/bin:$PATH" - CIBW_ENVIRONMENT: | - PATH="/opt/rh/gcc-toolset-13/root/usr/bin:$PATH" \ - PL_BACKEND="${{ matrix.pl_backend }}" + CIBW_ENVIRONMENT: PATH="/opt/rh/gcc-toolset-13/root/usr/bin:$PATH" CIBW_BEFORE_TEST: | python -m pip install -r requirements-tests.txt - if ${{ matrix.pl_backend == 'lightning_kokkos'}}; then SKIP_COMPILATION=True PL_BACKEND="lightning_qubit" python -m pip install . -vv; fi + if ${{ matrix.pl_backend == 'lightning_kokkos'}} + then + PL_BACKEND="lightning_qubit" python scripts/configure_pyproject_toml.py + SKIP_COMPILATION=True python -m pip install . -vv + fi CIBW_TEST_COMMAND: | DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"` diff --git a/.github/workflows/wheel_linux_x86_64_cuda.yml b/.github/workflows/wheel_linux_x86_64_cuda.yml index 6a5a7a42c..bdad1afa0 100644 --- a/.github/workflows/wheel_linux_x86_64_cuda.yml +++ b/.github/workflows/wheel_linux_x86_64_cuda.yml @@ -4,10 +4,6 @@ name: Wheel::Linux::x86_64::CUDA # Python versions: 3.9, 3.10, 3.11, 3.12. # **Why we have it**: To build wheels for pennylane-lightning-gpu installation. # **Who does it impact**: Wheels to be uploaded to PyPI. - -env: - GCC_VERSION: 12 - on: pull_request: push: @@ -58,15 +54,18 @@ jobs: steps: - name: Checkout PennyLane-Lightning - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install dependencies (AlmaLinux) if: ${{ (matrix.container_img == 'quay.io/pypa/manylinux_2_28_x86_64') }} run: | dnf update -y && dnf install -y podman - - name: Install cibuildwheel - run: python3.9 -m pip install cibuildwheel~=2.16.0 + - name: Install dependencies + run: python3.9 -m pip install cibuildwheel~=2.16.0 toml + + - name: Configure pyproject.toml file + run: PL_BACKEND="${{ matrix.pl_backend }}" python3.9 scripts/configure_pyproject_toml.py - name: Build wheels env: @@ -78,7 +77,7 @@ jobs: CIBW_SKIP: "*-musllinux*" - CIBW_CONFIG_SETTINGS: --global-option=build_ext --global-option=--define="CMAKE_CXX_COMPILER=$(which g++);CMAKE_C_COMPILER=$(which gcc);LIGHTNING_RELEASE_TAG=master" + CIBW_CONFIG_SETTINGS: --global-option=build_ext --global-option=--define="LIGHTNING_RELEASE_TAG=master" # Python build settings CIBW_BEFORE_BUILD: | @@ -93,7 +92,6 @@ jobs: CIBW_ENVIRONMENT: | PATH=/opt/rh/gcc-toolset-12/root/usr/bin:$PATH:/usr/local/cuda-${{ matrix.cuda_version }}/bin \ LD_LIBRARY_PATH=/opt/rh/gcc-toolset-12/root/usr/lib64:/opt/rh/gcc-toolset-12/root/usr/lib:/opt/rh/gcc-toolset-12/root/usr/lib64/dyninst:/opt/rh/gcc-toolset-12/root/usr/lib/dyninst:$LD_LIBRARY_PATH:/usr/local/cuda-${{ matrix.cuda_version }}/lib64 \ - PL_BACKEND="${{ matrix.pl_backend }}" \ PKG_CONFIG_PATH=/opt/rh/gcc-toolset-12/root/usr/lib64/pkgconfig:$PKG_CONFIG_PATH CIBW_REPAIR_WHEEL_COMMAND_LINUX: "./bin/auditwheel repair -w {dest_dir} {wheel}" @@ -148,4 +146,4 @@ jobs: with: user: __token__ password: ${{ secrets.TEST_PYPI_LGPU_TOKEN }} - repository_url: https://test.pypi.org/legacy/ + repository-url: https://test.pypi.org/legacy/ diff --git a/.github/workflows/wheel_macos_arm64.yml b/.github/workflows/wheel_macos_arm64.yml index 5b1b20d3d..6ea238abf 100644 --- a/.github/workflows/wheel_macos_arm64.yml +++ b/.github/workflows/wheel_macos_arm64.yml @@ -75,8 +75,11 @@ jobs: with: python-version: '3.9' - - name: Install cibuildwheel - run: python -m pip install cibuildwheel~=2.16.0 + - name: Install dependencies + run: python -m pip install cibuildwheel~=2.16.0 toml + + - name: Configure pyproject.toml file + run: PL_BACKEND="${{ matrix.pl_backend }}" python scripts/configure_pyproject_toml.py - name: Build wheels env: @@ -91,13 +94,15 @@ jobs: python -m pip install pybind11 ninja cmake~=3.24.0 setuptools scipy CIBW_ENVIRONMENT: | - CMAKE_ARGS="-DCMAKE_CXX_COMPILER_TARGET=arm64-apple-macos11 -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_SYSTEM_PROCESSOR=ARM64 -DENABLE_OPENMP=OFF" \ - PL_BACKEND="${{ matrix.pl_backend }}" + CMAKE_ARGS="-DCMAKE_CXX_COMPILER_TARGET=arm64-apple-macos11 -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_SYSTEM_PROCESSOR=ARM64 -DENABLE_OPENMP=OFF" CIBW_BEFORE_TEST: | python -m pip install -r requirements-tests.txt - if ${{ matrix.pl_backend == 'lightning_kokkos'}}; then SKIP_COMPILATION=True PL_BACKEND="lightning_qubit" python -m pip install . -vv; fi - + if ${{ matrix.pl_backend == 'lightning_kokkos'}} + then + PL_BACKEND="lightning_qubit" python scripts/configure_pyproject_toml.py + SKIP_COMPILATION=True python -m pip install . -vv + fi CIBW_TEST_COMMAND: | DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"` pl-device-test --device=${DEVICENAME} --skip-ops -x --tb=short --no-flaky-report diff --git a/.github/workflows/wheel_macos_x86_64.yml b/.github/workflows/wheel_macos_x86_64.yml index f3aa0d900..58c318b79 100644 --- a/.github/workflows/wheel_macos_x86_64.yml +++ b/.github/workflows/wheel_macos_x86_64.yml @@ -124,8 +124,11 @@ jobs: with: python-version: '3.9' - - name: Install cibuildwheel - run: python -m pip install cibuildwheel~=2.16.0 + - name: Install dependencies + run: python -m pip install cibuildwheel~=2.16.0 toml + + - name: Configure pyproject.toml file + run: PL_BACKEND="${{ matrix.pl_backend }}" python scripts/configure_pyproject_toml.py - name: Build wheels env: @@ -144,7 +147,11 @@ jobs: CIBW_BEFORE_TEST: | python -m pip install -r requirements-tests.txt - if ${{ matrix.pl_backend == 'lightning_kokkos'}}; then SKIP_COMPILATION=True PL_BACKEND="lightning_qubit" python -m pip install . -vv; fi + if ${{ matrix.pl_backend == 'lightning_kokkos'}} + then + PL_BACKEND="lightning_qubit" python scripts/configure_pyproject_toml.py + SKIP_COMPILATION=True python -m pip install . -vv + fi CIBW_TEST_COMMAND: | DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"` diff --git a/.github/workflows/wheel_noarch.yml b/.github/workflows/wheel_noarch.yml index 55c62b028..d25cc78ff 100644 --- a/.github/workflows/wheel_noarch.yml +++ b/.github/workflows/wheel_noarch.yml @@ -41,36 +41,42 @@ jobs: steps: - name: Checkout PennyLane-Lightning + if: ${{ matrix.pl_backend == 'lightning_qubit'}} uses: actions/checkout@v4 - with: - path: main + - uses: actions/setup-python@v5 + if: ${{ matrix.pl_backend == 'lightning_qubit'}} with: python-version: '3.9' - name: Upgrade pip + if: ${{ matrix.pl_backend == 'lightning_qubit'}} run: | python -m pip install --upgrade pip - - name: Install CMake and ninja + - name: Install dependencies + if: ${{ matrix.pl_backend == 'lightning_qubit'}} run: | - python -m pip install --upgrade cmake ninja + python -m pip install toml - - name: Build wheels + - name: Configure pyproject.toml file + if: ${{ matrix.pl_backend == 'lightning_qubit'}} + run: PL_BACKEND="${{ matrix.pl_backend }}" python scripts/configure_pyproject_toml.py + + - name: Build wheels and source dist if: ${{ matrix.pl_backend == 'lightning_qubit'}} - run: | - python -m pip install --upgrade pip wheel - cd main - PL_BACKEND="${{ matrix.pl_backend }}" python setup.py bdist_wheel env: SKIP_COMPILATION: True + run: | + python -m pip install --upgrade pip wheel build + python -m build - name: Validate wheels if: ${{ matrix.pl_backend == 'lightning_qubit'}} run: | python -m pip install twine - python -m twine check main/dist/*.whl + python -m twine check dist/*.whl - uses: actions/upload-artifact@v3 if: | @@ -78,22 +84,13 @@ jobs: (github.event_name == 'release' || github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master') with: name: pure-python-wheels-${{ matrix.pl_backend }}.zip - path: main/dist/*.whl - - - name: Build source dist - if: ${{ matrix.pl_backend != 'lightning_qubit'}} - run: | - python -m pip install --upgrade pip wheel - cd main - PL_BACKEND="${{ matrix.pl_backend }}" python setup.py sdist - env: - SKIP_COMPILATION: True + path: dist/*.whl - uses: actions/upload-artifact@v3 if: ${{ matrix.pl_backend != 'lightning_qubit' && (github.event_name == 'release' || github.ref == 'refs/heads/master') }} with: name: pure-source-dist-${{ matrix.pl_backend }}.tar.gz - path: main/dist/*.tar.gz + path: dist/*.tar.gz upload-pypi: needs: build-pure-python-wheel @@ -101,12 +98,10 @@ jobs: matrix: pl_backend: ["lightning_gpu", "lightning_kokkos", "lightning_qubit"] runs-on: ubuntu-latest - if: | - matrix.pl_backend == 'lightning_qubit' && - github.event_name == 'release' steps: - uses: actions/download-artifact@v3 + if: ${{ matrix.pl_backend == 'lightning_qubit' && github.event_name == 'release' }} with: name: pure-python-wheels-${{ matrix.pl_backend }}.zip path: dist diff --git a/.github/workflows/wheel_win_x86_64.yml b/.github/workflows/wheel_win_x86_64.yml index ca5b6a3b7..16c44b409 100644 --- a/.github/workflows/wheel_win_x86_64.yml +++ b/.github/workflows/wheel_win_x86_64.yml @@ -113,8 +113,13 @@ jobs: Copy-Item -Path "D:\a\install_dir\${{ matrix.exec_model }}\" ` -Destination "D:\a\pennylane-lightning\pennylane-lightning\Kokkos" -Recurse -Force - - name: Install cibuildwheel - run: python -m pip install cibuildwheel~=2.16.0 wheel + - name: Install dependencies + run: python -m pip install cibuildwheel~=2.16.0 wheel toml + + - name: Configure pyproject.toml file + env: + PL_BACKEND: "${{ matrix.pl_backend }}" + run: python scripts/configure_pyproject_toml.py - name: Build wheels env: @@ -128,7 +133,6 @@ jobs: CIBW_ENVIRONMENT: | CMAKE_ARGS="-DENABLE_LAPACK=OFF" - PL_BACKEND="${{ matrix.pl_backend }}" CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 @@ -173,7 +177,8 @@ jobs: python -m pip install setuptools python -m pip install -r requirements-tests.txt if (${{ matrix.pl_backend == 'lightning_kokkos'}}) { - SKIP_COMPILATION=True PL_BACKEND="lightning_qubit" python -m pip install . -vv + PL_BACKEND="lightning_qubit" python scripts/configure_pyproject_toml.py + SKIP_COMPILATION=True python -m pip install . -vv } pushd wheelhouse $wheels = Get-ChildItem "./" -Filter *.whl diff --git a/.gitignore b/.gitignore index 0f80526ee..8e422d276 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ PennyLane_Lightning.egg-info/ prototypes/ tests/__pycache__/ venv/ +wheelhouse/ \ No newline at end of file diff --git a/.readthedocs.yml b/.readthedocs.yml index fd7c32576..af5eb2cd2 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -26,9 +26,9 @@ build: pre_install: - wget https://developer.download.nvidia.com/compute/cuda/12.3.2/local_installers/cuda_12.3.2_545.23.08_linux.run - sh cuda_12.3.2_545.23.08_linux.run --silent --toolkit --toolkitpath=${READTHEDOCS_VIRTUALENV_PATH}/cuda-12.3 || cat /tmp/cuda-installer.log - - echo "setuptools~=66.0\npip~=22.0" >> ci_build_requirements.txt - post_install: - - rm -rf ./build && export PATH=${READTHEDOCS_VIRTUALENV_PATH}/cuda-12.3/bin${PATH:+:${PATH}} && export LD_LIBRARY_PATH=${READTHEDOCS_VIRTUALENV_PATH}/cuda-12.3/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} && PL_BACKEND="lightning_gpu" python setup.py build_ext --define="PL_DISABLE_CUDA_SAFETY=1" && PL_BACKEND="lightning_gpu" python setup.py bdist_wheel - - rm -rf ./build && PL_BACKEND="lightning_kokkos" python setup.py bdist_wheel - - rm -rf ./build && export PATH=${READTHEDOCS_VIRTUALENV_PATH}/cuda-12.3/bin${PATH:+:${PATH}} && export LD_LIBRARY_PATH=${READTHEDOCS_VIRTUALENV_PATH}/cuda-12.3/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} && PL_BACKEND="lightning_tensor" python setup.py build_ext --define="PL_DISABLE_CUDA_SAFETY=1" && PL_BACKEND="lightning_tensor" python setup.py bdist_wheel + - echo "setuptools~=66.0" >> ci_build_requirements.txt + post_install: + - rm -rf ./build && export PATH=${READTHEDOCS_VIRTUALENV_PATH}/cuda-12.3/bin${PATH:+:${PATH}} && export LD_LIBRARY_PATH=${READTHEDOCS_VIRTUALENV_PATH}/cuda-12.3/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} && PL_BACKEND="lightning_gpu" python scripts/configure_pyproject_toml.py && CMAKE_ARGS="-DPL_DISABLE_CUDA_SAFETY=1" python -m build + - rm -rf ./build && PL_BACKEND="lightning_kokkos" python scripts/configure_pyproject_toml.py && python -m build + - rm -rf ./build && export PATH=${READTHEDOCS_VIRTUALENV_PATH}/cuda-12.3/bin${PATH:+:${PATH}} && export LD_LIBRARY_PATH=${READTHEDOCS_VIRTUALENV_PATH}/cuda-12.3/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} && PL_BACKEND="lightning_tensor" python scripts/configure_pyproject_toml.py && CMAKE_ARGS="-DPL_DISABLE_CUDA_SAFETY=1" python -m build - python -m pip install ./dist/*.whl diff --git a/CMakeLists.txt b/CMakeLists.txt index a7e50f900..d53f2d75c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,16 +20,16 @@ project(pennylane_lightning function(set_pennylane_lightning_version VERSION_FILE_PATH) file(STRINGS ${VERSION_FILE_PATH} VERSION_FILE_STR) foreach (LINE IN LISTS VERSION_FILE_STR) - if("${LINE}" MATCHES "__version__.*") + if("${LINE}" MATCHES "version.*") set(VERSION_LINE_STR "${LINE}") endif() endforeach() - string(REGEX REPLACE "__version__ = \"(.*)\"" "\\1" VERSION_STRING ${VERSION_LINE_STR}) + string(REGEX REPLACE "version = \"(.*)\"" "\\1" VERSION_STRING ${VERSION_LINE_STR}) set(VERSION_STRING ${VERSION_STRING} PARENT_SCOPE) endfunction() -set_pennylane_lightning_version(${PROJECT_SOURCE_DIR}/pennylane_lightning/core/_version.py) +set_pennylane_lightning_version(${PROJECT_SOURCE_DIR}/pyproject.toml) message(STATUS "pennylane_lightning version ${VERSION_STRING}") set(PROJECT_VERSION ${VERSION_STRING}) @@ -146,7 +146,7 @@ foreach(BACKEND ${PL_BACKEND}) "${BACKEND}_measurements" ) endforeach() - + target_include_directories(pennylane_lightning INTERFACE "$") ##################################################### diff --git a/MANIFEST.in b/MANIFEST.in index db5d3a35b..4c1a79b51 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,9 @@ +include CMakeLists.txt +include cmake/* include requirements.txt include .github/CHANGELOG.md include pennylane_lightning/lightning_qubit/lightning_qubit.toml include pennylane_lightning/lightning_qpu/lightning_gpu.toml include pennylane_lightning/lightning_kokkos/lightning_kokkos.toml +include pennylane_lightning/core/_version.py +graft pennylane_lightning/core/src/ diff --git a/Makefile b/Makefile index 0456de834..8b673ed71 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,8 @@ help: @echo " test-cpp [target=?] to run a specific C++ test target (requires CMake)." @echo " test-python [device=?] to run the Python test suite" @echo " Default: lightning.qubit" + @echo " wheel [backend=?] to configure and build Python wheels + @echo " Default: lightning_qubit" @echo " coverage [device=?] to generate a coverage report for python interface" @echo " Default: lightning.qubit" @echo " coverage-cpp [backend=?] to generate a coverage report for C++ interface" @@ -61,6 +63,11 @@ clean: rm -rf pennylane_lightning/*_ops* rm -rf *.egg-info +.PHONY: wheel +wheel: + PL_BACKEND=$(PL_BACKEND) python scripts/configure_pyproject_toml.py + python -m build + .PHONY: coverage coverage-cpp coverage: @echo "Generating coverage report for $(if $(device:-=),$(device),lightning.qubit) device:" @@ -77,9 +84,9 @@ coverage-cpp: -DENABLE_COVERAGE=ON \ -DPL_BACKEND=$(PL_BACKEND) \ $(OPTIONS) - cmake --build ./BuildCov + cmake --build ./BuildCov $(VERBOSE) --target $(target) cd ./BuildCov; for file in *runner ; do ./$file; done; \ - lcov --directory . -b ../pennylane_lightning/core/src --capture --output-file coverage.info; \ + lcov --directory . -b ../pennylane_lightning/core/src/ --capture --output-file coverage.info; \ genhtml coverage.info --output-directory out .PHONY: test-python test-builtin test-suite test-cpp @@ -115,8 +122,8 @@ format-cpp: ./bin/format $(CHECK) ./pennylane_lightning format-python: - isort --py 311 --profile black -l 100 -p pennylane_lightning ./pennylane_lightning/ ./mpitests ./tests $(ICHECK) $(VERBOSE) - black -l 100 ./pennylane_lightning/ ./mpitests ./tests $(CHECK) $(VERBOSE) + isort --py 311 --profile black -l 100 -p pennylane_lightning ./pennylane_lightning ./mpitests ./tests ./scripts $(ICHECK) $(VERBOSE) + black -l 100 ./pennylane_lightning ./mpitests ./tests ./scripts $(CHECK) $(VERBOSE) .PHONY: check-tidy check-tidy: diff --git a/README.rst b/README.rst index 3f9b6b19f..518bd9419 100644 --- a/README.rst +++ b/README.rst @@ -135,10 +135,11 @@ For development and testing, you can install by cloning the repository: $ git clone https://github.com/PennyLaneAI/pennylane-lightning.git $ cd pennylane-lightning $ pip install -r requirements.txt - $ PL_BACKEND=${PL_BACKEND} pip install -e . -vv + $ PL_BACKEND=${PL_BACKEND} python scripts/configure_pyproject_toml.py + $ pip install -e . -vv Note that subsequent calls to ``pip install -e .`` will use cached binaries stored in the -``build`` folder. Run ``make clean`` if you would like to recompile from scratch. +``build`` folder, and the ``pyproject.toml`` file defined by the configuration script. Run ``make clean`` if you would like to recompile from scratch. You can also pass ``cmake`` options with ``CMAKE_ARGS`` as follows: @@ -146,15 +147,6 @@ You can also pass ``cmake`` options with ``CMAKE_ARGS`` as follows: $ CMAKE_ARGS="-DENABLE_OPENMP=OFF -DENABLE_BLAS=OFF" pip install -e . -vv -or with ``build_ext`` and the ``--define`` flag as follows: - -.. code-block:: console - - $ python3 setup.py build_ext -i --define="ENABLE_OPENMP=OFF;ENABLE_BLAS=OFF" - $ python3 setup.py develop - -where ``-D`` must not be included before ``;``-separated options. - Compile MSVC (Windows) ====================== @@ -235,27 +227,28 @@ Please see the `cuQuantum SDK`_ install guide for more information. Install Lightning-GPU from source ================================= -To install Lightning-GPU from the package sources using the direct SDK path, Lightning-Qubit should be install before Lightning-GPU: +To install Lightning-GPU from the package sources using the direct SDK path, Lightning-Qubit should be installed (compilation is not necessary): .. code-block:: console git clone https://github.com/PennyLaneAI/pennylane-lightning.git cd pennylane-lightning pip install -r requirements.txt - PL_BACKEND="lightning_qubit" pip install -e . -vv + PL_BACKEND="lightning_qubit" python scripts/configure_pyproject_toml.py + SKIP_COMPILATION=True pip install -e . -vv Then the `cuStateVec`_ library can be installed and set a ``CUQUANTUM_SDK`` environment variable. .. code-block:: console - python -m pip install wheel custatevec-cu12 export CUQUANTUM_SDK=$(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum')") The Lightning-GPU can then be installed with ``pip``: .. code-block:: console - PL_BACKEND="lightning_gpu" python -m pip install -e . + PL_BACKEND="lightning_gpu" python scripts/configure_pyproject_toml.py + python -m pip install -e . To simplify the build, we recommend using the containerized build process described in Docker support section. @@ -275,7 +268,8 @@ Then Lightning-GPU with MPI support can then be installed with ``pip``: .. code-block:: console - CMAKE_ARGS="-DENABLE_MPI=ON" PL_BACKEND="lightning_gpu" python -m pip install -e . + PL_BACKEND="lightning_gpu" python scripts/configure_pyproject_toml.py + CMAKE_ARGS="-DENABLE_MPI=ON" python -m pip install -e . Test Lightning-GPU with MPI @@ -343,7 +337,8 @@ The simplest way to install Lightning-Kokkos (OpenMP backend) through ``pip``. .. code-block:: console - CMAKE_ARGS="-DKokkos_ENABLE_OPENMP=ON" PL_BACKEND="lightning_kokkos" python -m pip install . + PL_BACKEND="lightning_kokkos" python scripts/configure_pyproject_toml.py + CMAKE_ARGS="-DKokkos_ENABLE_OPENMP=ON" python -m pip install . To build the plugin directly with CMake as above: @@ -372,27 +367,28 @@ Please see the `cuQuantum SDK `_ ins Install Lightning-Tensor from source ==================================== -Lightning-Qubit should be installed before Lightning-Tensor: +Lightning-Qubit should be installed before Lightning-Tensor (compilation is not necessary): .. code-block:: console git clone https://github.com/PennyLaneAI/pennylane-lightning.git cd pennylane-lightning pip install -r requirements.txt - PL_BACKEND="lightning_qubit" pip install . + PL_BACKEND="lightning_qubit" python scripts/configure_pyproject_toml.py + SKIP_COMPILATION=True pip install . -Then the `cutensornet`_ library can be installed and set a ``CUQUANTUM_SDK`` environment variable. +Then the `cutensornet`_ library can be installed and set a ``CUQUANTUM_SDK`` environment variable. .. code-block:: console - pip install cutensornet-cu12 export CUQUANTUM_SDK=$(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum')") The Lightning-Tensor can then be installed with ``pip``: .. code-block:: console - PL_BACKEND="lightning_tensor" pip install -e . + PL_BACKEND="lightning_tensor" python scripts/configure_pyproject_toml.py + pip install -e . .. installation_LTensor-end-inclusion-marker-do-not-remove @@ -458,13 +454,13 @@ If you are using Lightning for research, please cite: @misc{ asadi2024, - title={{Hybrid quantum programming with PennyLane Lightning on HPC platforms}}, + title={{Hybrid quantum programming with PennyLane Lightning on HPC platforms}}, author={Ali Asadi and Amintor Dusko and Chae-Yeun Park and Vincent Michaud-Rioux and Isidor Schoch and Shuli Shu and Trevor Vincent and Lee James O'Riordan}, year={2024}, eprint={2403.02512}, archivePrefix={arXiv}, primaryClass={quant-ph}, - url={https://arxiv.org/abs/2403.02512}, + url={https://arxiv.org/abs/2403.02512}, } .. citation-end-inclusion-marker-do-not-remove diff --git a/docker/Dockerfile b/docker/Dockerfile index cff4ffdf5..cc38d8506 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -79,8 +79,8 @@ RUN pip install --no-cache-dir cmake ninja pybind11 wheel FROM base-build-python AS build-wheel-lightning-qubit WORKDIR /opt/pennylane-lightning RUN pip uninstall -y pennylane-lightning -RUN python setup.py build_ext -RUN python setup.py bdist_wheel +RUN python scripts/configure_pyproject_toml.py +RUN python -m build # Install lightning-qubit backend FROM base-runtime AS wheel-lightning-qubit @@ -93,8 +93,8 @@ FROM base-build-python AS build-wheel-lightning-kokkos-openmp WORKDIR /opt/pennylane-lightning ENV PL_BACKEND=lightning_kokkos RUN pip uninstall -y pennylane-lightning -RUN python setup.py build_ext -i --define="Kokkos_ENABLE_SERIAL:BOOL=ON;Kokkos_ENABLE_OPENMP:BOOL=ON" -RUN python setup.py bdist_wheel +RUN python scripts/configure_pyproject_toml.py +RUN CMAKE_ARGS="-DKokkos_ENABLE_SERIAL:BOOL=ON -DKokkos_ENABLE_OPENMP:BOOL=ON" python -m build # Install lightning-kokkos OpenMP backend FROM base-runtime AS wheel-lightning-kokkos-openmp @@ -118,8 +118,8 @@ WORKDIR /opt/pennylane-lightning ENV PL_BACKEND=lightning_kokkos RUN pip uninstall -y pennylane-lightning RUN echo >> cmake/support_kokkos.cmake && echo "find_package(CUDAToolkit REQUIRED)" >> cmake/support_kokkos.cmake -RUN python setup.py build_ext -i --define="Kokkos_ENABLE_SERIAL:BOOL=ON;Kokkos_ENABLE_OPENMP:BOOL=ON;Kokkos_ENABLE_CUDA:BOOL=ON;Kokkos_ARCH_${CUDA_ARCH}=ON" -RUN python setup.py bdist_wheel +RUN python scripts/configure_pyproject_toml.py +RUN CMAKE_ARGS="-DKokkos_ENABLE_SERIAL:BOOL=ON -DKokkos_ENABLE_OPENMP:BOOL=ON -DKokkos_ENABLE_CUDA:BOOL=ON -DKokkos_ARCH_${CUDA_ARCH}=ON" python -m build # Install python3 and setup runtime virtual env in CUDA-12-runtime image (includes CUDA runtime and math libraries) # Install lightning-kokkos CUDA backend @@ -148,8 +148,9 @@ WORKDIR /opt/pennylane-lightning ENV PL_BACKEND=lightning_gpu RUN pip install --no-cache-dir wheel custatevec-cu12 RUN pip uninstall -y pennylane-lightning -RUN CUQUANTUM_SDK=$(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum/lib')") python setup.py build_ext -RUN python setup.py bdist_wheel +RUN python scripts/configure_pyproject_toml.py +RUN CUQUANTUM_SDK=$(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum/lib')") python -m build + # Install python3 and setup runtime virtual env in CUDA-12-runtime image (includes CUDA runtime and math libraries) # Install lightning-kokkos CUDA backend @@ -192,8 +193,8 @@ ENV CMAKE_PREFIX_PATH=/opt/rocm:$CMAKE_PREFIX_PATH ENV CXX=hipcc ENV PL_BACKEND=lightning_kokkos RUN pip uninstall -y pennylane-lightning -RUN python setup.py build_ext -i --define="Kokkos_ENABLE_SERIAL:BOOL=ON;Kokkos_ENABLE_OPENMP:BOOL=ON;Kokkos_ENABLE_HIP:BOOL=ON;Kokkos_ARCH_${AMD_ARCH}=ON" -RUN python setup.py bdist_wheel +RUN python scripts/configure_pyproject_toml.py +RUN CMAKE_ARGS="-DKokkos_ENABLE_SERIAL:BOOL=ON -DKokkos_ENABLE_OPENMP:BOOL=ON -DKokkos_ENABLE_HIP:BOOL=ON -DKokkos_ARCH_${AMD_ARCH}=ON" python -m build # Install lightning-kokkos HIP backend FROM rocm/dev-ubuntu-22.04:5.7 AS wheel-lightning-kokkos-rocm diff --git a/pennylane_lightning/core/__init__.py b/pennylane_lightning/core/__init__.py index d3a37803e..30e036e21 100644 --- a/pennylane_lightning/core/__init__.py +++ b/pennylane_lightning/core/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2018-2023 Xanadu Quantum Technologies Inc. +# Copyright 2018-2024 Xanadu Quantum Technologies Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/pennylane_lightning/core/_version.py b/pennylane_lightning/core/_version.py index 68d119cc2..2075a97a5 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.38.0-dev29" +__version__ = "0.38.0-dev30" diff --git a/pennylane_lightning/lightning_gpu/__init__.py b/pennylane_lightning/lightning_gpu/__init__.py index e88765aa2..90238ba79 100644 --- a/pennylane_lightning/lightning_gpu/__init__.py +++ b/pennylane_lightning/lightning_gpu/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2018-2023 Xanadu Quantum Technologies Inc. +# Copyright 2018-2024 Xanadu Quantum Technologies Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/pennylane_lightning/lightning_kokkos/__init__.py b/pennylane_lightning/lightning_kokkos/__init__.py index 7b1045d54..8720ed020 100644 --- a/pennylane_lightning/lightning_kokkos/__init__.py +++ b/pennylane_lightning/lightning_kokkos/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2018-2023 Xanadu Quantum Technologies Inc. +# Copyright 2018-2024 Xanadu Quantum Technologies Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/pennylane_lightning/lightning_qubit/__init__.py b/pennylane_lightning/lightning_qubit/__init__.py index a1b792afd..12901a739 100644 --- a/pennylane_lightning/lightning_qubit/__init__.py +++ b/pennylane_lightning/lightning_qubit/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2018-2023 Xanadu Quantum Technologies Inc. +# Copyright 2018-2024 Xanadu Quantum Technologies Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..b50ac438d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,28 @@ +[build-system] +requires = [ "cmake~=3.24.0", "ninja; platform_system!='Windows'", "setuptools>=42", "toml",] +build-backend = "setuptools.build_meta" + +[project] +name = "PennyLane_Lightning" +description = "PennyLane-Lightning plugin" +readme = "README.rst" +requires-python = ">=3.9" +classifiers = [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Science/Research", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering :: Physics",] +dependencies = [ "pennylane>=0.37",] +dynamic = [ "version",] +[[project.maintainers]] +name = "Xanadu Quantum Technologies Inc." +email = "software@xanadu.ai" + +[project.license] +text = "Apache License 2.0" + +[project.optional-dependencies] +gpu = [ "pennylane-lightning-gpu",] +kokkos = [ "pennylane-lightning-kokkos",] + +[project.urls] +Homepage = "https://github.com/PennyLaneAI/pennylane-lightning" + +[project.entry-points."pennylane.plugins"] +"lightning.qubit" = "pennylane_lightning.lightning_qubit:LightningQubit" diff --git a/requirements-dev.txt b/requirements-dev.txt index 80268897c..34e788461 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,5 @@ -pip~=22.0 git+https://github.com/PennyLaneAI/pennylane.git@master +build ninja flaky pybind11 diff --git a/scripts/backend_support.py b/scripts/backend_support.py new file mode 100755 index 000000000..9f6cd3897 --- /dev/null +++ b/scripts/backend_support.py @@ -0,0 +1,56 @@ +# Copyright 2024 Xanadu Quantum Technologies Inc. + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +r""" +Internal logic to check and set backend variables. +""" +import os + +default_backend = "lightning_qubit" +supported_backends = {"lightning_kokkos", "lightning_qubit", "lightning_gpu", "lightning_tensor"} +supported_backends.update({sb.replace("_", ".") for sb in supported_backends}) + + +def get_backend(): + """Return backend. + + The backend is ``lightning_qubit`` by default. + Allowed values are: "lightning_kokkos", "lightning_qubit", "lightning_gpu" and "lightning_tensor". + A dot can also be used instead of an underscore. + If the environment variable ``PL_BACKEND`` is defined, its value is used. + Otherwise, if the environment variable ``CMAKE_ARGS`` is defined and it + contains the CMake option ``PL_BACKEND``, its value is used. + Dots are replaced by underscores upon exiting. + """ + _backend = None + if "PL_BACKEND" in os.environ: + _backend = os.environ.get("PL_BACKEND", default_backend) + _backend = _backend.replace(".", "_") + if "CMAKE_ARGS" in os.environ: + cmake_args = os.environ["CMAKE_ARGS"].split(" ") + arg = [x for x in cmake_args if "PL_BACKEND" in x] + if not arg and _backend is not None: + cmake_backend = _backend + else: + cmake_backend = arg[0].split("=")[1].replace(".", "_") if arg else default_backend + # CMake determined backend will always take precedence over PL_BACKEND. + _backend = cmake_backend + if _backend is None: + _backend = default_backend + if _backend not in supported_backends: + raise ValueError(f"Invalid backend {_backend}.") + return _backend + + +backend = get_backend() +device_name = backend.replace("_", ".") diff --git a/scripts/configure_pyproject_toml.py b/scripts/configure_pyproject_toml.py new file mode 100755 index 000000000..57517954e --- /dev/null +++ b/scripts/configure_pyproject_toml.py @@ -0,0 +1,99 @@ +# Copyright 2024 Xanadu Quantum Technologies Inc. + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +r""" +Project configuration script. +""" +import argparse +import os +from pathlib import Path + +import toml +from backend_support import backend, device_name + +path_to_version = Path("pennylane_lightning").absolute() / "core" / "_version.py" +with open(path_to_version, encoding="utf-8") as f: + version = f.readlines()[-1].split()[-1].strip("\"'") + + +######################################################################## +# Parsing arguments +######################################################################## +def parse_args(): + """Parse external arguments provided to the script.""" + parser = argparse.ArgumentParser( + prog="python configure_pyproject_toml.py", + description="This module configures the pyproject.toml file for a Lightning backend (package).", + ) + + parser.add_argument( + "--path", + type=str, + default="", + nargs="?", + help="pyproject.toml file path", + ) + + return parser.parse_args() + + +if __name__ == "__main__": + parsed_args = parse_args() + pyproject_path = os.path.join(parsed_args.path, "pyproject.toml") + + pyproject = toml.load(pyproject_path) + + # ------------------------ + # Configure Build. + # ------------------------ + requires = [ + "cmake~=3.24.0", + "ninja; platform_system!='Windows'", + "setuptools>=42", + "toml", + ] + if backend == "lightning_gpu": + requires.append("custatevec-cu12") + if backend == "lightning_tensor": + requires.append("cutensornet-cu12") + + pyproject["build-system"]["requires"] = requires + + # ------------------------ + # Configure Project. + # ------------------------ + suffix = backend.replace("lightning_", "") + suffix = suffix.upper() if suffix == "gpu" else suffix.title() + + plugin = "pennylane_lightning." + backend + ":Lightning" + suffix + + pkg_suffix = "" if suffix == "Qubit" else "_" + suffix + + # Specifying the project name. + pyproject["project"]["name"] = f"PennyLane_Lightning{pkg_suffix}" + + # Project entry point. + pyproject["project"]["entry-points"]["pennylane.plugins"] = {device_name: plugin} + + dependencies = [ + "pennylane>=0.37", + ] + + if backend != "lightning_qubit": + dependencies += ["pennylane_lightning==" + version] + + # Package requirements. + pyproject["project"]["dependencies"] = dependencies + + with open(pyproject_path, "w", encoding="utf-8") as file: + toml.dump(pyproject, file) diff --git a/scripts/gen_pyver_matrix.py b/scripts/gen_pyver_matrix.py old mode 100644 new mode 100755 index 956264d0c..0d65d03b9 --- a/scripts/gen_pyver_matrix.py +++ b/scripts/gen_pyver_matrix.py @@ -1,6 +1,6 @@ import argparse -import re import json +import re def version_map(py_ver: str): @@ -52,4 +52,4 @@ def version_map(py_ver: str): json_out = json.dumps(output_list) - print(json_out) \ No newline at end of file + print(json_out) diff --git a/setup.py b/setup.py index e0ce37fc5..cd51c3a93 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -# Copyright 2018-2023 Xanadu Quantum Technologies Inc. +# Copyright 2018-2024 Xanadu Quantum Technologies Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,52 +16,15 @@ import subprocess import shutil import sys +import toml + from pathlib import Path from setuptools import setup, Extension, find_namespace_packages from setuptools.command.build_ext import build_ext -default_backend = "lightning_qubit" -supported_backends = {"lightning_kokkos", "lightning_qubit", "lightning_gpu", "lightning_tensor"} -supported_backends.update({sb.replace("_", ".") for sb in supported_backends}) - - -def get_backend(): - """Return backend. - - The backend is ``lightning_qubit`` by default. - Allowed values are: "lightning_kokkos", "lightning_qubit" and "lightning_gpu". - A dot can also be used instead of an underscore. - If the environment variable ``PL_BACKEND`` is defined, its value is used. - Otherwise, if the environment variable ``CMAKE_ARGS`` is defined and it - contains the CMake option ``PL_BACKEND``, its value is used. - Dots are replaced by underscores upon exiting. - """ - backend = None - if "PL_BACKEND" in os.environ: - backend = os.environ.get("PL_BACKEND", default_backend) - backend = backend.replace(".", "_") - if "CMAKE_ARGS" in os.environ: - cmake_args = os.environ["CMAKE_ARGS"].split(" ") - arg = [x for x in cmake_args if "PL_BACKEND" in x] - if not arg and backend is not None: - cmake_backend = backend - else: - cmake_backend = arg[0].split("=")[1].replace(".", "_") if arg else default_backend - if backend is not None and backend != cmake_backend: - raise ValueError( - f"Backends {backend} and {cmake_backend} specified by PL_BACKEND and CMAKE_ARGS respectively do not match." - ) - backend = cmake_backend - if backend is None: - backend = default_backend - if backend not in supported_backends: - raise ValueError(f"Invalid backend {backend}.") - return backend - - -backend = get_backend() -device_name = backend.replace("_", ".") - +project_name = toml.load("pyproject.toml")['project']['name'] +backend = project_name.replace("PennyLane_", "").lower() +if (backend == "lightning"): backend = "lightning_qubit" class CMakeExtension(Extension): def __init__(self, name, sourcedir=""): @@ -166,53 +129,23 @@ def build_extension(self, ext: CMakeExtension): env=os.environ, ) - with open(os.path.join("pennylane_lightning", "core", "_version.py"), encoding="utf-8") as f: version = f.readlines()[-1].split()[-1].strip("\"'") -requirements = [ - "pennylane>=0.36", -] - packages_list = ["pennylane_lightning." + backend] if backend == "lightning_qubit": packages_list += ["pennylane_lightning.core"] -else: - requirements += ["pennylane_lightning==" + version] - -suffix = backend.replace("lightning_", "") -if suffix == "gpu": - suffix = suffix[0:].upper() -suffix = suffix[0].upper() + suffix[1:] - -pennylane_plugins = [device_name + " = pennylane_lightning." + backend + ":Lightning" + suffix] - -pkg_suffix = "" if suffix == "Qubit" else "_" + suffix info = { - "name": f"PennyLane_Lightning{pkg_suffix}", "version": version, - "maintainer": "Xanadu Inc.", - "maintainer_email": "software@xanadu.ai", - "url": "https://github.com/PennyLaneAI/pennylane-lightning", - "license": "Apache License 2.0", "packages": find_namespace_packages(include=packages_list), "include_package_data": True, - "entry_points": {"pennylane.plugins": pennylane_plugins}, - "description": "PennyLane-Lightning plugin", - "long_description": open("README.rst").read(), - "long_description_content_type": "text/x-rst", - "install_requires": requirements, "ext_modules": ( [] if os.environ.get("SKIP_COMPILATION", False) else [CMakeExtension(f"{backend}_ops")] ), "cmdclass": {"build_ext": CMakeBuild}, "ext_package": "pennylane_lightning", - "extras_require": { - "gpu": ["pennylane-lightning-gpu"], - "kokkos": ["pennylane-lightning-kokkos"], - }, } if backend == "lightning_qubit": @@ -227,24 +160,4 @@ def build_extension(self, ext: CMakeExtension): } ) -classifiers = [ - "Development Status :: 4 - Beta", - "Environment :: Console", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: Apache Software License", - "Natural Language :: English", - "Operating System :: POSIX", - "Operating System :: MacOS :: MacOS X", - "Operating System :: POSIX :: Linux", - "Operating System :: Microsoft :: Windows", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3 :: Only", - "Topic :: Scientific/Engineering :: Physics", -] - -setup(classifiers=classifiers, **(info)) +setup(**(info))