Skip to content

Commit

Permalink
[py-icon4py] Modifications for merge of greenline (#834)
Browse files Browse the repository at this point in the history
* Rebasing

* GitHub Action: Apply Pep8-formatting

* removing recipes that are builtin to v0.20.1

* Update packages.yaml

* removing libxml2

* removing the pypi arg from version()

* GitHub Action: Apply Pep8-formatting

* Update package.py

* GitHub Action: Apply Pep8-formatting

* trying Jonas' fixes

* updating gt4py min requirements

* adding newer py-tabulate

* GitHub Action: Apply Pep8-formatting

* renaming v to 2.6.2 to avoid patching includes unncessarily

* Adding tests to integration_test.py

* GitHub Action: Apply Pep8-formatting

* Update system_test.py

* Update package.py

* testing with builtin py-poetry-core

* Removing py-poetry-core test

* Removing py-poetry-core test

* updating serialbox version in system tests

* Adding 'Test' suffixes

* Update package.py

---------

Co-authored-by: github-actions <[email protected]>
Co-authored-by: juckerj <[email protected]>
  • Loading branch information
3 people authored Sep 20, 2023
1 parent c6fc4a6 commit b7e55db
Show file tree
Hide file tree
Showing 13 changed files with 285 additions and 15 deletions.
6 changes: 6 additions & 0 deletions repos/c2sm/packages/icon/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,12 @@ def configure_args(self):
self.spec['py-icon4py:atm_dyn_iconam'].headers.directories[0])
config_vars['LOC_ICON4PY_TOOLS'].append(
self.spec['py-icon4py:tools'].headers.directories[0])
if self.spec['py-icon4py'].version > Version("0.0.7"):
config_vars['LOC_ICON4PY_DIFFUSION'].append(
self.spec['py-icon4py:diffusion'].headers.directories[0])
config_vars['LOC_ICON4PY_INTERPOLATION'].append(
self.spec['py-icon4py:interpolation'].headers.
directories[0])
config_vars['LOC_GRIDTOOLS'].append(
self.spec['py-gridtools-cpp:data'].headers.directories[0])
config_vars['GT4PYNVCFLAGS'] = config_vars['NVCFLAGS']
Expand Down
13 changes: 13 additions & 0 deletions repos/c2sm/packages/py-ghex/add_origin_install_rpath.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
index 7a69da0..13991c2 100644
--- a/bindings/python/CMakeLists.txt
+++ b/bindings/python/CMakeLists.txt
@@ -104,7 +104,7 @@ if(DEFINED SKBUILD_PROJECT_NAME)
# set RPaths
list(GET CMAKE_PREFIX_PATH 0 scikit_build_core_install_path)
set_target_properties(pyghex PROPERTIES
- INSTALL_RPATH "${scikit_build_core_install_path}/ghex/${CMAKE_INSTALL_LIBDIR}")
+ INSTALL_RPATH "$ORIGIN/lib:${scikit_build_core_install_path}/ghex/${CMAKE_INSTALL_LIBDIR}")
set_target_properties(ghex PROPERTIES
INSTALL_RPATH "${scikit_build_core_install_path}/ghex/${CMAKE_INSTALL_LIBDIR}")
if (GHEX_TRANSPORT_BACKEND STREQUAL "LIBFABRIC")
43 changes: 43 additions & 0 deletions repos/c2sm/packages/py-ghex/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2013-2020 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 import *


class PyGhex(PythonPackage):
"""
Python bindings for Generic exascale-ready library for halo-exchange operations
on variety of grids/meshes.
"""

homepage = 'https://github.com/ghex-org/GHEX'
url = "https://github.com/ghex-org/GHEX/archive/refs/tags/v0.3.0.tar.gz"
git = 'https://github.com/ghex-org/GHEX.git'
maintainers = ['boeschf', 'halungge']

version('0.3.2',
commit='4ae0b8031647816cde3a54a856d37d38e7bdb9ac',
git=git,
submodules=True)
version('0.3.1',
commit='7ced96a69ab502b0ab0eddc1c0d743e06ccde919',
git=git,
submodules=True)

build_directory = 'bindings/python'
import_modules = ['ghex', 'ghex.unstructured']

