From dc3a72fcf82c08f3e96c7c659f120bd4dcefa0b2 Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Fri, 2 May 2025 17:11:20 -0400 Subject: [PATCH 01/23] Migrating setup.py to pyproject.toml --- .github/workflows/tests-gpu.yml | 2 +- .github/workflows/upload.yml | 2 +- Makefile | 6 +-- pyproject.toml | 78 +++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests-gpu.yml b/.github/workflows/tests-gpu.yml index 4c82fdbf39c..058bf381ecb 100644 --- a/.github/workflows/tests-gpu.yml +++ b/.github/workflows/tests-gpu.yml @@ -102,7 +102,7 @@ jobs: - name: Install PennyLane run: | - python setup.py bdist_wheel + python -m build --wheel pip install dist/pennylane*.whl - name: Install Lightning-master diff --git a/.github/workflows/upload.yml b/.github/workflows/upload.yml index 93b016728da..2049d5a42b8 100644 --- a/.github/workflows/upload.yml +++ b/.github/workflows/upload.yml @@ -39,7 +39,7 @@ jobs: run: | python -m pip install --upgrade pip wheel pip install -r requirements-ci.txt --upgrade - python setup.py bdist_wheel + python -m build --wheel - name: Publish uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/Makefile b/Makefile index 8b3bec9be42..ca508c85ed6 100644 --- a/Makefile +++ b/Makefile @@ -25,15 +25,15 @@ install: ifndef PYTHON3 @echo "To install PennyLane you need to have Python 3 installed" endif - $(PYTHON) setup.py install + $(PYTHON) -m pip install . .PHONY: wheel wheel: - $(PYTHON) setup.py bdist_wheel + $(PYTHON) -m build --wheel .PHONY: dist dist: - $(PYTHON) setup.py sdist + $(PYTHON) -m build --sdist .PHONY : clean clean: diff --git a/pyproject.toml b/pyproject.toml index 8f25644083c..69d909d287e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,81 @@ +[build-system] +requires = ["cmake", "setuptools>=68", "tomli"] +build-backend = "setuptools.build_meta" + +[project] +name = "Pennylane" +description = "PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network." +readme = "README.md" +license = {text = "Apache License 2.0"} +requires-python = ">=3.10" +dynamic = ["version"] +maintainers = [ + { name = "Xanadu Inc.", email = "software@xanadu.ai" }, +] +dependencies = [ + "numpy", + "scipy", + "networkx", + "rustworkx>=0.14.0", + "autograd", + "appdirs", + "autoray>=0.6.11", + "cachetools", + "pennylane-lightning>=0.41", + "requests", + "tomli", + "typing_extensions", + "packaging", + "diastatic-malt", +] +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.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3 :: Only", + "Topic :: Scientific/Engineering :: Physics", +] + +[project.urls] +repository = "https://github.com/PennyLaneAI/pennylane", + +[project.optional-dependencies] +kernels = ["cvxpy", "cvxopt"] + +[project.scripts] +pl-device-test = "pennylane.devices.tests:cli" + +[project.entry-points."pennylane.plugins"] +"default.qubit" = "pennylane.devices:DefaultQubit" +"default.gaussian" = "pennylane.devices:DefaultGaussian" +"default.mixed" = "pennylane.devices.default_mixed:DefaultMixed" +"reference.qubit" = "pennylane.devices.reference_qubit:ReferenceQubit" +"null.qubit" = "pennylane.devices.null_qubit:NullQubit" +"default.qutrit" = "pennylane.devices.default_qutrit:DefaultQutrit" +"default.clifford" = "pennylane.devices.default_clifford:DefaultClifford" +"default.qutrit.mixed" = "pennylane.devices.default_qutrit_mixed:DefaultQutritMixed" +"default.tensor" = "pennylane.devices.default_tensor:DefaultTensor" + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.packages.find] +where = ["pennylane"] + +[tool.setuptools.package-data] +pennylane = ["devices/tests/pytest.ini", "drawer/plot.mplstyle"] + [tool.black] line-length = 100 include = '\.pyi?$' From 97c48c50ff2dbf0e6794814741e63903153a89f5 Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Fri, 2 May 2025 17:14:03 -0400 Subject: [PATCH 02/23] fixed typo --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 69d909d287e..7714c5785cf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,7 @@ classifiers = [ ] [project.urls] -repository = "https://github.com/PennyLaneAI/pennylane", +repository = "https://github.com/PennyLaneAI/pennylane" [project.optional-dependencies] kernels = ["cvxpy", "cvxopt"] From c18d0ee3bf87cbf04eb3b9964f85696425b52bb0 Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Fri, 2 May 2025 17:21:25 -0400 Subject: [PATCH 03/23] Adding numpy to toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7714c5785cf..597079b8792 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["cmake", "setuptools>=68", "tomli"] +requires = ["cmake", "setuptools>=68", "tomli","numpy"] build-backend = "setuptools.build_meta" [project] From aa722ae593038392f32e4634a3dff748c454a3aa Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Fri, 2 May 2025 17:26:34 -0400 Subject: [PATCH 04/23] removing numpy --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 597079b8792..218b8064304 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["cmake", "setuptools>=68", "tomli","numpy"] +requires = ["cmake", "setuptools>=68", "tomli"] build-backend = "setuptools.build_meta" [project] @@ -13,7 +13,6 @@ maintainers = [ { name = "Xanadu Inc.", email = "software@xanadu.ai" }, ] dependencies = [ - "numpy", "scipy", "networkx", "rustworkx>=0.14.0", From c1c4e2440678d861b037ff2fb5942ae1cf95d5ef Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Mon, 5 May 2025 10:26:57 -0400 Subject: [PATCH 05/23] updated pyproj --- pyproject.toml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 218b8064304..96d0f365c8a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,12 +6,8 @@ build-backend = "setuptools.build_meta" name = "Pennylane" description = "PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network." readme = "README.md" -license = {text = "Apache License 2.0"} requires-python = ">=3.10" dynamic = ["version"] -maintainers = [ - { name = "Xanadu Inc.", email = "software@xanadu.ai" }, -] dependencies = [ "scipy", "networkx", @@ -26,6 +22,7 @@ dependencies = [ "typing_extensions", "packaging", "diastatic-malt", + "numpy" ] classifiers = [ "Development Status :: 4 - Beta", @@ -45,6 +42,9 @@ classifiers = [ "Programming Language :: Python :: 3 :: Only", "Topic :: Scientific/Engineering :: Physics", ] +[[project.maintainers]] +name = "Xanadu Quantum Technologies Inc." +email = "software@xanadu.ai" [project.urls] repository = "https://github.com/PennyLaneAI/pennylane" @@ -69,6 +69,9 @@ pl-device-test = "pennylane.devices.tests:cli" [tool.setuptools] include-package-data = true +[project.license] +text = "Apache License 2.0" + [tool.setuptools.packages.find] where = ["pennylane"] From be862366e31fe63eb5d3a809eefc9ef07c8cfeec Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Mon, 5 May 2025 11:17:02 -0400 Subject: [PATCH 06/23] removed packages find --- pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 96d0f365c8a..78c3e40d337 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,9 +72,6 @@ include-package-data = true [project.license] text = "Apache License 2.0" -[tool.setuptools.packages.find] -where = ["pennylane"] - [tool.setuptools.package-data] pennylane = ["devices/tests/pytest.ini", "drawer/plot.mplstyle"] From 02f27909db800219e66357200e986f716570207e Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Mon, 5 May 2025 11:30:14 -0400 Subject: [PATCH 07/23] Trigger Build From e099c96ba0a4dfd84f59d4ae0db0c423b9b76f0f Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Tue, 6 May 2025 10:09:17 -0400 Subject: [PATCH 08/23] removed setup.py --- pyproject.toml | 5 ++- setup.py | 93 -------------------------------------------------- 2 files changed, 4 insertions(+), 94 deletions(-) delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml index 78c3e40d337..d64ba83e4c3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["cmake", "setuptools>=68", "tomli"] +requires = ["cmake", "setuptools>=75", "tomli"] build-backend = "setuptools.build_meta" [project] @@ -68,6 +68,9 @@ pl-device-test = "pennylane.devices.tests:cli" [tool.setuptools] include-package-data = true +py-modules = [] + +[tool.setuptools_scm] [project.license] text = "Apache License 2.0" diff --git a/setup.py b/setup.py deleted file mode 100644 index b65d80b52e8..00000000000 --- a/setup.py +++ /dev/null @@ -1,93 +0,0 @@ -# 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. -# 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. - -"""Setup file for package installation.""" -# pylint: disable=unspecified-encoding, consider-using-with - -from setuptools import find_packages, setup - -with open("pennylane/_version.py") as f: - version = f.readlines()[-1].split()[-1].strip("\"'") - -requirements = [ - "numpy", - "scipy", - "networkx", - "rustworkx>=0.14.0", - "autograd", - "tomlkit", - "appdirs", - "autoray>=0.6.11", - "cachetools", - "pennylane-lightning>=0.41", - "requests", - "typing_extensions", - "packaging", - "diastatic-malt", -] - -info = { - "name": "PennyLane", - "version": version, - "maintainer": "Xanadu Inc.", - "maintainer_email": "software@xanadu.ai", - "url": "https://github.com/PennyLaneAI/pennylane", - "license": "Apache License 2.0", - "packages": find_packages(where="."), - "entry_points": { - # TODO: rename entry point 'pennylane.plugins' to 'pennylane.devices'. - # This requires a rename in the setup file of all devices, and is best done during another refactor - "pennylane.plugins": [ - "default.qubit = pennylane.devices:DefaultQubit", - "default.gaussian = pennylane.devices:DefaultGaussian", - "default.mixed = pennylane.devices.default_mixed:DefaultMixed", - "reference.qubit = pennylane.devices.reference_qubit:ReferenceQubit", - "null.qubit = pennylane.devices.null_qubit:NullQubit", - "default.qutrit = pennylane.devices.default_qutrit:DefaultQutrit", - "default.clifford = pennylane.devices.default_clifford:DefaultClifford", - "default.qutrit.mixed = pennylane.devices.default_qutrit_mixed:DefaultQutritMixed", - "default.tensor = pennylane.devices.default_tensor:DefaultTensor", - ], - "console_scripts": ["pl-device-test=pennylane.devices.tests:cli"], - }, - "description": "PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.", - "long_description": open("README.md").read(), - "long_description_content_type": "text/markdown", - "provides": ["pennylane"], - "install_requires": requirements, - "extras_require": {"kernels": ["cvxpy", "cvxopt"]}, - "package_data": {"pennylane": ["devices/tests/pytest.ini", "drawer/plot.mplstyle"]}, - "include_package_data": True, -} - -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.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3 :: Only", - "Topic :: Scientific/Engineering :: Physics", -] - -setup(classifiers=classifiers, **(info)) From ce341422267b52b98da2bda030bc9b5929e3ecb8 Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Tue, 6 May 2025 13:20:12 -0400 Subject: [PATCH 09/23] added tools dynamic --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index d64ba83e4c3..d425395645f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,6 +70,9 @@ pl-device-test = "pennylane.devices.tests:cli" include-package-data = true py-modules = [] +[tool.setuptools.dynamic] +version = {attr = "pennylane._version.__version__"} + [tool.setuptools_scm] [project.license] From 59a0df499c941b7d6a245bcdca15eb4d7b507146 Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Tue, 6 May 2025 13:53:16 -0400 Subject: [PATCH 10/23] Trigger Build From e1fda00374a94d912e429a133e89ca9b883f1d18 Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Tue, 6 May 2025 15:49:28 -0400 Subject: [PATCH 11/23] setup.py --- setup.py | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 setup.py diff --git a/setup.py b/setup.py new file mode 100644 index 00000000000..b65d80b52e8 --- /dev/null +++ b/setup.py @@ -0,0 +1,93 @@ +# 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. +# 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. + +"""Setup file for package installation.""" +# pylint: disable=unspecified-encoding, consider-using-with + +from setuptools import find_packages, setup + +with open("pennylane/_version.py") as f: + version = f.readlines()[-1].split()[-1].strip("\"'") + +requirements = [ + "numpy", + "scipy", + "networkx", + "rustworkx>=0.14.0", + "autograd", + "tomlkit", + "appdirs", + "autoray>=0.6.11", + "cachetools", + "pennylane-lightning>=0.41", + "requests", + "typing_extensions", + "packaging", + "diastatic-malt", +] + +info = { + "name": "PennyLane", + "version": version, + "maintainer": "Xanadu Inc.", + "maintainer_email": "software@xanadu.ai", + "url": "https://github.com/PennyLaneAI/pennylane", + "license": "Apache License 2.0", + "packages": find_packages(where="."), + "entry_points": { + # TODO: rename entry point 'pennylane.plugins' to 'pennylane.devices'. + # This requires a rename in the setup file of all devices, and is best done during another refactor + "pennylane.plugins": [ + "default.qubit = pennylane.devices:DefaultQubit", + "default.gaussian = pennylane.devices:DefaultGaussian", + "default.mixed = pennylane.devices.default_mixed:DefaultMixed", + "reference.qubit = pennylane.devices.reference_qubit:ReferenceQubit", + "null.qubit = pennylane.devices.null_qubit:NullQubit", + "default.qutrit = pennylane.devices.default_qutrit:DefaultQutrit", + "default.clifford = pennylane.devices.default_clifford:DefaultClifford", + "default.qutrit.mixed = pennylane.devices.default_qutrit_mixed:DefaultQutritMixed", + "default.tensor = pennylane.devices.default_tensor:DefaultTensor", + ], + "console_scripts": ["pl-device-test=pennylane.devices.tests:cli"], + }, + "description": "PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.", + "long_description": open("README.md").read(), + "long_description_content_type": "text/markdown", + "provides": ["pennylane"], + "install_requires": requirements, + "extras_require": {"kernels": ["cvxpy", "cvxopt"]}, + "package_data": {"pennylane": ["devices/tests/pytest.ini", "drawer/plot.mplstyle"]}, + "include_package_data": True, +} + +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.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3 :: Only", + "Topic :: Scientific/Engineering :: Physics", +] + +setup(classifiers=classifiers, **(info)) From f6326a5880067acf7c5be236af35928ac21aedf3 Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Tue, 6 May 2025 16:31:06 -0400 Subject: [PATCH 12/23] update dockerfile --- docker/interfaces/gpu-cuda/cuda-base.dockerfile | 2 +- docker/pennylane.dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/interfaces/gpu-cuda/cuda-base.dockerfile b/docker/interfaces/gpu-cuda/cuda-base.dockerfile index 1c9ac554560..04d8b7d121f 100644 --- a/docker/interfaces/gpu-cuda/cuda-base.dockerfile +++ b/docker/interfaces/gpu-cuda/cuda-base.dockerfile @@ -42,7 +42,7 @@ COPY . . RUN git submodule update --init --recursive \ && pip install wheel \ && pip install -r requirements.txt \ - && python3 setup.py install \ + && python3 -m pip install . \ && pip install -r requirements-dev.txt \ && make test diff --git a/docker/pennylane.dockerfile b/docker/pennylane.dockerfile index cbb7f40f0a4..80e562a5664 100644 --- a/docker/pennylane.dockerfile +++ b/docker/pennylane.dockerfile @@ -41,7 +41,7 @@ WORKDIR /opt/pennylane COPY . . RUN git submodule update --init --recursive RUN pip install wheel && pip install -r requirements.txt -RUN python3 setup.py install +RUN python3 -m pip install . RUN pip install -r requirements-dev.txt RUN pip install -i https://test.pypi.org/simple/ pennylane-lightning --pre --upgrade # hotfix, remove when pyscf 2.1 is released (currently no wheel for python3.10) From 616de659e3665ca921a0a26f19688411c63031ea Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Tue, 6 May 2025 16:34:24 -0400 Subject: [PATCH 13/23] remove setup.py --- setup.py | 92 -------------------------------------------------------- 1 file changed, 92 deletions(-) delete mode 100644 setup.py diff --git a/setup.py b/setup.py deleted file mode 100644 index 1595dbc121a..00000000000 --- a/setup.py +++ /dev/null @@ -1,92 +0,0 @@ -# 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. -# 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. - -"""Setup file for package installation.""" -# pylint: disable=unspecified-encoding, consider-using-with - -from setuptools import find_packages, setup - -with open("pennylane/_version.py") as f: - version = f.readlines()[-1].split()[-1].strip("\"'") - -requirements = [ - "numpy", - "scipy", - "networkx", - "rustworkx>=0.14.0", - "autograd", - "tomlkit", - "appdirs", - "autoray>=0.6.11", - "cachetools", - "pennylane-lightning>=0.41", - "requests", - "typing_extensions", - "packaging", - "diastatic-malt", -] - -info = { - "name": "PennyLane", - "version": version, - "maintainer": "Xanadu Inc.", - "maintainer_email": "software@xanadu.ai", - "url": "https://github.com/PennyLaneAI/pennylane", - "license": "Apache License 2.0", - "packages": find_packages(where="."), - "entry_points": { - # TODO: rename entry point 'pennylane.plugins' to 'pennylane.devices'. - # This requires a rename in the setup file of all devices, and is best done during another refactor - "pennylane.plugins": [ - "default.qubit = pennylane.devices:DefaultQubit", - "default.gaussian = pennylane.devices:DefaultGaussian", - "default.mixed = pennylane.devices.default_mixed:DefaultMixed", - "reference.qubit = pennylane.devices.reference_qubit:ReferenceQubit", - "null.qubit = pennylane.devices.null_qubit:NullQubit", - "default.qutrit = pennylane.devices.default_qutrit:DefaultQutrit", - "default.clifford = pennylane.devices.default_clifford:DefaultClifford", - "default.qutrit.mixed = pennylane.devices.default_qutrit_mixed:DefaultQutritMixed", - "default.tensor = pennylane.devices.default_tensor:DefaultTensor", - ], - "console_scripts": ["pl-device-test=pennylane.devices.tests:cli"], - }, - "description": "PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.", - "long_description": open("README.md").read(), - "long_description_content_type": "text/markdown", - "provides": ["pennylane"], - "install_requires": requirements, - "extras_require": {"kernels": ["cvxpy", "cvxopt"]}, - "package_data": {"pennylane": ["devices/tests/pytest.ini", "drawer/plot.mplstyle"]}, - "include_package_data": True, -} - -classifiers = [ - "Development Status :: 4 - Beta", - "Environment :: Console", - "Intended Audience :: Science/Research", - "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.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3 :: Only", - "Topic :: Scientific/Engineering :: Physics", -] - -setup(classifiers=classifiers, **(info)) From 58eab8ebdd2a8e628601c878abacc20d5ffed57a Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Wed, 7 May 2025 11:55:05 -0400 Subject: [PATCH 14/23] Moving setup.py to bacup file --- setup.py.bak | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 setup.py.bak diff --git a/setup.py.bak b/setup.py.bak new file mode 100644 index 00000000000..9753f1acb08 --- /dev/null +++ b/setup.py.bak @@ -0,0 +1,92 @@ +# 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. +# 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. + +"""Old setup file for package installation; kept for reference.""" +# pylint: disable=unspecified-encoding, consider-using-with + +from setuptools import find_packages, setup + +with open("pennylane/_version.py") as f: + version = f.readlines()[-1].split()[-1].strip("\"'") + +requirements = [ + "numpy", + "scipy", + "networkx", + "rustworkx>=0.14.0", + "autograd", + "tomlkit", + "appdirs", + "autoray>=0.6.11", + "cachetools", + "pennylane-lightning>=0.41", + "requests", + "typing_extensions", + "packaging", + "diastatic-malt", +] + +info = { + "name": "PennyLane", + "version": version, + "maintainer": "Xanadu Inc.", + "maintainer_email": "software@xanadu.ai", + "url": "https://github.com/PennyLaneAI/pennylane", + "license": "Apache License 2.0", + "packages": find_packages(where="."), + "entry_points": { + # TODO: rename entry point 'pennylane.plugins' to 'pennylane.devices'. + # This requires a rename in the setup file of all devices, and is best done during another refactor + "pennylane.plugins": [ + "default.qubit = pennylane.devices:DefaultQubit", + "default.gaussian = pennylane.devices:DefaultGaussian", + "default.mixed = pennylane.devices.default_mixed:DefaultMixed", + "reference.qubit = pennylane.devices.reference_qubit:ReferenceQubit", + "null.qubit = pennylane.devices.null_qubit:NullQubit", + "default.qutrit = pennylane.devices.default_qutrit:DefaultQutrit", + "default.clifford = pennylane.devices.default_clifford:DefaultClifford", + "default.qutrit.mixed = pennylane.devices.default_qutrit_mixed:DefaultQutritMixed", + "default.tensor = pennylane.devices.default_tensor:DefaultTensor", + ], + "console_scripts": ["pl-device-test=pennylane.devices.tests:cli"], + }, + "description": "PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.", + "long_description": open("README.md").read(), + "long_description_content_type": "text/markdown", + "provides": ["pennylane"], + "install_requires": requirements, + "extras_require": {"kernels": ["cvxpy", "cvxopt"]}, + "package_data": {"pennylane": ["devices/tests/pytest.ini", "drawer/plot.mplstyle"]}, + "include_package_data": True, +} + +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: Science/Research", + "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.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3 :: Only", + "Topic :: Scientific/Engineering :: Physics", +] + +setup(classifiers=classifiers, **(info)) From 6330f0df42f213d6fc42113cfff11bce4ade6793 Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Wed, 7 May 2025 11:57:27 -0400 Subject: [PATCH 15/23] changing to setup-dev --- setup.py.bak | 92 ---------------------------------------------------- 1 file changed, 92 deletions(-) delete mode 100644 setup.py.bak diff --git a/setup.py.bak b/setup.py.bak deleted file mode 100644 index 9753f1acb08..00000000000 --- a/setup.py.bak +++ /dev/null @@ -1,92 +0,0 @@ -# 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. -# 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. - -"""Old setup file for package installation; kept for reference.""" -# pylint: disable=unspecified-encoding, consider-using-with - -from setuptools import find_packages, setup - -with open("pennylane/_version.py") as f: - version = f.readlines()[-1].split()[-1].strip("\"'") - -requirements = [ - "numpy", - "scipy", - "networkx", - "rustworkx>=0.14.0", - "autograd", - "tomlkit", - "appdirs", - "autoray>=0.6.11", - "cachetools", - "pennylane-lightning>=0.41", - "requests", - "typing_extensions", - "packaging", - "diastatic-malt", -] - -info = { - "name": "PennyLane", - "version": version, - "maintainer": "Xanadu Inc.", - "maintainer_email": "software@xanadu.ai", - "url": "https://github.com/PennyLaneAI/pennylane", - "license": "Apache License 2.0", - "packages": find_packages(where="."), - "entry_points": { - # TODO: rename entry point 'pennylane.plugins' to 'pennylane.devices'. - # This requires a rename in the setup file of all devices, and is best done during another refactor - "pennylane.plugins": [ - "default.qubit = pennylane.devices:DefaultQubit", - "default.gaussian = pennylane.devices:DefaultGaussian", - "default.mixed = pennylane.devices.default_mixed:DefaultMixed", - "reference.qubit = pennylane.devices.reference_qubit:ReferenceQubit", - "null.qubit = pennylane.devices.null_qubit:NullQubit", - "default.qutrit = pennylane.devices.default_qutrit:DefaultQutrit", - "default.clifford = pennylane.devices.default_clifford:DefaultClifford", - "default.qutrit.mixed = pennylane.devices.default_qutrit_mixed:DefaultQutritMixed", - "default.tensor = pennylane.devices.default_tensor:DefaultTensor", - ], - "console_scripts": ["pl-device-test=pennylane.devices.tests:cli"], - }, - "description": "PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.", - "long_description": open("README.md").read(), - "long_description_content_type": "text/markdown", - "provides": ["pennylane"], - "install_requires": requirements, - "extras_require": {"kernels": ["cvxpy", "cvxopt"]}, - "package_data": {"pennylane": ["devices/tests/pytest.ini", "drawer/plot.mplstyle"]}, - "include_package_data": True, -} - -classifiers = [ - "Development Status :: 4 - Beta", - "Environment :: Console", - "Intended Audience :: Science/Research", - "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.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3 :: Only", - "Topic :: Scientific/Engineering :: Physics", -] - -setup(classifiers=classifiers, **(info)) From adf55ea803ee08bab21d5ce3d9f022750e3fc36d Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Wed, 7 May 2025 14:30:27 -0400 Subject: [PATCH 16/23] changed setup.py --- setup.py | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 setup.py diff --git a/setup.py b/setup.py new file mode 100644 index 00000000000..b82413d10f2 --- /dev/null +++ b/setup.py @@ -0,0 +1,92 @@ +# 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. +# 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. + +"""Old setup file for package installation; kept for reference.""" +# pylint: disable=unspecified-encoding, consider-using-with + +from setuptools import find_packages, setup + +with open("pennylane/_version.py") as f: + version = f.readlines()[-1].split()[-1].strip("\"'") + +requirements = [ + "numpy", + "scipy", + "networkx", + "rustworkx>=0.14.0", + "autograd", + "tomlkit", + "appdirs", + "autoray>=0.6.11", + "cachetools", + "pennylane-lightning>=0.41", + "requests", + "typing_extensions", + "packaging", + "diastatic-malt", +] + +info = { + "name": "PennyLane", + "version": version, + "maintainer": "Xanadu Inc.", + "maintainer_email": "software@xanadu.ai", + "url": "https://github.com/PennyLaneAI/pennylane", + "license": "Apache License 2.0", + "packages": find_packages(where="."), + "entry_points": { + # TODO: rename entry point 'pennylane.plugins' to 'pennylane.devices'. + # This requires a rename in the setup file of all devices, and is best done during another refactor + "pennylane.plugins": [ + "default.qubit = pennylane.devices:DefaultQubit", + "default.gaussian = pennylane.devices:DefaultGaussian", + "default.mixed = pennylane.devices.default_mixed:DefaultMixed", + "reference.qubit = pennylane.devices.reference_qubit:ReferenceQubit", + "null.qubit = pennylane.devices.null_qubit:NullQubit", + "default.qutrit = pennylane.devices.default_qutrit:DefaultQutrit", + "default.clifford = pennylane.devices.default_clifford:DefaultClifford", + "default.qutrit.mixed = pennylane.devices.default_qutrit_mixed:DefaultQutritMixed", + "default.tensor = pennylane.devices.default_tensor:DefaultTensor", + ], + "console_scripts": ["pl-device-test=pennylane.devices.tests:cli"], + }, + "description": "PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.", + "long_description": open("README.md").read(), + "long_description_content_type": "text/markdown", + "provides": ["pennylane"], + "install_requires": requirements, + "extras_require": {"kernels": ["cvxpy", "cvxopt"]}, + "package_data": {"pennylane": ["devices/tests/pytest.ini", "drawer/plot.mplstyle"]}, + "include_package_data": True, +} + +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: Science/Research", + "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.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3 :: Only", + "Topic :: Scientific/Engineering :: Physics", +] + +setup() From e646c88894e568502177df5ece2faafe73c74a5c Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Wed, 7 May 2025 14:45:22 -0400 Subject: [PATCH 17/23] Moved license in toml --- pyproject.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d425395645f..66bd51fda96 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,6 +6,7 @@ build-backend = "setuptools.build_meta" name = "Pennylane" description = "PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network." readme = "README.md" +license = {text = "Apache-2.0"} requires-python = ">=3.10" dynamic = ["version"] dependencies = [ @@ -75,9 +76,6 @@ version = {attr = "pennylane._version.__version__"} [tool.setuptools_scm] -[project.license] -text = "Apache License 2.0" - [tool.setuptools.package-data] pennylane = ["devices/tests/pytest.ini", "drawer/plot.mplstyle"] From afb79144a1e7ccd9640d216e9ca9fef7d3337ce9 Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Wed, 7 May 2025 15:45:39 -0400 Subject: [PATCH 18/23] fixed licence in classifiers --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 66bd51fda96..29ee772b553 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" name = "Pennylane" description = "PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network." readme = "README.md" -license = {text = "Apache-2.0"} +license = "Apache-2.0" requires-python = ">=3.10" dynamic = ["version"] dependencies = [ @@ -29,7 +29,6 @@ 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", From 3c174006a5925df647ca5ba83eae384adaa438bc Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Wed, 7 May 2025 16:04:56 -0400 Subject: [PATCH 19/23] updated changelog-dev --- doc/releases/changelog-dev.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 7cae085ba7a..8b579a59737 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -175,6 +175,8 @@ * Sphinx version was updated to 8.1. Sphinx is upgraded to version 8.1 and uses Python 3.10. References to intersphinx (e.g. `` or `` are updated to remove the :doc: prefix that is incompatible with sphinx 8.1. [(7212)](https://github.com/PennyLaneAI/pennylane/pull/7212) +* Migrated `setup.py` package build and install to `pyproject.toml` [(#7375)](https://github.com/PennyLaneAI/pennylane/pull/7375) +

