From 49cda811fcfed53f24fa4f71456ddc5ee1477659 Mon Sep 17 00:00:00 2001 From: Sam Grayson Date: Mon, 28 Nov 2022 15:10:10 -0700 Subject: [PATCH] Add new version of snakemake (#34041) * Add new version of snakemake * Add myself as a maintainer * py-retry -> py-reretry * Added snakemake variants for storage systems * Updated comments * Responded to Adam's comments * Fixed spack style * Add build/run dependency types --- .../builtin/packages/py-ftputil/package.py | 24 +++++++++++++ .../builtin/packages/py-reretry/package.py | 19 ++++++++++ .../builtin/packages/py-throttler/package.py | 19 ++++++++++ .../repos/builtin/packages/py-yte/package.py | 26 ++++++++++++++ .../builtin/packages/snakemake/package.py | 35 +++++++++++++++---- 5 files changed, 116 insertions(+), 7 deletions(-) create mode 100644 var/spack/repos/builtin/packages/py-ftputil/package.py create mode 100644 var/spack/repos/builtin/packages/py-reretry/package.py create mode 100644 var/spack/repos/builtin/packages/py-throttler/package.py create mode 100644 var/spack/repos/builtin/packages/py-yte/package.py diff --git a/var/spack/repos/builtin/packages/py-ftputil/package.py b/var/spack/repos/builtin/packages/py-ftputil/package.py new file mode 100644 index 0000000000..289fa7da5d --- /dev/null +++ b/var/spack/repos/builtin/packages/py-ftputil/package.py @@ -0,0 +1,24 @@ +# 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 PyFtputil(PythonPackage): + """High-level FTP client for Python.""" + + homepage = "https://ftputil.sschwarzer.net" + pypi = "ftputil/ftputil-5.0.4.tar.gz" + maintainers = ["charmoniumQ"] + + version("5.0.4", sha256="6889db8649dd20d9b6d40a6c5f0f84ccf340a7dac1e0bfc0f0024090fc2afb33") + + # https://git.sr.ht/~sschwarzer/ftputil/tree/v5.0.4/item/setup.py + depends_on("python@3.6:", type=("build", "run")) + depends_on("py-setuptools", type="build") + + # https://git.sr.ht/~sschwarzer/ftputil/tree/v5.0.4/item/requirements.txt + # Note that the requirements in `requirements.txt` are only necessary for a dev environment. + # They are not included in `setup.py` diff --git a/var/spack/repos/builtin/packages/py-reretry/package.py b/var/spack/repos/builtin/packages/py-reretry/package.py new file mode 100644 index 0000000000..ba56dd0a25 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-reretry/package.py @@ -0,0 +1,19 @@ +# 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 PyReretry(PythonPackage): + """Easy to use retry decorator.""" + + homepage = "https://github.com/leshchenko1979/reretry" + pypi = "reretry/reretry-0.11.1.tar.gz" + maintainers = ["charmoniumQ"] + + version("0.11.1", sha256="4ae1840ae9e443822bb70543c485bb9c45d1d009e32bd6809f2a9f2839149f5d") + + depends_on("py-setuptools", type="build") + depends_on("py-pbr", type="build") diff --git a/var/spack/repos/builtin/packages/py-throttler/package.py b/var/spack/repos/builtin/packages/py-throttler/package.py new file mode 100644 index 0000000000..4be87f65aa --- /dev/null +++ b/var/spack/repos/builtin/packages/py-throttler/package.py @@ -0,0 +1,19 @@ +# 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 PyThrottler(PythonPackage): + """Zero dependency Python package for easy throttling with asyncio support.""" + + homepage = "https://github.com/uburuntu/throttler" + pypi = "throttler/throttler-1.2.1.tar.gz" + + maintainers = ["charmoniumQ"] + + version("1.2.2", sha256="d54db406d98e1b54d18a9ba2b31ab9f093ac64a0a59d730c1cf7bb1cdfc94a58") + + depends_on("py-setuptools", type="build") diff --git a/var/spack/repos/builtin/packages/py-yte/package.py b/var/spack/repos/builtin/packages/py-yte/package.py new file mode 100644 index 0000000000..9c1c923f30 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-yte/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 PyYte(PythonPackage): + """A YAML template engine with Python expressions.""" + + homepage = "https://yte-template-engine.github.io" + pypi = "yte/yte-1.5.1.tar.gz" + + maintainers = ["charmoniumQ"] + + version("1.5.1", sha256="6d0b315b78af83276d78f5f67c107c84238f772a76d74f4fc77905b46f3731f5") + + # https://github.com/yte-template-engine/yte/blob/v1.5.1/pyproject.toml#L12 + depends_on("py-dpath@2", type=("build", "run")) + depends_on("py-plac@1.3.4:1", type=("build", "run")) + depends_on("python@3.7:", type=("build", "run")) + depends_on("py-pyyaml@6", type=("build", "run")) + + # https://github.com/yte-template-engine/yte/blob/v1.5.1/pyproject.toml#L41 + depends_on("py-poetry-core@1:", type="build") diff --git a/var/spack/repos/builtin/packages/snakemake/package.py b/var/spack/repos/builtin/packages/snakemake/package.py index 8b84f02499..6b6d86e5d8 100644 --- a/var/spack/repos/builtin/packages/snakemake/package.py +++ b/var/spack/repos/builtin/packages/snakemake/package.py @@ -13,15 +13,18 @@ class Snakemake(PythonPackage): pypi = "snakemake/snakemake-6.12.3.tar.gz" maintainers = ["marcusboden"] + version("7.18.2", sha256="23f52b9a0c86da3b974a3cfc097fa82b41c49dab05543c0d18377c854852f771") version("6.15.1", sha256="a219601d57037f565ead9963e6bd8d04d3bdd985d172371e54197dcbdba79865") version("6.13.1", sha256="22f57dcd8b1ca8a30aaa45c5d2c0f56d381d4731abd0988f24f9de46b7d9827c") version("6.12.3", sha256="af86af9a540da3dceb05dad1040f1d3d733e6a695f8b3f8c30f8cf3bc6570a88") - depends_on("py-requests", type=("build", "run")) depends_on("py-setuptools", type=("build", "run")) - depends_on("py-wrapt", type=("build", "run")) + depends_on("py-setuptools@42:", type=("build", "run"), when="@7:") - depends_on("python@3.5:") + # See https://github.com/snakemake/snakemake/blob/v7.18.2/setup.py#L56 + depends_on("py-wrapt", type=("build", "run")) + depends_on("py-requests", type=("build", "run")) + depends_on("py-throttler", type=("build", "run"), when="@7:") depends_on("py-pyyaml", type=("build", "run")) depends_on("py-configargparse", type=("build", "run")) depends_on("py-appdirs", type=("build", "run")) @@ -33,12 +36,15 @@ class Snakemake(PythonPackage): depends_on("py-nbformat", type=("build", "run")) depends_on("py-toposort", type=("build", "run")) depends_on("py-connectionpool@0.0.3:", type=("build", "run")) - depends_on("py-pulp@2.0:", type=("build", "run")) - depends_on("py-smart-open@3.0:", type=("build", "run")) - depends_on("py-filelock", type=("build", "run")) + depends_on("py-pulp@2:", type=("build", "run")) + depends_on("py-smart-open@3:", type=("build", "run")) + depends_on("py-filelock", type=("build", "run"), when="@:6") depends_on("py-stopit", type=("build", "run")) depends_on("py-tabulate", type=("build", "run")) - depends_on("py-ratelimiter", type=("build", "run")) + depends_on("py-ratelimiter", type=("build", "run"), when="@:6") + depends_on("py-yte@1", type=("build", "run"), when="@7:") + depends_on("py-jinja2@3", type=("build", "run"), when="@7:") + depends_on("py-reretry", type=("build", "run"), when="@7:") variant("reports", default=False, description="Generate self-contained HTML reports") with when("+reports"): @@ -53,3 +59,18 @@ class Snakemake(PythonPackage): depends_on("py-google-crc32c", type=("build", "run")) depends_on("py-google-api-python-client", type=("build", "run")) depends_on("py-google-cloud-storage", type=("build", "run")) + + # These variants are not in PyPI/pip, but they are undocumented dependencies + # needed to make certain parts of Snakemake work. + variant("ftp", default=False, description="Enable snakemake.remote.FTP") + depends_on("py-ftputil", when="+ftp", type=("build", "run")) + + variant("s3", default=False, description="Enable snakemake.remote.S3") + depends_on("py-boto3", when="+s3", type=("build", "run")) + depends_on("py-botocore", when="+s3", type=("build", "run")) + + variant("http", default=False, description="Enable snakemake.remote.HTTP") + depends_on("py-requests", when="+http", type=("build", "run")) + + def test(self): + Executable("snakemake")("--version")