depends_on("mpi")
depends_on('[email protected]:', type=('build', 'run'))
depends_on('[email protected] +pyproject', type='build')
depends_on('py-pybind11', type=('build', 'run'))
depends_on('py-mpi4py', type=('build', 'run'))
depends_on('[email protected]:', type='build')
depends_on('[email protected]:', type=('build', 'run'))
depends_on('py-numpy', type=('build', 'run'))
depends_on('py-pytest', type=('build', 'run'))

patch("add_origin_install_rpath.patch", when="@0.3.1")
12 changes: 6 additions & 6 deletions repos/c2sm/packages/py-gt4py/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ class PyGt4py(PythonPackage):
depends_on('[email protected]:', type=('build', 'run'))
depends_on('[email protected]:', type=('build', 'run'))
depends_on('[email protected]:', type=('build', 'run'))
depends_on('py-boltons@20.0.0:', type=('build', 'run'))
depends_on('[email protected]:', type=('build', 'run'))
depends_on('py-boltons@20.1:', type=('build', 'run'))
depends_on('[email protected].1:', type=('build', 'run'))
depends_on('[email protected]:', type=('build', 'run'))
depends_on('[email protected]:', type=('build', 'run'))
depends_on('[email protected]:', type=('build', 'run'))
depends_on('[email protected].0:', type=('build', 'run'))
depends_on('[email protected]:', type=('build', 'run'))
depends_on('[email protected]:', type=('build', 'run'))
depends_on('[email protected]:', type=(
Expand All @@ -60,10 +60,10 @@ class PyGt4py(PythonPackage):
depends_on('[email protected]:2.9.2', type=('build', 'run'))

depends_on('[email protected]:', when="@1.1.3:", type=('build', 'run'))
depends_on('[email protected]:', type=('build', 'run'))
depends_on('py-typing-extensions@4.5:', type=('build', 'run'))
depends_on('[email protected].10:', type=('build', 'run'))
depends_on('py-typing-extensions@4.2:4.6', type=('build', 'run'))
depends_on('[email protected]:', type=('build', 'run'))
depends_on('[email protected]:', type=('build', 'run'))
depends_on('[email protected]:3.0.9', type=('build', 'run'))
depends_on('[email protected]:', type=('build', 'run'))

# Python dependencies from requirements-dev.txt
Expand Down
39 changes: 34 additions & 5 deletions repos/c2sm/packages/py-icon4py/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,21 @@ class PyIcon4py(PythonPackage):
depends_on('py-pytest', type=('build', 'run'))
depends_on('[email protected]:', type=('build', 'run'))

depends_on('[email protected]:', when='@0.0.8:', type=('build', 'run'))
depends_on('py-netcdf4', when='@0.0.8:', type=('build', 'run'))
depends_on('[email protected]%gcc', when='@0.0.8:', type=('build', 'run'))
depends_on('[email protected]%nvhpc',
when='@0.0.8:',
type=('build', 'run'))
depends_on('[email protected]:', when='@0.0.8:', type=('build', 'run'))
depends_on('py-pytz', when='@0.0.8:', type=('build', 'run'))
depends_on('[email protected]', when='@0.0.8:', type=('build', 'run'))
depends_on('py-wget', when='@0.0.8:', type=('build', 'run'))
depends_on('[email protected] +python',
when='@0.0.8:',
type=('build', 'run'))
depends_on('py-pytest-mpi', when='@0.0.8:', type='build')

# cmake in unit-tests needs this path
def setup_build_environment(self, env):
env.set("CMAKE_INCLUDE_PATH", self.spec['boost'].prefix.include)
Expand All @@ -50,8 +65,10 @@ def test(self):
super().test()

# unit tests
python('-m', 'pytest', '-v', '-s', '-n', 'auto', '--cov',
'--cov-append')
if 'py-pytest-mpi' in self.spec:
python('-m', 'pytest', '--with-mpi', '-v', '-s')
else:
python('-m', 'pytest', '-v', '-s', '-n', 'auto')

@property
def headers(self):
Expand All @@ -76,10 +93,16 @@ def headers(self):
'atm_dyn_iconam': 'dycore',
'tools': 'icon4pytools'
},
ver('=main'): {
ver('=0.0.7'): {
'atm_dyn_iconam': 'dycore',
'tools': 'icon4pytools'
}
},
ver('=main'): {
'atm_dyn_iconam': 'dycore',
'tools': 'icon4pytools',
'diffusion': 'diffusion/stencils',
'interpolation': 'interpolation/stencils',
},
}