Breaking changes 💔

* The `return_type` property of `MeasurementProcess` has been removed. Please use `isinstance` for type checking instead. From bccd63899098b726665a45f7a8ccd6979543564f Mon Sep 17 00:00:00 2001 From: runora95 <59572091+runora95@users.noreply.github.com> Date: Thu, 8 May 2025 13:55:26 -0400 Subject: [PATCH 20/23] Update doc/releases/changelog-dev.md Co-authored-by: Yushao Chen (Jerry) --- doc/releases/changelog-dev.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 8b579a59737..10693a121d3 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -173,9 +173,11 @@ interface to maintain a list of special implementations. [(#7327)](https://github.com/PennyLaneAI/pennylane/pull/7327) -* Sphinx version was updated to 8.1. Sphinx is upgraded to version 8.1 and uses Python 3.10. References to intersphinx (e.g. `` or `` are updated to remove the :doc: prefix that is incompatible with sphinx 8.1. [(7212)](https://github.com/PennyLaneAI/pennylane/pull/7212) +* Sphinx version was updated to 8.1. Sphinx is upgraded to version 8.1 and uses Python 3.10. References to intersphinx (e.g. `` or `` are updated to remove the :doc: prefix that is incompatible with sphinx 8.1. + [(7212)](https://github.com/PennyLaneAI/pennylane/pull/7212) -* Migrated `setup.py` package build and install to `pyproject.toml` [(#7375)](https://github.com/PennyLaneAI/pennylane/pull/7375) +* Migrated `setup.py` package build and install to `pyproject.toml` + [(#7375)](https://github.com/PennyLaneAI/pennylane/pull/7375)

Breaking changes 💔

From 53cf7ba1644efc9fb5c02230ed5b8cb17fb75452 Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Thu, 8 May 2025 14:03:31 -0400 Subject: [PATCH 21/23] removing cmake --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 29ee772b553..ed01d89b9ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["cmake", "setuptools>=75", "tomli"] +requires = ["setuptools>=75", "tomli"] build-backend = "setuptools.build_meta" [project] From 61406ed1a38790c7308920c03c658f5b8b2dda60 Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Thu, 8 May 2025 16:44:21 -0400 Subject: [PATCH 22/23] clearing setup.py --- setup.py | 89 -------------------------------------------------------- 1 file changed, 89 deletions(-) diff --git a/setup.py b/setup.py index b82413d10f2..3e1cbcd3f74 100644 --- a/setup.py +++ b/setup.py @@ -1,92 +1,3 @@ -# 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. -# 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. - -"""Old setup file for package installation; kept for reference.""" -# pylint: disable=unspecified-encoding, consider-using-with - from setuptools import find_packages, setup -with open("pennylane/_version.py") as f: - version = f.readlines()[-1].split()[-1].strip("\"'") - -requirements = [ - "numpy", - "scipy", - "networkx", - "rustworkx>=0.14.0", - "autograd", - "tomlkit", - "appdirs", - "autoray>=0.6.11", - "cachetools", - "pennylane-lightning>=0.41", - "requests", - "typing_extensions", - "packaging", - "diastatic-malt", -] - -info = { - "name": "PennyLane", - "version": version, - "maintainer": "Xanadu Inc.", - "maintainer_email": "software@xanadu.ai", - "url": "https://github.com/PennyLaneAI/pennylane", - "license": "Apache License 2.0", - "packages": find_packages(where="."), - "entry_points": { - # TODO: rename entry point 'pennylane.plugins' to 'pennylane.devices'. - # This requires a rename in the setup file of all devices, and is best done during another refactor - "pennylane.plugins": [ - "default.qubit = pennylane.devices:DefaultQubit", - "default.gaussian = pennylane.devices:DefaultGaussian", - "default.mixed = pennylane.devices.default_mixed:DefaultMixed", - "reference.qubit = pennylane.devices.reference_qubit:ReferenceQubit", - "null.qubit = pennylane.devices.null_qubit:NullQubit", - "default.qutrit = pennylane.devices.default_qutrit:DefaultQutrit", - "default.clifford = pennylane.devices.default_clifford:DefaultClifford", - "default.qutrit.mixed = pennylane.devices.default_qutrit_mixed:DefaultQutritMixed", - "default.tensor = pennylane.devices.default_tensor:DefaultTensor", - ], - "console_scripts": ["pl-device-test=pennylane.devices.tests:cli"], - }, - "description": "PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.", - "long_description": open("README.md").read(), - "long_description_content_type": "text/markdown", - "provides": ["pennylane"], - "install_requires": requirements, - "extras_require": {"kernels": ["cvxpy", "cvxopt"]}, - "package_data": {"pennylane": ["devices/tests/pytest.ini", "drawer/plot.mplstyle"]}, - "include_package_data": True, -} - -classifiers = [ - "Development Status :: 4 - Beta", - "Environment :: Console", - "Intended Audience :: Science/Research", - "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.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3 :: Only", - "Topic :: Scientific/Engineering :: Physics", -] - setup() From 057539f008aeb662c4ff301fd33f7e0d3c2a5736 Mon Sep 17 00:00:00 2001 From: Runor Agbaire Date: Thu, 8 May 2025 16:50:57 -0400 Subject: [PATCH 23/23] updating requires --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ed01d89b9ee..3945ccca81b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=75", "tomli"] +requires = ["setuptools>=75.8.1"] build-backend = "setuptools.build_meta" [project]