From dd7af323edd0a66e0af10bad4051a5759671d525 Mon Sep 17 00:00:00 2001 From: "M. Eric Irrgang" Date: Thu, 2 Mar 2023 17:37:17 +0300 Subject: Add a `py-gmxapi` package. (#35738) * Add a `py-gmxapi` package. This package provides the Python package for the GROMACS public API. The Python package is not strongly coupled to a specific GROMACS _version_, but its compiled extension module is strongly coupled to a specific GROMACS _installation_. * Update conflict info. In order to allow `^gromacs@2022.1` while rejecting `^gromacs@2022`, we need to compare to `gromacs@2022.0`. * Apply suggestions from code review Co-authored-by: Adam J. Stewart * Apply suggestions from code review. * Simplify build system structure. * Update dependencies for completeness. * Update var/spack/repos/builtin/packages/py-gmxapi/package.py Per code review, pretend gmxapi <0.4 doesn't exist, for simplicity. * Update var/spack/repos/builtin/packages/py-gmxapi/package.py Co-authored-by: Adam J. Stewart * Update var/spack/repos/builtin/packages/py-gmxapi/package.py Co-authored-by: Adam J. Stewart --------- Co-authored-by: Adam J. Stewart --- .../repos/builtin/packages/py-gmxapi/package.py | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-gmxapi/package.py (limited to 'var') diff --git a/var/spack/repos/builtin/packages/py-gmxapi/package.py b/var/spack/repos/builtin/packages/py-gmxapi/package.py new file mode 100644 index 0000000000..673693b518 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-gmxapi/package.py @@ -0,0 +1,48 @@ +# Copyright 2013-2023 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) +import os + +from spack.package import * + + +class PyGmxapi(PythonPackage): + """Python bindings and ensemble workflow management for GROMACS. + + The GROMACS C++ API is affected by its package variants. You can + specify a particular GROMACS API by making the dependency variant explicit. + E.g. ``spack install gmxapi ^gromacs+mpi~double`` + """ + + homepage = "https://manual.gromacs.org/current/gmxapi/index.html" + maintainers("eirrgang", "peterkasson") + + pypi = "gmxapi/gmxapi-0.4.0.tar.gz" + version("0.4.0", sha256="7fd58e6a4b1391043379e8ba55555ebeba255c5b394f5df9d676e6a5571d7eba") + + depends_on("gromacs@2022.1:~mdrun_only+shared") + depends_on("mpi") + depends_on("py-cmake@3.16:", type="build") + depends_on("py-importlib-metadata", type="test", when="^python@:3.7") + depends_on("py-mpi4py", type=("build", "run")) + depends_on("py-networkx@2.0:", type=("build", "run")) + depends_on("py-numpy@1.8:", type=("build", "run")) + depends_on("py-setuptools@42:", type="build") + depends_on("py-packaging", type=("build", "run")) + depends_on("py-pybind11@2.6:", type=("build", "run")) + depends_on("py-pytest@4.6:", type="test") + depends_on("py-wheel", type="build") + + def setup_build_environment(self, env): + env.set("GROMACS_DIR", self.spec["gromacs"].prefix) + env.set("gmxapi_ROOT", self.spec["gromacs"].prefix) + env.set("Python3_ROOT", self.spec["python"].home) + + @run_after("install") + @on_package_attributes(run_tests=True) + def install_test(self): + with working_dir("spack-test", create=True): + # test include helper points to right location + python = self.spec["python"].command + python("-m", "pytest", "-x", os.path.join(self.build_directory, "test")) -- cgit v1.2.3-70-g09d2