if len(query_parameters) > 1:
Expand Down Expand Up @@ -143,8 +166,14 @@ def install(self, pkg, spec, prefix):
elif self.spec.version == ver('=0.0.4') or self.spec.version == ver(
'=0.0.5'):
build_dirs = ['common', 'atm_dyn_iconam', 'tools']
else:
elif self.spec.version == ver('=0.0.6') or self.spec.version == ver(
'=0.0.7'):
build_dirs = ['tools', 'model/atmosphere/dycore', 'model/common/']
else:
build_dirs = [
'tools', 'model/atmosphere/dycore',
'model/atmosphere/diffusion', 'model/driver', 'model/common/'
]

for dir in build_dirs:
with fs.working_dir(os.path.join(self.build_directory, dir)):
Expand Down
38 changes: 38 additions & 0 deletions repos/c2sm/packages/py-isort/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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 *
from spack.pkg.builtin.py_isort import PyIsort as SpackPyIsort


class PyIsort(SpackPyIsort):
"""A Python utility / library to sort Python imports."""

homepage = "https://github.com/timothycrosley/isort"
pypi = "isort/isort-4.2.15.tar.gz"

version("5.12.0",
sha256=
"8bef7dde241278824a6d83f44a544709b065191b95b6e50894bdc722fcba0504")
version("5.10.1",
sha256=
"e8443a5e7a020e9d7f97f1d7d9cd17c88bcb3bc7e218bf9cf5095fe550be2951")

variant("colors",
default=False,
description="Install colorama for --color support")

depends_on("[email protected]:", when="@5.12:", type=("build", "run"))
depends_on("[email protected]:3", when="@5:5.10", type=("build", "run"))
depends_on("py-poetry-core@1:", type="build")
depends_on("[email protected]:",
when="+colors @5.12:",
type=("build", "run"))
depends_on("[email protected]:0.4",
when="+colors @:5.11",
type=("build", "run"))

# https://github.com/PyCQA/isort/issues/2077
conflicts("^[email protected]:", when="@:5.11.4")
22 changes: 22 additions & 0 deletions repos/c2sm/packages/py-pytest-mpi/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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 import *


class PyPytestMpi(PythonPackage):
"""pytest_mpi is a plugin for pytest providing some useful tools when running tests under MPI,
and testing MPI-related code."""

homepage = "https://pytest-mpi.readthedocs.io"
pypi = "pytest-mpi/pytest-mpi-0.6.tar.gz"

maintainers = ['halungge']

version('0.6',
sha256=
'09b3cd3511f8f3cd4d205f54d4a7223724fed0ab68b872ed1123d312152325a9')

depends_on('py-setuptools', type='build')
17 changes: 17 additions & 0 deletions repos/c2sm/packages/py-scikit-build-core/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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)

from spack.package import *
from spack.pkg.builtin.py_scikit_build_core import PyScikitBuildCore as SpackPyScikitBuildCore


class PyScikitBuildCore(SpackPyScikitBuildCore):
"""scikit-build-core is a doubly improved build system generator
for CPython C/C++/Fortran/Cython extensions. It features several
improvements over the classic scikit-build build system generator."""

version("0.5.0",
sha256=
"a42a95029b34b5cf892855342d9b9445c774cb797fcb24c8fc4c2fb42b18dfca")
15 changes: 15 additions & 0 deletions repos/c2sm/packages/py-tabulate/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 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)

from spack.package import *
from spack.pkg.builtin.py_tabulate import PyTabulate as SpackPyTabulate


class PyTabulate(SpackPyTabulate):
"""Pretty-print tabular data"""

version("0.8.10",
sha256=
"6c57f3f3dd7ac2782770155f3adb2db0b1a269637e42f27599925e64b114f519")
15 changes: 15 additions & 0 deletions repos/c2sm/packages/serialbox/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from spack.package import *
from spack.pkg.builtin.serialbox import Serialbox as SpackSerialbox


class Serialbox(SpackSerialbox):
"""See upstream package.
Adding version to make compatible with numpy 1.24
"""
git = 'https://github.com/GridTools/serialbox.git'
maintainers = ['halungge', 'skosukhin']

version('2.6.2',
commit='88ac4e4dfc824953d068fe63c8e7b3dd9560a914',
git=git,
submodules=True)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
requests
pytest-xdist
pyyaml
pyyaml
Loading

0 comments on commit b7e55db

Please sign in to comment.