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 <ajstewart426@gmail.com>

* 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 <ajstewart426@gmail.com>

* Update var/spack/repos/builtin/packages/py-gmxapi/package.py

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

---------

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
This commit is contained in:
M. Eric Irrgang 2023-03-02 17:37:17 +03:00 committed by GitHub
parent 2ba1f700e6
commit dd7af323ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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"))