From d25315c2f6e2be4aeda121dfbafc9ad943fb7a0c Mon Sep 17 00:00:00 2001 From: Stephen Sachs Date: Wed, 13 Jul 2022 22:12:28 +0200 Subject: Add package py-devito and it's dependencies (#31495) * [py-devito] Add package Also add dependencies: - py-nbval - py-cgen - py-codepy - py-contexttimer - py-pyrevolve * [py-devito] Fix some typos * [py-devito] Fix: include examples directory Upstream issue: https://github.com/devitocodes/devito/issues/1954 * [py-devito] clean up * [py-devito] clean up dependency packages * [py-devito] flake8: line too long * Address @adamjstewart comments * Make flake8 happy Co-authored-by: Stephen Sachs --- .../repos/builtin/packages/py-cgen/package.py | 21 +++++++ .../repos/builtin/packages/py-codepy/package.py | 27 ++++++++ .../builtin/packages/py-contexttimer/package.py | 21 +++++++ .../repos/builtin/packages/py-devito/package.py | 71 ++++++++++++++++++++++ .../repos/builtin/packages/py-nbval/package.py | 29 +++++++++ .../repos/builtin/packages/py-pyrevolve/package.py | 23 +++++++ 6 files changed, 192 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-cgen/package.py create mode 100644 var/spack/repos/builtin/packages/py-codepy/package.py create mode 100644 var/spack/repos/builtin/packages/py-contexttimer/package.py create mode 100644 var/spack/repos/builtin/packages/py-devito/package.py create mode 100644 var/spack/repos/builtin/packages/py-nbval/package.py create mode 100644 var/spack/repos/builtin/packages/py-pyrevolve/package.py (limited to 'var') diff --git a/var/spack/repos/builtin/packages/py-cgen/package.py b/var/spack/repos/builtin/packages/py-cgen/package.py new file mode 100644 index 0000000000..9d93d21fa7 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-cgen/package.py @@ -0,0 +1,21 @@ +# 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 PyCgen(PythonPackage): + """cgen offers a simple abstract syntax tree for C and related languages + (C++/CUDA/OpenCL) to allow structured code generation from Python. + """ + + homepage = "https://documen.tician.de/cgen/" + pypi = "cgen/cgen-2020.1.tar.gz" + + version('2020.1', sha256='4ec99d0c832d9f95f5e51dd18a629ad50df0b5464ce557ef42c6e0cd9478bfcf') + + depends_on('py-pytools@2015.1.2:', type=('build', 'run')) + depends_on('py-numpy@1.6:', type=('build', 'run')) + depends_on('py-setuptools', type='build') diff --git a/var/spack/repos/builtin/packages/py-codepy/package.py b/var/spack/repos/builtin/packages/py-codepy/package.py new file mode 100644 index 0000000000..4f5ba19a3b --- /dev/null +++ b/var/spack/repos/builtin/packages/py-codepy/package.py @@ -0,0 +1,27 @@ +# 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 PyCodepy(PythonPackage): + """CodePy is a C metaprogramming toolkit for Python. + + It handles two aspects of metaprogramming: + - Generating C source code. + - Compiling this source code and dynamically loading it into the Python interpreter. + """ + + homepage = "https://documen.tician.de/codepy/" + pypi = "codepy/codepy-2019.1.tar.gz" + + version('2019.1', sha256='384f22c37fe987c0ca71951690c3c2fd14dacdeddbeb0fde4fd01cd84859c94e') + + depends_on('py-setuptools', type='build') + depends_on('py-pytools@2015.1.2:', type=('build', 'run')) + depends_on('py-numpy@1.6:', type=('build', 'run')) + depends_on('py-appdirs@1.4.0:', type=('build', 'run')) + depends_on('py-six', type=('build', 'run')) + depends_on('py-cgen', type=('build', 'run')) diff --git a/var/spack/repos/builtin/packages/py-contexttimer/package.py b/var/spack/repos/builtin/packages/py-contexttimer/package.py new file mode 100644 index 0000000000..24164747e0 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-contexttimer/package.py @@ -0,0 +1,21 @@ +# 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 PyContexttimer(PythonPackage): + """A timer as a context manager. + + contexttimer provides you with a couple of utilities to quickly measure the + execution time of a code block or a function. + """ + + homepage = "https://github.com/brouberol/contexttimer" + pypi = "contexttimer/contexttimer-0.3.3.tar.gz" + + version('0.3.3', sha256='35a1efd389af3f1ca509f33ff23e17d98b66c8fde5ba2a4eb8a8b7fa456598a5') + + depends_on('py-setuptools', type='build') diff --git a/var/spack/repos/builtin/packages/py-devito/package.py b/var/spack/repos/builtin/packages/py-devito/package.py new file mode 100644 index 0000000000..13f1050d59 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-devito/package.py @@ -0,0 +1,71 @@ +# 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 PyDevito(PythonPackage): + """Devito is a Python package to implement optimized stencil computation. + + (e.g., finite differences, image processing, machine learning) from high-level + symbolic problem definitions. Devito builds on SymPy and employs automated code + generation and just-in-time compilation to execute optimized computational kernels + on several computer platforms, including CPUs, GPUs, and clusters thereof. + """ + + homepage = "https://www.devitoproject.org/" + pypi = "devito/devito-4.6.2.tar.gz" + + version('4.6.2', sha256='39c2210a192ad69953b4f8d93440ffd72b07d739c4fe2290e2b182adfb7e143f') + + variant('mpi', default=False, description='Enable MPI support') + variant('matplotlib', default=False, description='Enable matplolib support') + variant('ipyparallel', default=False, description='Enable ipyparallel support') + variant('pandas', default=False, description='Enable pandas support') + + depends_on('py-pip@9.0.1:', type='build') + depends_on('py-setuptools', type='build') + + depends_on('py-numpy@1.16:', type=('build', 'run')) + depends_on('py-sympy@1.7:1.9', type=('build', 'run')) + depends_on('py-scipy', type=('build', 'run')) + depends_on('py-flake8@2.1.0:', type=('build', 'run')) + depends_on('py-nbval', type=('build', 'run')) + depends_on('py-cached-property', type=('build', 'run')) + depends_on('py-psutil@5.1.0:5', type=('build', 'run')) + depends_on('py-py-cpuinfo@:8', type=('build', 'run')) + depends_on('py-cgen@2020.1:', type=('build', 'run')) + depends_on('py-codepy@2019.1:', type=('build', 'run')) + depends_on('py-click@:8', type=('build', 'run')) + depends_on('py-codecov', type=('build', 'run')) + depends_on('py-multidict', type=('build', 'run')) + depends_on('py-anytree@2.4.3:2.8', type=('build', 'run')) + depends_on('py-pyrevolve@2.1.3:', type=('build', 'run')) + depends_on('py-distributed@:2022.2', type=('build', 'run')) + depends_on('py-pytest@3.6:6', type=('build', 'run')) + depends_on('py-pytest-runner', type=('build', 'run')) + depends_on('py-pytest-cov', type=('build', 'run')) + + # requirements-mpi.tct + depends_on('py-mpi4py', type=('build', 'run'), when='+mpi') + + # requirements-optional.txt + depends_on('py-matplotlib', type=('build', 'run'), when='+matplotlib') + depends_on('py-ipyparallel', type=('build', 'run'), when='+ipyparallel') + depends_on('py-pandas', type=('build', 'run'), when='+pandas') + + depends_on('mpi', type=('build', 'run')) + + depends_on('intel-parallel-studio', type='run', when='%intel@:2021.1.1') + depends_on('intel-oneapi-compilers', type='run', when='%intel@2021.1.2:') + + @run_before('install') + def add_examples_dir(self): + # Add file `__init__py` to examples/ so it is picked up by setuptools + touch('examples/__init__.py') + + def setup_run_environment(self, env): + # Make benchmark.py available + env.prepend_path('DEVITO_HOME', self.prefix) diff --git a/var/spack/repos/builtin/packages/py-nbval/package.py b/var/spack/repos/builtin/packages/py-nbval/package.py new file mode 100644 index 0000000000..f4eac48a89 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-nbval/package.py @@ -0,0 +1,29 @@ +# 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 PyNbval(PythonPackage): + """Py.test plugin for validating Jupyter notebooks. + + The plugin adds functionality to py.test to recognise and collect Jupyter notebooks. + The intended purpose of the tests is to determine whether execution of the stored + inputs match the stored outputs of the .ipynb file. Whilst also ensuring that the + notebooks are running without errors. + """ + + homepage = "https://github.com/computationalmodelling/nbval" + pypi = "nbval/nbval-0.9.6.tar.gz" + + version('0.9.6', sha256='cfefcd2ef66ee2d337d0b252c6bcec4023384eb32e8b9e5fcc3ac80ab8cd7d40') + + depends_on('py-setuptools', type='build') + depends_on('py-pytest@2.8:', type=('build', 'run')) + depends_on('py-six', type=('build', 'run')) + depends_on('py-jupyter-client', type=('build', 'run')) + depends_on('py-nbformat', type=('build', 'run')) + depends_on('py-ipykernel', type=('build', 'run')) + depends_on('py-coverage', type=('build', 'run')) diff --git a/var/spack/repos/builtin/packages/py-pyrevolve/package.py b/var/spack/repos/builtin/packages/py-pyrevolve/package.py new file mode 100644 index 0000000000..02786929ed --- /dev/null +++ b/var/spack/repos/builtin/packages/py-pyrevolve/package.py @@ -0,0 +1,23 @@ +# 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 PyPyrevolve(PythonPackage): + """PyRevolve. + + Python wrapper for Revolve: https://dl.acm.org/doi/10.1145/347837.347846 + """ + + homepage = "https://github.com/devitocodes/pyrevolve" + pypi = "pyrevolve/pyrevolve-2.2.tar.gz" + + version('2.2', sha256='b49aea5cd6c520ac5fcd1d25fa23fe2c5502741d2965f3eee10be067e7b0efb4') + + depends_on('py-setuptools', type='build') + depends_on('py-contexttimer', type=('build', 'run')) + depends_on('py-cython@0.17:', type='build') + depends_on('py-versioneer', type='build') -- cgit v1.2.3-70-g09d2