From a5ef522f982200ab8b052d9eb1915880ebc15e23 Mon Sep 17 00:00:00 2001 From: Marco De La Pierre Date: Sat, 7 Jan 2023 08:02:06 +0800 Subject: Adding py-pennylane from Xanadu (#34838) * draft for py-pennylane recipe * first draft for py-strawberryfields recipe * minimal fix * small fixes * accounting for circular dep in py-pennylane and py-pennylane-lightning * removing py-strawberryfields from this branch * updated versions for py-pennylane 2x * needs cmake * py-pennylane-lightning using github tarball * Update var/spack/repos/builtin/packages/py-autoray/package.py Co-authored-by: Adam J. Stewart * Update var/spack/repos/builtin/packages/py-pennylane-lightning/package.py Co-authored-by: Adam J. Stewart Co-authored-by: Adam J. Stewart --- .../repos/builtin/packages/py-autoray/package.py | 20 +++++++++++++ .../packages/py-pennylane-lightning/package.py | 26 +++++++++++++++++ .../repos/builtin/packages/py-pennylane/package.py | 34 ++++++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-autoray/package.py create mode 100644 var/spack/repos/builtin/packages/py-pennylane-lightning/package.py create mode 100644 var/spack/repos/builtin/packages/py-pennylane/package.py diff --git a/var/spack/repos/builtin/packages/py-autoray/package.py b/var/spack/repos/builtin/packages/py-autoray/package.py new file mode 100644 index 0000000000..bd0396b352 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-autoray/package.py @@ -0,0 +1,20 @@ +# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +from spack.package import * + + +class PyAutoray(PythonPackage): + """Write backend agnostic numeric code compatible with any numpy-ish array library.""" + + homepage = "https://github.com/jcmgray/autoray" + pypi = "autoray/autoray-0.5.3.tar.gz" + + version("0.5.3", sha256="ecbecbc1ab65dd704234b3307fa7c7a511a36f6b9339a0ffcdaa4e5a7aab826b") + + depends_on("python@3.6:", type=("build", "run")) + depends_on("py-setuptools@45:", type="build") + depends_on("py-setuptools-scm@6.2:+toml", type="build") diff --git a/var/spack/repos/builtin/packages/py-pennylane-lightning/package.py b/var/spack/repos/builtin/packages/py-pennylane-lightning/package.py new file mode 100644 index 0000000000..1315e67c81 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-pennylane-lightning/package.py @@ -0,0 +1,26 @@ +# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +from spack.package import * + + +class PyPennylaneLightning(PythonPackage): + """PennyLane-Lightning plugin""" + + homepage = "https://github.com/PennyLaneAI/pennylane-lightning" + url = "https://github.com/PennyLaneAI/pennylane-lightning/archive/refs/tags/v0.28.0.tar.gz" + # using github for now, because pypi tarball is missing the CMakeLists.txt file + # pypi = "PennyLane-Lightning/PennyLane-Lightning-0.28.0.tar.gz" + + version("0.28.0", sha256="f5849c2affb5fb57aca20feb40ca829d171b07db2304fde0a37c2332c5b09e18") + + depends_on("python@3.8:", type=("build", "run")) + depends_on("py-setuptools", type="build") + depends_on("cmake@3.16:", type="build") + + depends_on("py-ninja", type=("build", "run")) + depends_on("py-numpy", type=("build", "run")) + # depends_on("py-pennylane@0.19:", type=("build", "run")) # circular dependency diff --git a/var/spack/repos/builtin/packages/py-pennylane/package.py b/var/spack/repos/builtin/packages/py-pennylane/package.py new file mode 100644 index 0000000000..e5f47792e3 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-pennylane/package.py @@ -0,0 +1,34 @@ +# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +from spack.package import * + + +class PyPennylane(PythonPackage): + """PennyLane is a Python quantum machine learning library by Xanadu Inc.""" + + homepage = "https://github.com/XanaduAI/pennylane" + pypi = "PennyLane/PennyLane-0.28.0.tar.gz" + + maintainers = ["marcodelapierre"] + + version("0.28.0", sha256="2a6100c00277c1eb59eab6856cdad7b1237e9d1fbda98b1e15020bd5a64b10a8") + + depends_on("python@3.8:", type=("build", "run")) + depends_on("py-setuptools", type="build") + + depends_on("py-numpy@:1.23", type=("build", "run")) + depends_on("py-scipy", type=("build", "run")) + depends_on("py-networkx", type=("build", "run")) + depends_on("py-retworkx", type=("build", "run")) + depends_on("py-autograd", type=("build", "run")) + depends_on("py-toml", type=("build", "run")) + depends_on("py-appdirs", type=("build", "run")) + depends_on("py-semantic-version@2.7:", type=("build", "run")) + depends_on("py-autoray@0.3.1:", type=("build", "run")) + depends_on("py-cachetools", type=("build", "run")) + depends_on("py-pennylane-lightning@0.28:", type=("build", "run")) + depends_on("py-requests", type=("build", "run")) -- cgit v1.2.3-70-g09d2