diff --git a/repos/c2sm/packages/icon/package.py b/repos/c2sm/packages/icon/package.py index f558429e6c..dca2bf3a20 100755 --- a/repos/c2sm/packages/icon/package.py +++ b/repos/c2sm/packages/icon/package.py @@ -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'] diff --git a/repos/c2sm/packages/py-ghex/add_origin_install_rpath.patch b/repos/c2sm/packages/py-ghex/add_origin_install_rpath.patch new file mode 100644 index 0000000000..d64905fb8e --- /dev/null +++ b/repos/c2sm/packages/py-ghex/add_origin_install_rpath.patch @@ -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") diff --git a/repos/c2sm/packages/py-ghex/package.py b/repos/c2sm/packages/py-ghex/package.py new file mode 100644 index 0000000000..3d135d21ca --- /dev/null +++ b/repos/c2sm/packages/py-ghex/package.py @@ -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('python@3.10:', type=('build', 'run')) + depends_on('py-scikit-build-core@0.5.0 +pyproject', type='build') + depends_on('py-pybind11', type=('build', 'run')) + depends_on('py-mpi4py', type=('build', 'run')) + depends_on('cmake@3.17:', type='build') + depends_on('boost@1.65.1:', 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") diff --git a/repos/c2sm/packages/py-gt4py/package.py b/repos/c2sm/packages/py-gt4py/package.py index 4986fac784..95bdc9d566 100644 --- a/repos/c2sm/packages/py-gt4py/package.py +++ b/repos/c2sm/packages/py-gt4py/package.py @@ -37,11 +37,11 @@ class PyGt4py(PythonPackage): depends_on('python@3.10:', type=('build', 'run')) depends_on('py-attrs@21.3:', type=('build', 'run')) depends_on('py-black@22.3.0:', type=('build', 'run')) - depends_on('py-boltons@20.0.0:', type=('build', 'run')) - depends_on('py-cached-property@1.5:', type=('build', 'run')) + depends_on('py-boltons@20.1:', type=('build', 'run')) + depends_on('py-cached-property@1.5.1:', type=('build', 'run')) depends_on('py-click@8.0.0:', type=('build', 'run')) depends_on('py-cytoolz@0.12:', type=('build', 'run')) - depends_on('py-deepdiff@5.6:', type=('build', 'run')) + depends_on('py-deepdiff@5.6.0:', type=('build', 'run')) depends_on('py-devtools@0.6:', type=('build', 'run')) depends_on('py-frozendict@2.3:', type=('build', 'run')) depends_on('py-gridtools-cpp@2.3.1:', type=( @@ -60,10 +60,10 @@ class PyGt4py(PythonPackage): depends_on('py-pybind11@2.5:2.9.2', type=('build', 'run')) depends_on('py-nanobind@1.4.0:', when="@1.1.3:", type=('build', 'run')) - depends_on('py-tabulate@0.8:', type=('build', 'run')) - depends_on('py-typing-extensions@4.5:', type=('build', 'run')) + depends_on('py-tabulate@0.8.10:', type=('build', 'run')) + depends_on('py-typing-extensions@4.2:4.6', type=('build', 'run')) depends_on('py-toolz@0.12.0:', type=('build', 'run')) - depends_on('py-xxhash@1.4.4:', type=('build', 'run')) + depends_on('py-xxhash@1.4.4:3.0.9', type=('build', 'run')) depends_on('py-hypothesis@6.0.0:', type=('build', 'run')) # Python dependencies from requirements-dev.txt diff --git a/repos/c2sm/packages/py-icon4py/package.py b/repos/c2sm/packages/py-icon4py/package.py index 8d103b9c38..d0b8e810cf 100644 --- a/repos/c2sm/packages/py-icon4py/package.py +++ b/repos/c2sm/packages/py-icon4py/package.py @@ -41,6 +41,21 @@ class PyIcon4py(PythonPackage): depends_on('py-pytest', type=('build', 'run')) depends_on('boost@1.65.1:', type=('build', 'run')) + depends_on('py-cffi@1.5.0:', when='@0.0.8:', type=('build', 'run')) + depends_on('py-netcdf4', when='@0.0.8:', type=('build', 'run')) + depends_on('netcdf-c@4.8.1%gcc', when='@0.0.8:', type=('build', 'run')) + depends_on('netcdf-fortran@4.5.4%nvhpc', + when='@0.0.8:', + type=('build', 'run')) + depends_on('py-mpi4py@3.0:', when='@0.0.8:', type=('build', 'run')) + depends_on('py-pytz', when='@0.0.8:', type=('build', 'run')) + depends_on('py-ghex@0.3.2', when='@0.0.8:', type=('build', 'run')) + depends_on('py-wget', when='@0.0.8:', type=('build', 'run')) + depends_on('serialbox@2.6.2 +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) @@ -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): @@ -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: @@ -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)): diff --git a/repos/c2sm/packages/py-isort/package.py b/repos/c2sm/packages/py-isort/package.py new file mode 100644 index 0000000000..da3f06aaca --- /dev/null +++ b/repos/c2sm/packages/py-isort/package.py @@ -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("python@3.8:", when="@5.12:", type=("build", "run")) + depends_on("python@3.6.1:3", when="@5:5.10", type=("build", "run")) + depends_on("py-poetry-core@1:", type="build") + depends_on("py-colorama@0.4.3:", + when="+colors @5.12:", + type=("build", "run")) + depends_on("py-colorama@0.4.3:0.4", + when="+colors @:5.11", + type=("build", "run")) + + # https://github.com/PyCQA/isort/issues/2077 + conflicts("^py-poetry-core@1.5:", when="@:5.11.4") diff --git a/repos/c2sm/packages/py-pytest-mpi/package.py b/repos/c2sm/packages/py-pytest-mpi/package.py new file mode 100644 index 0000000000..07ac410260 --- /dev/null +++ b/repos/c2sm/packages/py-pytest-mpi/package.py @@ -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') diff --git a/repos/c2sm/packages/py-scikit-build-core/package.py b/repos/c2sm/packages/py-scikit-build-core/package.py new file mode 100644 index 0000000000..aafb3cac07 --- /dev/null +++ b/repos/c2sm/packages/py-scikit-build-core/package.py @@ -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") diff --git a/repos/c2sm/packages/py-tabulate/package.py b/repos/c2sm/packages/py-tabulate/package.py new file mode 100644 index 0000000000..f3b0593285 --- /dev/null +++ b/repos/c2sm/packages/py-tabulate/package.py @@ -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") diff --git a/repos/c2sm/packages/serialbox/package.py b/repos/c2sm/packages/serialbox/package.py new file mode 100644 index 0000000000..152da66dda --- /dev/null +++ b/repos/c2sm/packages/serialbox/package.py @@ -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) diff --git a/requirements.txt b/requirements.txt index a0314a26b2..fb9fc9e904 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ requests pytest-xdist -pyyaml \ No newline at end of file +pyyaml diff --git a/test/integration_test.py b/test/integration_test.py index 7f894704c4..d2802ed561 100644 --- a/test/integration_test.py +++ b/test/integration_test.py @@ -178,6 +178,9 @@ def test_py_fprettify(self): def test_py_frozendict(self): spack_info('py-frozendict') + def test_py_ghex(self): + spack_info('py-ghex') + def test_py_gridtools_cpp(self): spack_info('py-gridtools-cpp') @@ -193,6 +196,9 @@ def test_py_icon4py(self): def test_py_inflection(self): spack_info('py-inflection') + def test_py_isort(self): + spack_info('py-isort') + def test_py_lark(self): spack_info('py-lark') @@ -205,15 +211,24 @@ def test_py_pathspec(self): def test_py_pytest(self): spack_info('py-pytest') + def test_py_pytest_mpi(self): + spack_info('py-pytest-mpi') + def test_py_pytest_factoryboy(self): spack_info('py-pytest-factoryboy') def test_py_setuptools(self): spack_info('py-setuptools') + def test_py_scikit_build_core(self): + spack_info('py-scikit-build-core') + def test_py_sphinxcontrib_jquery(self): spack_info('py-sphinxcontrib-jquery') + def test_py_tabulate(self): + spack_info('py-tabulate') + def test_py_toolz(self): spack_info('py-toolz') @@ -226,6 +241,9 @@ def test_rttov(self): def test_scales_ppm(self): spack_info('scales-ppm') + def test_serialbox(self): + spack_info('serialbox') + def test_tensorflowc(self): spack_info('tensorflowc') @@ -394,6 +412,9 @@ def test_py_fprettify(self): def test_py_frozendict(self): spack_spec('py-frozendict') + def test_py_ghex(self): + spack_spec('py-ghex') + def test_py_gridtools_cpp(self): spack_spec('py-gridtools-cpp') @@ -409,6 +430,9 @@ def test_py_icon4py(self): def test_py_inflection(self): spack_spec('py-inflection') + def test_py_isort(self): + spack_spec('py-isort') + def test_py_lark(self): spack_spec('py-lark') @@ -418,21 +442,27 @@ def test_py_nanobind(self): def test_py_pathspec(self): spack_spec('py-pathspec') - def test_py_poetry_core(self): - spack_spec('py-poetry-core') - def test_py_pytest(self): spack_spec('py-pytest') def test_py_pytest_factoryboy(self): spack_spec('py-pytest-factoryboy') + def test_py_pytest_mpi(self): + spack_spec('py-pytest-mpi') + + def test_py_scikit_build_core(self): + spack_spec('py-scikit-build-core') + def test_py_setuptools(self): spack_spec('py-setuptools') def test_py_sphinxcontrib_jquery(self): spack_spec('py-sphinxcontrib-jquery') + def test_py_tabulate(self): + spack_spec('py-tabulate') + def test_py_toolz(self): spack_spec('py-toolz') @@ -442,6 +472,9 @@ def test_py_typing_extensions(self): def test_rttov(self): spack_spec('rttov') + def test_serialbox(self): + spack_spec('serialbox') + def test_scales_ppm(self): spack_spec('scales-ppm') diff --git a/test/system_test.py b/test/system_test.py index f10d111ea0..b46c9be3d5 100644 --- a/test/system_test.py +++ b/test/system_test.py @@ -683,6 +683,12 @@ def test_install_default(self): spack_install_and_test('py-inflection') +class PyIsortTest(unittest.TestCase): + + def test_install_default(self): + spack_install_and_test('py-isort') + + class PyLarkTest(unittest.TestCase): def test_install_default(self): @@ -731,6 +737,12 @@ def test_install_default(self): spack_install_and_test('py-sphinxcontrib-jquery') +class PyTabulateTest(unittest.TestCase): + + def test_install_default(self): + spack_install_and_test('py-tabulate') + + class PyToolzTest(unittest.TestCase): def test_install_default(self): @@ -783,5 +795,32 @@ def test_install_version_2_0_0(self): spack_install_and_test('zlib_ng @2.0.0') +class PyGhexTest(unittest.TestCase): + + def test_install_version_0_3_1(self): + spack_install('py-ghex @0.3.1') + + +class PyPytestMpiTest(unittest.TestCase): + + def test_install_pytest_mpi_default(self): + spack_install('py-pytest-mpi') + + +class PyScikitBuildCoreTest(unittest.TestCase): + + def test_install_py_scikit_build_core_default(self): + spack_install('py-scikit-build-core') + + +class SerialboxTest(unittest.TestCase): + + def test_install_serialbox_2_6_1(self): + spack_install('serialbox @2.6.1') + + def test_install_serialbox_2_6_2_python(self): + spack_install('serialbox @2.6.2 + python') + + if __name__ == '__main__': unittest.main(verbosity=2)