diff --git a/.flake8 b/.flake8
index c9149d2f28..b37b750f96 100644
--- a/.flake8
+++ b/.flake8
@@ -42,4 +42,4 @@ rst-roles =
py:obj, obj,
per-file-ignores =
- pyutils/src/icon4py/icon4pygen/icochainsize.py:E800
+ tools/src/icon4pytools/icon4pygen/icochainsize.py:E800
diff --git a/.github/workflows/qa.yml b/.github/workflows/icon4py-qa.yml
similarity index 87%
rename from .github/workflows/qa.yml
rename to .github/workflows/icon4py-qa.yml
index ee7aa7637b..81584064ff 100644
--- a/.github/workflows/qa.yml
+++ b/.github/workflows/icon4py-qa.yml
@@ -1,9 +1,11 @@
-name: Quality Assurance
+name: ICON4Py Quality Assurance
on:
push:
branches:
- main
+ paths-ignore:
+ - "tools/**"
pull_request:
branches:
- main
@@ -29,4 +31,4 @@ jobs:
- name: Run checks
run: |
python -m pip list
- pre-commit run --all-files
+ pre-commit run --config .pre-commit-config.yaml --all-files
diff --git a/.github/workflows/tox.yml b/.github/workflows/icon4py-tox.yml
similarity index 95%
rename from .github/workflows/tox.yml
rename to .github/workflows/icon4py-tox.yml
index e786f569d8..f39655c350 100644
--- a/.github/workflows/tox.yml
+++ b/.github/workflows/icon4py-tox.yml
@@ -1,9 +1,11 @@
-name: Tox
+name: ICON4Py Tox
on:
push:
branches:
- main
+ paths-ignore:
+ - "tools/**"
pull_request:
branches:
- main
diff --git a/.github/workflows/icon4pytools-qa.yml b/.github/workflows/icon4pytools-qa.yml
new file mode 100644
index 0000000000..f82deb0295
--- /dev/null
+++ b/.github/workflows/icon4pytools-qa.yml
@@ -0,0 +1,30 @@
+name: ICON4PyTools Quality Assurance
+
+on:
+ push:
+ branches:
+ - main
+ paths:
+ - "tools/**"
+ - "base-requirements*"
+ pull_request:
+ branches:
+ - main
+
+jobs:
+ pre-commit:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Set up Python
+ uses: actions/setup-python@v3
+ with:
+ python-version: "3.10"
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip setuptools wheel
+ python -m pip install -r ./requirements-dev.txt
+ - name: Run checks
+ run: |
+ python -m pip list
+ pre-commit run --config tools/.pre-commit-config.yaml --all-files
diff --git a/.github/workflows/icon4pytools-tox.yml b/.github/workflows/icon4pytools-tox.yml
new file mode 100644
index 0000000000..2b68e80181
--- /dev/null
+++ b/.github/workflows/icon4pytools-tox.yml
@@ -0,0 +1,52 @@
+name: ICON4PyTools Tox
+
+on:
+ push:
+ branches:
+ - main
+ paths:
+ - "tools/**"
+ - "base-requirements*"
+ pull_request:
+ branches:
+ - main
+
+jobs:
+ tox-tests:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ python-version: ["3.10"]
+ defaults:
+ run:
+ working-directory: tools
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Install boost
+ run: |
+ sudo apt-get update
+ sudo apt-get install libboost-all-dev
+
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+
+ - name: Install python dependencies
+ run: |
+ python -m pip install --upgrade pip setuptools wheel
+
+ - name: Test with tox
+ run: |
+ pyversion_no_dot="${{ matrix.python-version }}"
+ pyversion_no_dot="${pyversion_no_dot/./}"
+ pip install tox clang-format
+ tox -r -e py${pyversion_no_dot}
+
+ - name: Archive code coverage results
+ uses: actions/upload-artifact@v2
+ with:
+ name: code-coverage-report
+ path: _reports/coverage_html/
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 480995b3a2..27e1a03f9e 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -5,6 +5,7 @@ default_language_version:
# Remove frozen version once we migrated away from tsa
node: 17.9.1
minimum_pre_commit_version: 2.20.0
+exclude: "tools/.*"
repos:
- repo: meta
@@ -35,9 +36,6 @@ repos:
- id: destroyed-symlinks
# - id: fix-encoding-pragma
# args: [--remove]
- - id: name-tests-test
- args: [--pytest-test-first]
- exclude: ^liskov/tests/samples
- repo: https://gitlab.com/bmares/check-json5
rev: v1.0.0
@@ -117,8 +115,6 @@ repos:
- flake8-docstrings
- flake8-eradicate
- flake8-mutable
- # Disabled for now due to random false positives
- # - flake8-rst-docstrings
- pygments
- repo: local
@@ -126,7 +122,7 @@ repos:
- id: mypy
name: mypy static type checker
entry: |
- mypy --install-types --non-interactive -p icon4py.common -p icon4py.icon4pygen -p icon4py.testutils
+ mypy --install-types --non-interactive -p icon4py.common
language: system
types_or: [python, pyi]
always_run: true
diff --git a/README.md b/README.md
index 07613e4f35..bbba9acf5f 100644
--- a/README.md
+++ b/README.md
@@ -4,11 +4,11 @@
## Description
-ICON4Py contains Python (GT4Py) implementations of ICON (inspired) components for weather and climate models.
+ICON4Py contains Python (GT4Py) implementations of ICON (inspired) components for weather and climate models as well as `icon4pytools`, a package containing CLIs and utilties needed for the integration of ICON4Py code into the ICON Fortran model.
## Project structure
-Each directory contains Python packages of ICON components or utility packages that are deployable on its own. As these packages are not available from a package repository (yet), location of dependencies within this repository have to be provided explicitly, e.g. by installing the dependencies first. See [Installation instructions](#installation-instructions).
+Each directory contains Python packages of ICON components or utility packages that are deployable on their own. As these packages are not available from a package repository (yet), location of dependencies within this repository have to be provided explicitly, e.g. by installing the dependencies first. See [Installation instructions](#installation-instructions).
## Installation instructions
@@ -70,8 +70,11 @@ source .venv/bin/activate
pip install --upgrade wheel
# Install a specific ICON4Py subpackage and its dependencies
-cd _SUBPACKAGE_ # where _SUBPACKAGE_ in atm_dyn_iconam | common | icon4pygen | testutils | ...
+cd _SUBPACKAGE_ # where _SUBPACKAGE_ in atm_dyn_iconam | tools | ...
pip install -r requirements-dev.txt
+
+# or in the case of there being a pyproject.toml file
+pip install .
```
## Development instructions
diff --git a/liskov/src/icon4py/liskov/codegen/integration/__init__.py b/atm_dyn_iconam/__init__.py
similarity index 100%
rename from liskov/src/icon4py/liskov/codegen/integration/__init__.py
rename to atm_dyn_iconam/__init__.py
diff --git a/atm_dyn_iconam/src/icon4py/atm_dyn_iconam/apply_nabla2_and_nabla4_to_vn.py b/atm_dyn_iconam/src/icon4py/atm_dyn_iconam/apply_nabla2_and_nabla4_to_vn.py
index 5fd62dbb99..21fd39cc40 100644
--- a/atm_dyn_iconam/src/icon4py/atm_dyn_iconam/apply_nabla2_and_nabla4_to_vn.py
+++ b/atm_dyn_iconam/src/icon4py/atm_dyn_iconam/apply_nabla2_and_nabla4_to_vn.py
@@ -10,7 +10,6 @@
# distribution for a copy of the license or check .
#
# SPDX-License-Identifier: GPL-3.0-or-later
-
from gt4py.next.ffront.decorator import field_operator, program
from gt4py.next.ffront.fbuiltins import Field, maximum
diff --git a/atm_dyn_iconam/src/icon4py/atm_dyn_iconam/apply_nabla2_to_vn_in_lateral_boundary.py b/atm_dyn_iconam/src/icon4py/atm_dyn_iconam/apply_nabla2_to_vn_in_lateral_boundary.py
index fddb2df947..4225d2e5a1 100644
--- a/atm_dyn_iconam/src/icon4py/atm_dyn_iconam/apply_nabla2_to_vn_in_lateral_boundary.py
+++ b/atm_dyn_iconam/src/icon4py/atm_dyn_iconam/apply_nabla2_to_vn_in_lateral_boundary.py
@@ -10,7 +10,6 @@
# distribution for a copy of the license or check .
#
# SPDX-License-Identifier: GPL-3.0-or-later
-
from gt4py.next.ffront.decorator import field_operator, program
from gt4py.next.ffront.fbuiltins import Field
diff --git a/atm_dyn_iconam/src/icon4py/atm_dyn_iconam/mo_solve_nonhydro_stencil_02.py b/atm_dyn_iconam/src/icon4py/atm_dyn_iconam/mo_solve_nonhydro_stencil_02.py
index 50542378e7..15e8c63191 100644
--- a/atm_dyn_iconam/src/icon4py/atm_dyn_iconam/mo_solve_nonhydro_stencil_02.py
+++ b/atm_dyn_iconam/src/icon4py/atm_dyn_iconam/mo_solve_nonhydro_stencil_02.py
@@ -10,7 +10,6 @@
# distribution for a copy of the license or check .
#
# SPDX-License-Identifier: GPL-3.0-or-later
-
from gt4py.next.ffront.decorator import field_operator, program
from gt4py.next.ffront.fbuiltins import Field
diff --git a/liskov/src/icon4py/liskov/codegen/serialisation/__init__.py b/atm_dyn_iconam/tests/__init__.py
similarity index 100%
rename from liskov/src/icon4py/liskov/codegen/serialisation/__init__.py
rename to atm_dyn_iconam/tests/__init__.py
diff --git a/atm_dyn_iconam/tests/test_apply_nabla2_and_nabla4_global_to_vn.py b/atm_dyn_iconam/tests/test_apply_nabla2_and_nabla4_global_to_vn.py
index dfcb9ad56b..cc6cde483f 100644
--- a/atm_dyn_iconam/tests/test_apply_nabla2_and_nabla4_global_to_vn.py
+++ b/atm_dyn_iconam/tests/test_apply_nabla2_and_nabla4_global_to_vn.py
@@ -17,8 +17,9 @@
apply_nabla2_and_nabla4_global_to_vn,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def apply_nabla2_and_nabla4_global_to_vn_numpy(
diff --git a/atm_dyn_iconam/tests/test_apply_nabla2_and_nabla4_to_vn.py b/atm_dyn_iconam/tests/test_apply_nabla2_and_nabla4_to_vn.py
index 3989313534..158208caa0 100644
--- a/atm_dyn_iconam/tests/test_apply_nabla2_and_nabla4_to_vn.py
+++ b/atm_dyn_iconam/tests/test_apply_nabla2_and_nabla4_to_vn.py
@@ -17,8 +17,9 @@
apply_nabla2_and_nabla4_to_vn,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def apply_nabla2_and_nabla4_to_vn_numpy(
diff --git a/atm_dyn_iconam/tests/test_apply_nabla2_to_vn_in_lateral_boundary.py b/atm_dyn_iconam/tests/test_apply_nabla2_to_vn_in_lateral_boundary.py
index 2b714ac209..3f9e62d5f7 100644
--- a/atm_dyn_iconam/tests/test_apply_nabla2_to_vn_in_lateral_boundary.py
+++ b/atm_dyn_iconam/tests/test_apply_nabla2_to_vn_in_lateral_boundary.py
@@ -17,8 +17,9 @@
apply_nabla2_to_vn_in_lateral_boundary,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def apply_nabla2_to_vn_in_lateral_boundary_numpy(
diff --git a/atm_dyn_iconam/tests/test_apply_nabla2_to_w.py b/atm_dyn_iconam/tests/test_apply_nabla2_to_w.py
index de5232382c..84227917b2 100644
--- a/atm_dyn_iconam/tests/test_apply_nabla2_to_w.py
+++ b/atm_dyn_iconam/tests/test_apply_nabla2_to_w.py
@@ -15,8 +15,9 @@
from icon4py.atm_dyn_iconam.apply_nabla2_to_w import apply_nabla2_to_w
from icon4py.common.dimension import C2E2CODim, CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_apply_nabla2_to_w(
diff --git a/atm_dyn_iconam/tests/test_apply_nabla2_to_w_in_upper_damping_layer.py b/atm_dyn_iconam/tests/test_apply_nabla2_to_w_in_upper_damping_layer.py
index 8b7596d6c3..280b77c303 100644
--- a/atm_dyn_iconam/tests/test_apply_nabla2_to_w_in_upper_damping_layer.py
+++ b/atm_dyn_iconam/tests/test_apply_nabla2_to_w_in_upper_damping_layer.py
@@ -17,8 +17,9 @@
apply_nabla2_to_w_in_upper_damping_layer,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def apply_nabla2_to_w_in_upper_damping_layer_numpy(
diff --git a/atm_dyn_iconam/tests/test_calculate_diagnostics_for_turbulence.py b/atm_dyn_iconam/tests/test_calculate_diagnostics_for_turbulence.py
index f4fe2df485..0dee48156a 100644
--- a/atm_dyn_iconam/tests/test_calculate_diagnostics_for_turbulence.py
+++ b/atm_dyn_iconam/tests/test_calculate_diagnostics_for_turbulence.py
@@ -17,8 +17,9 @@
calculate_diagnostics_for_turbulence,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def calculate_diagnostics_for_turbulence_numpy(
diff --git a/atm_dyn_iconam/tests/test_calculate_horizontal_gradients_for_turbulence.py b/atm_dyn_iconam/tests/test_calculate_horizontal_gradients_for_turbulence.py
index c6a1b26dc2..0909deb3b5 100644
--- a/atm_dyn_iconam/tests/test_calculate_horizontal_gradients_for_turbulence.py
+++ b/atm_dyn_iconam/tests/test_calculate_horizontal_gradients_for_turbulence.py
@@ -17,8 +17,9 @@
calculate_horizontal_gradients_for_turbulence,
)
from icon4py.common.dimension import C2E2CODim, CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def calculate_horizontal_gradients_for_turbulence_numpy(
diff --git a/atm_dyn_iconam/tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py b/atm_dyn_iconam/tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py
index 967b2b1532..6861e276f0 100644
--- a/atm_dyn_iconam/tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py
+++ b/atm_dyn_iconam/tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py
@@ -18,8 +18,9 @@
calculate_nabla2_and_smag_coefficients_for_vn,
)
from icon4py.common.dimension import E2C2VDim, ECVDim, EdgeDim, KDim, VertexDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import as_1D_sparse_field, random_field, zero_field
+
+from .test_utils.helpers import as_1D_sparse_field, random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def calculate_nabla2_and_smag_coefficients_for_vn_numpy(
diff --git a/atm_dyn_iconam/tests/test_calculate_nabla2_for_w.py b/atm_dyn_iconam/tests/test_calculate_nabla2_for_w.py
index 6e04bf23b8..9de6f08837 100644
--- a/atm_dyn_iconam/tests/test_calculate_nabla2_for_w.py
+++ b/atm_dyn_iconam/tests/test_calculate_nabla2_for_w.py
@@ -15,8 +15,9 @@
from icon4py.atm_dyn_iconam.calculate_nabla2_for_w import calculate_nabla2_for_w
from icon4py.common.dimension import C2E2CODim, CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def calculate_nabla2_for_w_numpy(
diff --git a/atm_dyn_iconam/tests/test_calculate_nabla2_for_z.py b/atm_dyn_iconam/tests/test_calculate_nabla2_for_z.py
index af3b33afbf..10229e638f 100644
--- a/atm_dyn_iconam/tests/test_calculate_nabla2_for_z.py
+++ b/atm_dyn_iconam/tests/test_calculate_nabla2_for_z.py
@@ -15,8 +15,9 @@
from icon4py.atm_dyn_iconam.calculate_nabla2_for_z import calculate_nabla2_for_z
from icon4py.common.dimension import CellDim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def calculate_nabla2_for_z_numpy(
diff --git a/atm_dyn_iconam/tests/test_calculate_nabla2_of_theta.py b/atm_dyn_iconam/tests/test_calculate_nabla2_of_theta.py
index f4383abc1f..64327ec863 100644
--- a/atm_dyn_iconam/tests/test_calculate_nabla2_of_theta.py
+++ b/atm_dyn_iconam/tests/test_calculate_nabla2_of_theta.py
@@ -18,8 +18,9 @@
calculate_nabla2_of_theta,
)
from icon4py.common.dimension import C2EDim, CEDim, CellDim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import as_1D_sparse_field, random_field, zero_field
+
+from .test_utils.helpers import as_1D_sparse_field, random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def calculate_nabla2_of_theta_numpy(
diff --git a/atm_dyn_iconam/tests/test_calculate_nabla4.py b/atm_dyn_iconam/tests/test_calculate_nabla4.py
index c04c2f3fd5..e1c61f4995 100644
--- a/atm_dyn_iconam/tests/test_calculate_nabla4.py
+++ b/atm_dyn_iconam/tests/test_calculate_nabla4.py
@@ -16,8 +16,9 @@
from icon4py.atm_dyn_iconam.calculate_nabla4 import calculate_nabla4
from icon4py.common.dimension import E2C2VDim, ECVDim, EdgeDim, KDim, VertexDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import as_1D_sparse_field, random_field, zero_field
+
+from .test_utils.helpers import as_1D_sparse_field, random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def calculate_nabla4_numpy(
diff --git a/atm_dyn_iconam/tests/test_enhance_diffusion_coefficient_for_grid_point_cold_pools.py b/atm_dyn_iconam/tests/test_enhance_diffusion_coefficient_for_grid_point_cold_pools.py
index e36e9bf8e4..30cfd73d1d 100644
--- a/atm_dyn_iconam/tests/test_enhance_diffusion_coefficient_for_grid_point_cold_pools.py
+++ b/atm_dyn_iconam/tests/test_enhance_diffusion_coefficient_for_grid_point_cold_pools.py
@@ -17,8 +17,9 @@
enhance_diffusion_coefficient_for_grid_point_cold_pools,
)
from icon4py.common.dimension import CellDim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def enhance_diffusion_coefficient_for_grid_point_cold_pools_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_advection_traj_btraj_compute_o1_dsl.py b/atm_dyn_iconam/tests/test_mo_advection_traj_btraj_compute_o1_dsl.py
index d7753d0218..8f8bc3ba56 100644
--- a/atm_dyn_iconam/tests/test_mo_advection_traj_btraj_compute_o1_dsl.py
+++ b/atm_dyn_iconam/tests/test_mo_advection_traj_btraj_compute_o1_dsl.py
@@ -19,12 +19,9 @@
mo_advection_traj_btraj_compute_o1_dsl,
)
from icon4py.common.dimension import E2CDim, ECDim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import (
- as_1D_sparse_field,
- constant_field,
- random_field,
-)
+
+from .test_utils.helpers import as_1D_sparse_field, constant_field, random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_advection_traj_btraj_compute_o1_dsl_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl.py b/atm_dyn_iconam/tests/test_mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl.py
index 26fca2a7d8..9676e3c2e8 100644
--- a/atm_dyn_iconam/tests/test_mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl.py
+++ b/atm_dyn_iconam/tests/test_mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl.py
@@ -17,8 +17,9 @@
mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl,
)
from icon4py.common.dimension import CellDim, KDim, V2CDim, VertexDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py b/atm_dyn_iconam/tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py
index 7290ac3759..cf621cd1a4 100644
--- a/atm_dyn_iconam/tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py
+++ b/atm_dyn_iconam/tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py
@@ -17,8 +17,9 @@
mo_intp_rbf_rbf_vec_interpol_vertex,
)
from icon4py.common.dimension import EdgeDim, KDim, V2EDim, VertexDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_intp_rbf_rbf_vec_interpol_vertex_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_math_divrot_rot_vertex_ri_dsl.py b/atm_dyn_iconam/tests/test_mo_math_divrot_rot_vertex_ri_dsl.py
index 65b5ed02e9..07deadda10 100644
--- a/atm_dyn_iconam/tests/test_mo_math_divrot_rot_vertex_ri_dsl.py
+++ b/atm_dyn_iconam/tests/test_mo_math_divrot_rot_vertex_ri_dsl.py
@@ -17,8 +17,9 @@
mo_math_divrot_rot_vertex_ri_dsl,
)
from icon4py.common.dimension import EdgeDim, KDim, V2EDim, VertexDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_math_divrot_rot_vertex_ri_dsl_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_math_gradients_grad_green_gauss_cell_dsl.py b/atm_dyn_iconam/tests/test_mo_math_gradients_grad_green_gauss_cell_dsl.py
index 2a8d8fbd7d..40227d5568 100644
--- a/atm_dyn_iconam/tests/test_mo_math_gradients_grad_green_gauss_cell_dsl.py
+++ b/atm_dyn_iconam/tests/test_mo_math_gradients_grad_green_gauss_cell_dsl.py
@@ -17,8 +17,9 @@
mo_math_gradients_grad_green_gauss_cell_dsl,
)
from icon4py.common.dimension import C2E2CODim, CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_math_gradients_grad_green_gauss_cell_dsl_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_nh_diffusion_stencil_15.py b/atm_dyn_iconam/tests/test_mo_nh_diffusion_stencil_15.py
index 9d4f6661a7..c2ec6ba925 100644
--- a/atm_dyn_iconam/tests/test_mo_nh_diffusion_stencil_15.py
+++ b/atm_dyn_iconam/tests/test_mo_nh_diffusion_stencil_15.py
@@ -19,13 +19,14 @@
mo_nh_diffusion_stencil_15,
)
from icon4py.common.dimension import C2E2CDim, CECDim, CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import (
+
+from .test_utils.helpers import (
flatten_first_two_dims,
random_field,
random_mask,
zero_field,
)
+from .test_utils.simple_mesh import SimpleMesh
def mo_nh_diffusion_stencil_15_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_4th_order_divdamp.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_4th_order_divdamp.py
index 05628404d8..a3718d01b3 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_4th_order_divdamp.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_4th_order_divdamp.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_4th_order_divdamp,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_4th_order_divdamp_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_01.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_01.py
index 6372bf8bb0..cc4f45e757 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_01.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_01.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_01,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_01_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_02.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_02.py
index 9189e94f09..df51459407 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_02.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_02.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_02,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_02_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_03.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_03.py
index c39edc0207..69c3feefb7 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_03.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_03.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_03,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_03_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_04.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_04.py
index 930a4469d1..244f9bdca7 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_04.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_04.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_04,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_04_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_05.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_05.py
index 51004727fb..51a52f2b10 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_05.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_05.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_05,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_05_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_06.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_06.py
index 39f7a2955f..b0c74ff8e6 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_06.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_06.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_06,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_06_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_07.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_07.py
index 3f72835dd7..5e83ad278a 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_07.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_07.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_07,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_07_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_08.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_08.py
index d4dfd7e9cd..430c52b785 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_08.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_08.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_08,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_08_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_09.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_09.py
index cd16dc7320..1312a59464 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_09.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_09.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_09,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_09_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_10.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_10.py
index 9587fa19cb..e7c1c5181a 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_10.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_10.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_10,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_10_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_11_lower.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_11_lower.py
index 8402381c32..7177ebfafb 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_11_lower.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_11_lower.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_11_lower,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_11_lower_numpy() -> np.array:
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_11_upper.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_11_upper.py
index 99e04d10b7..a050e0bf3b 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_11_upper.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_11_upper.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_11_upper,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_11_upper_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_12.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_12.py
index fe86c64fd4..afb1a85839 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_12.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_12.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_12,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_12_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_13.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_13.py
index a5bb3838a5..86fec6b518 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_13.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_13.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_13,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_13_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_14.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_14.py
index ace7e34e23..39f926ddb8 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_14.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_14.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_14,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import zero_field
+
+from .test_utils.helpers import zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_14_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_15.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_15.py
index e0e57725c4..16c1ac5fb1 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_15.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_15.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_15,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_15_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_16_fused_btraj_traj_o1.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_16_fused_btraj_traj_o1.py
index f40dfc871e..e4ab4303cc 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_16_fused_btraj_traj_o1.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_16_fused_btraj_traj_o1.py
@@ -18,8 +18,9 @@
mo_solve_nonhydro_stencil_16_fused_btraj_traj_o1,
)
from icon4py.common.dimension import CellDim, E2CDim, ECDim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import as_1D_sparse_field, random_field
+
+from .test_utils.helpers import as_1D_sparse_field, random_field
+from .test_utils.simple_mesh import SimpleMesh
def compute_btraj_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_17.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_17.py
index 021ebf4b5c..c55e276b56 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_17.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_17.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_17,
)
from icon4py.common.dimension import CellDim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_17_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_18.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_18.py
index 76cd667a83..8555bab3ed 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_18.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_18.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_18,
)
from icon4py.common.dimension import CellDim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_18_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_19.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_19.py
index fa7e92ae19..cd163dc2e2 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_19.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_19.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_19,
)
from icon4py.common.dimension import CellDim, E2CDim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_19_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_20.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_20.py
index 61e0513c05..9ec1320cd0 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_20.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_20.py
@@ -19,12 +19,9 @@
mo_solve_nonhydro_stencil_20,
)
from icon4py.common.dimension import CellDim, E2CDim, ECDim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import (
- flatten_first_two_dims,
- random_field,
- zero_field,
-)
+
+from .test_utils.helpers import flatten_first_two_dims, random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_20_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_21.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_21.py
index 12b023ee37..cf2d4ee3d9 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_21.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_21.py
@@ -19,12 +19,9 @@
mo_solve_nonhydro_stencil_21,
)
from icon4py.common.dimension import CellDim, E2CDim, ECDim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import (
- flatten_first_two_dims,
- random_field,
- zero_field,
-)
+
+from .test_utils.helpers import flatten_first_two_dims, random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_21_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_22.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_22.py
index 761373e0e1..41bc0305c4 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_22.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_22.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_22,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, random_mask
+
+from .test_utils.helpers import random_field, random_mask
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_22_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_23.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_23.py
index 1d5076051f..bf367eeed8 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_23.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_23.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_23,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_23_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_24.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_24.py
index 1a32eb8dde..7a89e37ed0 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_24.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_24.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_24,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_24_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_25.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_25.py
index 5b1deb5667..56120f26e0 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_25.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_25.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_25,
)
from icon4py.common.dimension import E2C2EODim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_25_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_26.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_26.py
index 6a6d773045..772ef4bac8 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_26.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_26.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_26,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_26_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_27.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_27.py
index 768657d299..19f91c958a 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_27.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_27.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_27,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_27_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_28.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_28.py
index 84d23a7a69..fc43e0330e 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_28.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_28.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_28,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_28_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_29.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_29.py
index 006622c128..a43fc0fd10 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_29.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_29.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_29,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_29_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_30.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_30.py
index 6f19b08f1f..65a3f1ce4f 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_30.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_30.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_30,
)
from icon4py.common.dimension import E2C2EDim, E2C2EODim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_30_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_31.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_31.py
index 59c342604a..556edef124 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_31.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_31.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_31,
)
from icon4py.common.dimension import E2C2EODim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_31_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_32.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_32.py
index 5b6198f915..7c716e78f2 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_32.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_32.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_32,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_32_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_33.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_33.py
index 43cb64ff70..a9f7c3f87e 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_33.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_33.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_33,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import zero_field
+
+from .test_utils.helpers import zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_33_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_34.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_34.py
index 15d446aaa3..db93e47bda 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_34.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_34.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_34,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_34_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_35.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_35.py
index e50f30a783..a8403a7dac 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_35.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_35.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_35,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_35_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_36.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_36.py
index 3bc074b099..523c833dd1 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_36.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_36.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_36,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_36_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_37.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_37.py
index 6ef9a4a29f..6ad99a0413 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_37.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_37.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_37,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_37_numpy(vn: np.array, vt: np.array) -> tuple[np.array]:
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_38.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_38.py
index ec7c14eb29..baaabf11f5 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_38.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_38.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_38,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_38_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_39.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_39.py
index de638b97a3..1fbef1a76f 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_39.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_39.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_39,
)
from icon4py.common.dimension import C2EDim, CellDim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_39_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_40.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_40.py
index bd7d528cf3..ab0fce797d 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_40.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_40.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_40,
)
from icon4py.common.dimension import C2EDim, CellDim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_40_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_41.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_41.py
index ebdf0260cf..2dbffe70dd 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_41.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_41.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_41,
)
from icon4py.common.dimension import C2EDim, CellDim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_41_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_42.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_42.py
index 2d10595dc0..c27983112d 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_42.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_42.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_42,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_42_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_43.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_43.py
index 2b4adde137..238997182b 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_43.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_43.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_43,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_43_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_44.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_44.py
index 622e1eb3a7..721b811fb1 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_44.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_44.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_44,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_44_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_45.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_45.py
index e972bae38f..7deb2c25de 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_45.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_45.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_45,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import zero_field
+
+from .test_utils.helpers import zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_45_numpy(z_alpha: np.array) -> np.array:
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_46.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_46.py
index cccdd9f570..3cd93384fd 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_46.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_46.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_46,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import zero_field
+
+from .test_utils.helpers import zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_46_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_47.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_47.py
index c89d96e6b1..bbb073f7e3 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_47.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_47.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_47,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_47_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_48.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_48.py
index b679df5a73..363a93bd1f 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_48.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_48.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_48,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_48_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_49.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_49.py
index d943d95de7..6b6c84c0d3 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_49.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_49.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_49,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_49_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_50.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_50.py
index 894a3cdb55..bbe4e81929 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_50.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_50.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_50,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_50_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_51.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_51.py
index 8dba919877..0140a842f2 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_51.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_51.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_51,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_51_z_q_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_52.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_52.py
index 4058893b79..c2ab678402 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_52.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_52.py
@@ -18,8 +18,9 @@
mo_solve_nonhydro_stencil_52,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_52_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_53.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_53.py
index 9716f8f65a..100eb1d575 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_53.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_53.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_53,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_53_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_54.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_54.py
index b77f97eceb..6eead35fed 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_54.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_54.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_54,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_54_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_55.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_55.py
index 94d97876e2..2d561f9b9e 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_55.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_55.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_55,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_55_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_56_63.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_56_63.py
index 58b8aa11ca..eb9521b275 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_56_63.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_56_63.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_56_63,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_56_63_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_57.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_57.py
index ec24b20a8a..4f829406a9 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_57.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_57.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_57,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import zero_field
+
+from .test_utils.helpers import zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_57_numpy(mass_flx_ic: np.array) -> np.array:
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_58.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_58.py
index 739136544f..5065b54823 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_58.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_58.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_58,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_58_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_59.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_59.py
index 37c5447ddb..e44ca54117 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_59.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_59.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_59,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_59_numpy(exner: np.array) -> np.array:
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_60.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_60.py
index f292b8b8b9..dd668d408d 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_60.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_60.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_60,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_60_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_61.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_61.py
index b93c99376c..1013540638 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_61.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_61.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_61,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_61_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_62.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_62.py
index 9c5e8fda5a..6a1d35aebc 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_62.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_62.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_62,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_62_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_64.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_64.py
index 11e9d7aba5..e670bd1044 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_64.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_64.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_64,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import zero_field
+
+from .test_utils.helpers import zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_64_numpy(mass_flx_ic: np.array) -> np.array:
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_65.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_65.py
index 930edcafe8..dad4a29f94 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_65.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_65.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_65,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_65_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_66.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_66.py
index c769c70f8b..f5c35396ab 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_66.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_66.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_66,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, random_mask
+
+from .test_utils.helpers import random_field, random_mask
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_66_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_67.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_67.py
index 166b5b0390..0e7cfcd884 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_67.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_67.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_67,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_67_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_68.py b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_68.py
index 21c65d7a0e..6465852303 100644
--- a/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_68.py
+++ b/atm_dyn_iconam/tests/test_mo_solve_nonhydro_stencil_68.py
@@ -17,8 +17,9 @@
mo_solve_nonhydro_stencil_68,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, random_mask
+
+from .test_utils.helpers import random_field, random_mask
+from .test_utils.simple_mesh import SimpleMesh
def mo_solve_nonhydro_stencil_68_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_01.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_01.py
index 9c4faffd0b..b14a2fda1b 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_01.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_01.py
@@ -17,8 +17,9 @@
mo_velocity_advection_stencil_01,
)
from icon4py.common.dimension import E2C2EDim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_01_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_02.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_02.py
index 48a3ab9f21..daa3152c56 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_02.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_02.py
@@ -17,8 +17,9 @@
mo_velocity_advection_stencil_02,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_02_vn_ie_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_03.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_03.py
index 2e4fc814b6..293a22cfbe 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_03.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_03.py
@@ -17,8 +17,9 @@
mo_velocity_advection_stencil_03,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_03_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_04.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_04.py
index f61915b422..fbb9656ff7 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_04.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_04.py
@@ -17,8 +17,9 @@
mo_velocity_advection_stencil_04,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_04_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_05.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_05.py
index 97b9e3f934..79b08a2c77 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_05.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_05.py
@@ -17,8 +17,9 @@
mo_velocity_advection_stencil_05,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_05_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_06.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_06.py
index 17cabf80cc..7a43be5c50 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_06.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_06.py
@@ -17,8 +17,9 @@
mo_velocity_advection_stencil_06,
)
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_06_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_07.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_07.py
index a2e90bedd8..2a9a89816a 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_07.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_07.py
@@ -17,8 +17,9 @@
mo_velocity_advection_stencil_07,
)
from icon4py.common.dimension import CellDim, EdgeDim, KDim, VertexDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_07_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_08.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_08.py
index 993c7b67d3..9c174d5572 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_08.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_08.py
@@ -17,8 +17,9 @@
mo_velocity_advection_stencil_08,
)
from icon4py.common.dimension import C2EDim, CellDim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_08_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_09.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_09.py
index 59c8552c72..93639d8cd4 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_09.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_09.py
@@ -17,8 +17,9 @@
mo_velocity_advection_stencil_09,
)
from icon4py.common.dimension import C2EDim, CellDim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_09_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_10.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_10.py
index 5c015c7109..0141eb4b69 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_10.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_10.py
@@ -17,8 +17,9 @@
mo_velocity_advection_stencil_10,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_10_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_11.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_11.py
index 1710fe87d5..1b56752e0b 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_11.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_11.py
@@ -17,8 +17,9 @@
mo_velocity_advection_stencil_11,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_11_numpy(w: np.array) -> np.array:
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_12.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_12.py
index cc6ebc6cff..e6f27d1387 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_12.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_12.py
@@ -17,8 +17,9 @@
mo_velocity_advection_stencil_12,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_12_numpy(z_w_con_c: np.array) -> np.array:
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_13.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_13.py
index 17ebbc1584..0d581df222 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_13.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_13.py
@@ -17,8 +17,9 @@
mo_velocity_advection_stencil_13,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_13_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_14.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_14.py
index 8b3218724c..748974ef3e 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_14.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_14.py
@@ -17,8 +17,9 @@
mo_velocity_advection_stencil_14,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, random_mask, zero_field
+
+from .test_utils.helpers import random_field, random_mask, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_14_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_15.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_15.py
index dcaa1e14c6..31e7a3dc26 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_15.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_15.py
@@ -17,8 +17,9 @@
mo_velocity_advection_stencil_15,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_15_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_16.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_16.py
index 434db2a1cb..a20167c385 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_16.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_16.py
@@ -17,8 +17,9 @@
mo_velocity_advection_stencil_16,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_16_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_17.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_17.py
index a44a074107..953d42e0f6 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_17.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_17.py
@@ -17,8 +17,9 @@
mo_velocity_advection_stencil_17,
)
from icon4py.common.dimension import C2EDim, CellDim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_17_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_18.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_18.py
index d9c29162fb..b01db84bf6 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_18.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_18.py
@@ -17,8 +17,9 @@
mo_velocity_advection_stencil_18,
)
from icon4py.common.dimension import C2E2CODim, CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, random_mask
+
+from .test_utils.helpers import random_field, random_mask
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_18_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_19.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_19.py
index 2241f116e1..d0c0a2839d 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_19.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_19.py
@@ -37,8 +37,9 @@
KDim,
VertexDim,
)
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import as_1D_sparse_field, random_field, zero_field
+
+from .test_utils.helpers import as_1D_sparse_field, random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_19_numpy(
diff --git a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_20.py b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_20.py
index 8e55e2be65..101628edba 100644
--- a/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_20.py
+++ b/atm_dyn_iconam/tests/test_mo_velocity_advection_stencil_20.py
@@ -24,8 +24,9 @@
KDim,
VertexDim,
)
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, random_mask
+
+from .test_utils.helpers import random_field, random_mask
+from .test_utils.simple_mesh import SimpleMesh
def mo_velocity_advection_stencil_20_numpy(
diff --git a/atm_dyn_iconam/tests/test_temporary_field_for_grid_point_cold_pools_enhancement.py b/atm_dyn_iconam/tests/test_temporary_field_for_grid_point_cold_pools_enhancement.py
index b45813f7f1..6225933325 100644
--- a/atm_dyn_iconam/tests/test_temporary_field_for_grid_point_cold_pools_enhancement.py
+++ b/atm_dyn_iconam/tests/test_temporary_field_for_grid_point_cold_pools_enhancement.py
@@ -17,8 +17,9 @@
temporary_field_for_grid_point_cold_pools_enhancement,
)
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def temporary_field_for_grid_point_cold_pools_enhancement_numpy(
diff --git a/atm_dyn_iconam/tests/test_temporary_fields_for_turbulence_diagnostics.py b/atm_dyn_iconam/tests/test_temporary_fields_for_turbulence_diagnostics.py
index a8d72a6b66..22b7ea4a4c 100644
--- a/atm_dyn_iconam/tests/test_temporary_fields_for_turbulence_diagnostics.py
+++ b/atm_dyn_iconam/tests/test_temporary_fields_for_turbulence_diagnostics.py
@@ -17,8 +17,9 @@
temporary_fields_for_turbulence_diagnostics,
)
from icon4py.common.dimension import C2EDim, CellDim, EdgeDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field, zero_field
+
+from .test_utils.helpers import random_field, zero_field
+from .test_utils.simple_mesh import SimpleMesh
def mo_nh_diffusion_stencil_02_numpy(
diff --git a/atm_dyn_iconam/tests/test_update_theta_and_exner.py b/atm_dyn_iconam/tests/test_update_theta_and_exner.py
index ca55ddd237..942701ad8a 100644
--- a/atm_dyn_iconam/tests/test_update_theta_and_exner.py
+++ b/atm_dyn_iconam/tests/test_update_theta_and_exner.py
@@ -15,8 +15,9 @@
from icon4py.atm_dyn_iconam.update_theta_and_exner import update_theta_and_exner
from icon4py.common.dimension import CellDim, KDim
-from icon4py.testutils.simple_mesh import SimpleMesh
-from icon4py.testutils.utils import random_field
+
+from .test_utils.helpers import random_field
+from .test_utils.simple_mesh import SimpleMesh
def update_theta_and_exner_numpy(
diff --git a/liskov/src/icon4py/liskov/codegen/shared/__init__.py b/atm_dyn_iconam/tests/test_utils/__init__.py
similarity index 100%
rename from liskov/src/icon4py/liskov/codegen/shared/__init__.py
rename to atm_dyn_iconam/tests/test_utils/__init__.py
diff --git a/testutils/src/icon4py/testutils/utils.py b/atm_dyn_iconam/tests/test_utils/helpers.py
similarity index 91%
rename from testutils/src/icon4py/testutils/utils.py
rename to atm_dyn_iconam/tests/test_utils/helpers.py
index 9726a0f064..f85bbf8f58 100644
--- a/testutils/src/icon4py/testutils/utils.py
+++ b/atm_dyn_iconam/tests/test_utils/helpers.py
@@ -18,7 +18,7 @@
from gt4py.next import common as gt_common
from gt4py.next.iterator import embedded as it_embedded
-from . import simple_mesh
+from .simple_mesh import SimpleMesh
def _shape(
@@ -35,7 +35,7 @@ def _shape(
def random_mask(
- mesh: simple_mesh.SimpleMesh,
+ mesh: SimpleMesh,
*dims: gt_common.Dimension,
dtype: Optional[npt.DTypeLike] = None,
extend: Optional[dict[gt_common.Dimension, int]] = None,
@@ -65,7 +65,7 @@ def random_field(
def zero_field(
- mesh: simple_mesh.SimpleMesh,
+ mesh: SimpleMesh,
*dims: gt_common.Dimension,
dtype=float,
extend: Optional[dict[gt_common.Dimension, int]] = None,
@@ -76,7 +76,7 @@ def zero_field(
def constant_field(
- mesh: simple_mesh.SimpleMesh, value: float, *dims: gt_common.Dimension, dtype=float
+ mesh: SimpleMesh, value: float, *dims: gt_common.Dimension, dtype=float
) -> it_embedded.MutableLocatedField:
return it_embedded.np_as_located_field(*dims)(
value * np.ones(shape=tuple(map(lambda x: mesh.size[x], dims)), dtype=dtype)
@@ -104,7 +104,3 @@ def flatten_first_two_dims(
new_shape = flattened_shape + old_shape[2:]
newarray = np.asarray(field).reshape(new_shape)
return it_embedded.np_as_located_field(*dims)(newarray)
-
-
-def get_stencil_module_path(stencil_module: str, stencil_name: str) -> str:
- return f"icon4py.{stencil_module}.{stencil_name}:{stencil_name}"
diff --git a/testutils/src/icon4py/testutils/simple_mesh.py b/atm_dyn_iconam/tests/test_utils/simple_mesh.py
similarity index 100%
rename from testutils/src/icon4py/testutils/simple_mesh.py
rename to atm_dyn_iconam/tests/test_utils/simple_mesh.py
diff --git a/base-requirements-dev.txt b/base-requirements-dev.txt
index b133520c93..46f4ad777a 100644
--- a/base-requirements-dev.txt
+++ b/base-requirements-dev.txt
@@ -2,6 +2,8 @@
-e git+https://github.com/GridTools/gt4py.git@main#egg=gt4py
# PyPI
+bump2version>=1.0.1
+coverage[toml]>=5.0
flake8>=3.8
flake8-bugbear>=23.1.17
flake8-builtins>=2.0.1
@@ -9,7 +11,7 @@ flake8-debugger>=4.0.0
flake8-docstrings>=1.6.0
flake8-eradicate>=1.3.0
flake8-mutable>=1.2.0
-flake8-rst-docstrings>=0.0.14
+flake8-pyproject>=1.2.2
isort~=5.10
mypy>=0.942
pre-commit~=2.15
diff --git a/liskov/requirements-dev.txt b/liskov/requirements-dev.txt
deleted file mode 100644
index 2cb7bda5e8..0000000000
--- a/liskov/requirements-dev.txt
+++ /dev/null
@@ -1,3 +0,0 @@
--r ../base-requirements-dev.txt
--e ../common
--e .
diff --git a/liskov/setup.cfg b/liskov/setup.cfg
deleted file mode 100644
index a85b07a00f..0000000000
--- a/liskov/setup.cfg
+++ /dev/null
@@ -1,55 +0,0 @@
-# This file is mainly used to configure package creation with setuptools.
-# Documentation:
-# http://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files
-#
-[metadata]
-name = icon4py_liskov
-description = ICON preprocessor to integrate Gt4Py code.
-long_description = file: README.md
-long_description_content_type = text/markdown
-url = https://github.com/C2SM/icon4py
-author = ETH Zurich
-author_email = gridtools@cscs.ch
-license = gpl3
-license_files = LICENSE
-platforms = Linux, Mac
-classifiers =
- Development Status :: 3 - Alpha
- Intended Audience :: Science/Research
- License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
- Operating System :: POSIX
- Programming Language :: Python
- Programming Language :: Python :: 3
- Programming Language :: Python :: 3 :: Only
- Programming Language :: Python :: 3.10
- Programming Language :: Python :: Implementation :: CPython
- Topic :: Scientific/Engineering :: Atmospheric Science
- Topic :: Scientific/Engineering :: Mathematics
- Topic :: Scientific/Engineering :: Physics
-project_urls =
- Source Code = https://github.com/GridTools/gt4py
-
-[options]
-packages = find_namespace:
-install_requires =
- icon4py-common
-
-python_requires = >=3.10
-package_dir =
- = src
-zip_safe = False
-
-[options.package_data]
-# References:
-# https://setuptools.pypa.io/en/latest/userguide/datafiles.html
-# https://github.com/abravalheri/experiment-setuptools-package-data
-* = *.md, *.rst, *.toml, *.txt, py.typed
-
-[options.packages.find]
-where = src
-exclude =
- tests
-
-[options.entry_points]
-console_scripts =
- icon_liskov = icon4py.liskov.cli:main
diff --git a/pyutils/README.md b/pyutils/README.md
deleted file mode 100644
index d57eed8d3f..0000000000
--- a/pyutils/README.md
+++ /dev/null
@@ -1,64 +0,0 @@
-# icon4py-pyutils
-
-## icon4pygen
-
-The `icon4pygen` tool generates GridTools C++ code as well as Fortran and C++ bindings for an icon4py fencil, so that it can be executed from within ICON.
-
-### Usage:
-
-`icon4pygen [OPTIONS] FENCIL BLOCK_SIZE LEVELS_PER_THREAD OUTPATH`
-
-#### Arguments:
-
-```
-FENCIL: The fencil to generate code for. It can be specified as :, where is the dotted name of the containing module and is the name of the fencil.
-BLOCK_SIZE: The number of threads per block to use in a cuda kernel.
-LEVELS_PER_THREAD: How many k-levels to process per thread.
-OUTPATH: The folder in which to write all generated code.
-```
-
-#### Options
-
-```
---is_global: Flag to indicate if the stencil is global.
---imperative: Flag to indicate if the generated code should be written imperatively.
-```
-
-#### Example:
-
-`icon4pygen icon4py.atm_dyn_iconam.mo_velocity_advection_stencil_1:mo_velocity_advection_stencil_1 128 4 /path/to/output/folder`
-
-#### Autocomplete
-
-In order to turn on autocomplete in your shell for `icon4pygen` you need to execute the following in your shell:
-
-```bash
-eval "$(_ICON4PYGEN_COMPLETE=bash_source icon4pygen)"
-```
-
-To permanently enable autocomplete on your system add the above statement to your `~/.bashrc` file.
-
-## f2ser
-
-This tool is designed to parse a well-defined Fortran granule interface and generate ppser statements for each variable in the interface. It uses the `f2py` library to perform the parsing and `liskov` for the generation tasks.
-
-### Usage
-
-`f2ser [OPTIONS] GRANULE_PATH OUTPUT_FILEPATH`
-
-### Arguments
-
-```
-GRANULE_PATH A path to the Fortran source file to be parsed.
-OUTPUT_FILEPATH A path to the output Fortran source file to be generated.
-```
-
-### Options
-
-```
---dependencies PATH Optional list of dependency paths.
---directory TEXT The directory to serialise the variables to.
---prefix TEXT The prefix to use for each serialised variable.
-```
-
-**Note:** The output of f2ser still has to be preprocessed using `pp_ser.py`, which then yields a compilable unit. The serialised files will have `f2ser` as their prefix in the default folder location of the experiment.
diff --git a/pyutils/requirements.txt b/pyutils/requirements.txt
deleted file mode 100644
index c8420e5bf8..0000000000
--- a/pyutils/requirements.txt
+++ /dev/null
@@ -1,3 +0,0 @@
--r ../base-requirements.txt
-../common
-.
diff --git a/pyutils/setup.cfg b/pyutils/setup.cfg
deleted file mode 100644
index 99f1fb95e6..0000000000
--- a/pyutils/setup.cfg
+++ /dev/null
@@ -1,57 +0,0 @@
-# This file is mainly used to configure package creation with setuptools.
-# Documentation:
-# http://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files
-#
-[metadata]
-name = icon4py_pyutils
-description = Icon inspired code in Python and GT4Py
-long_description = file: README.md
-long_description_content_type = text/markdown
-url = https://github.com/C2SM/icon4py
-author = ETH Zurich
-author_email = gridtools@cscs.ch
-license = gpl3
-license_files = LICENSE
-platforms = Linux, Mac
-classifiers =
- Development Status :: 3 - Alpha
- Intended Audience :: Science/Research
- License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
- Operating System :: POSIX
- Programming Language :: Python
- Programming Language :: Python :: 3
- Programming Language :: Python :: 3 :: Only
- Programming Language :: Python :: 3.10
- Programming Language :: Python :: Implementation :: CPython
- Topic :: Scientific/Engineering :: Atmospheric Science
- Topic :: Scientific/Engineering :: Mathematics
- Topic :: Scientific/Engineering :: Physics
-project_urls =
- Source Code = https://github.com/GridTools/gt4py
-
-[options]
-packages = find_namespace:
-install_requires =
- icon4py-common
- tabulate>=0.8.9
- fprettify>=0.3.7
-python_requires = >=3.10
-package_dir =
- = src
-zip_safe = False
-
-[options.package_data]
-# References:
-# https://setuptools.pypa.io/en/latest/userguide/datafiles.html
-# https://github.com/abravalheri/experiment-setuptools-package-data
-* = *.md, *.rst, *.toml, *.txt, py.typed
-
-[options.packages.find]
-where = src
-exclude =
- tests
-
-[options.entry_points]
-console_scripts =
- f2ser = icon4py.f2ser.cli:main
- icon4pygen = icon4py.icon4pygen.cli:main
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 0ae33918fe..85722a57b6 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -2,7 +2,7 @@
# Concretized dependencies in local repo
-e ./common
--e ./pyutils
--e ./testutils
-e ./atm_dyn_iconam
--e ./liskov
+
+# icon4pytools
+-e ./tools
diff --git a/requirements.txt b/requirements.txt
index 0331681cb8..d17dbd0ac3 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,7 +2,7 @@
# Concretized dependencies in local repo
./common
-./pyutils
-./testutils
./atm_dyn_iconam
-./liskov
\ No newline at end of file
+
+# icon4pytools
+./tools
diff --git a/testutils/README.md b/testutils/README.md
deleted file mode 100644
index a5809673f9..0000000000
--- a/testutils/README.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# icon4py-testutils
-
-## Description
-
-Utilities for testing GT4Py ICON stencils.
-
-## Installation instructions
-
-Check `README.MD` file in the root of the repository.
diff --git a/testutils/requirements-dev.txt b/testutils/requirements-dev.txt
deleted file mode 100644
index 2cb7bda5e8..0000000000
--- a/testutils/requirements-dev.txt
+++ /dev/null
@@ -1,3 +0,0 @@
--r ../base-requirements-dev.txt
--e ../common
--e .
diff --git a/testutils/requirements.txt b/testutils/requirements.txt
deleted file mode 100644
index c8420e5bf8..0000000000
--- a/testutils/requirements.txt
+++ /dev/null
@@ -1,3 +0,0 @@
--r ../base-requirements.txt
-../common
-.
diff --git a/testutils/setup.cfg b/testutils/setup.cfg
deleted file mode 100644
index 662776fc15..0000000000
--- a/testutils/setup.cfg
+++ /dev/null
@@ -1,51 +0,0 @@
-# This file is mainly used to configure package creation with setuptools.
-# Documentation:
-# http://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files
-#
-[metadata]
-name = icon4py_testutils
-description = Icon inspired code in Python and GT4Py
-long_description = file: README.md
-long_description_content_type = text/markdown
-url = https://github.com/C2SM/icon4py
-author = ETH Zurich
-author_email = gridtools@cscs.ch
-license = gpl3
-license_files = LICENSE
-platforms = Linux, Mac
-classifiers =
- Development Status :: 3 - Alpha
- Intended Audience :: Science/Research
- License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
- Operating System :: POSIX
- Programming Language :: Python
- Programming Language :: Python :: 3
- Programming Language :: Python :: 3 :: Only
- Programming Language :: Python :: 3.10
- Programming Language :: Python :: Implementation :: CPython
- Topic :: Scientific/Engineering :: Atmospheric Science
- Topic :: Scientific/Engineering :: Mathematics
- Topic :: Scientific/Engineering :: Physics
-project_urls =
- Source Code = https://github.com/C2SM/icon4py
-
-[options]
-packages = find_namespace:
-install_requires =
- icon4py-common
- tabulate
-python_requires = >=3.10
-package_dir =
- = src
-zip_safe = False
-
-[options.package_data]
-# References:
-# https://setuptools.pypa.io/en/latest/userguide/datafiles.html
-# https://github.com/abravalheri/experiment-setuptools-package-data
-* = *.md, *.rst, *.toml, *.txt, py.typed
-
-[options.packages.find]
-where = src
-exclude =
- tests
diff --git a/tools/.bumpversion.cfg b/tools/.bumpversion.cfg
new file mode 100644
index 0000000000..c04dfc55bd
--- /dev/null
+++ b/tools/.bumpversion.cfg
@@ -0,0 +1,10 @@
+[bumpversion]
+current_version = 0.0.4
+parse = (?P\d+)\.(?P\d+)(\.(?P\d+))?
+serialize =
+ {major}.{minor}.{patch}
+
+[bumpversion:file:src/icon4pytools/__init__.py]
+parse = \"(?P\d+)\.(?P\d+)(\.(?P\d+))?\"
+serialize =
+ {major}.{minor}.{patch}
diff --git a/tools/.flake8 b/tools/.flake8
new file mode 100644
index 0000000000..31cecff5ab
--- /dev/null
+++ b/tools/.flake8
@@ -0,0 +1,42 @@
+[flake8]
+# Some sane defaults for the code style checker flake8
+max-line-length = 100
+max-complexity = 15
+doctests = true
+extend-ignore =
+ # Do not perform function calls in argument defaults
+ B008,
+ # Public code object needs docstring
+ D1,
+ # Disable dargling errors by default
+ DAR,
+ # Whitespace before ':' (black formatter breaks this sometimes)
+ E203,
+ # Line too long (using Bugbear's B950 warning)
+ E501,
+ # Line break occurred before a binary operator
+ W503
+
+exclude =
+ .eggs,
+ .gt_cache,
+ .ipynb_checkpoints,
+ .tox,
+ _local_,
+ build,
+ dist,
+ docs,
+ _external_src,
+ tests/_disabled,
+ setup.py
+
+rst-roles =
+ py:mod, mod,
+ py:func, func,
+ py:data, data,
+ py:const, const,
+ py:class, class,
+ py:meth, meth,
+ py:attr, attr,
+ py:exc, exc,
+ py:obj, obj,
diff --git a/tools/.pre-commit-config.yaml b/tools/.pre-commit-config.yaml
new file mode 100644
index 0000000000..6c78812dfd
--- /dev/null
+++ b/tools/.pre-commit-config.yaml
@@ -0,0 +1,125 @@
+default_stages: [commit, push]
+default_language_version:
+ python: python3.10
+ # The latest node version doesn't work on tsa
+ # Remove frozen version once we migrated away from tsa
+ node: 17.9.1
+minimum_pre_commit_version: 2.20.0
+exclude: "atm_dyn_iconam/.*"
+
+repos:
+ - repo: meta
+ hooks:
+ - id: check-hooks-apply
+ stages: [manual]
+ - id: check-useless-excludes
+ stages: [manual]
+
+ - repo: https://github.com/asottile/setup-cfg-fmt
+ rev: v1.20.1
+ hooks:
+ # Run only manually because it deletes comments
+ - id: setup-cfg-fmt
+ name: format setup.cfg
+ stages: [manual]
+
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.3.0
+ hooks:
+ - id: check-case-conflict
+ - id: check-merge-conflict
+ - id: check-shebang-scripts-are-executable
+ - id: check-symlinks
+ - id: check-yaml
+ - id: debug-statements
+ - id: destroyed-symlinks
+
+ - repo: https://gitlab.com/bmares/check-json5
+ rev: v1.0.0
+ hooks:
+ # replaces builtin 'check-json' hook from pre-commit using
+ # json5 library with support for JSON comments
+ - id: check-json5
+
+ - repo: https://github.com/Lucas-C/pre-commit-hooks
+ rev: v1.3.0
+ hooks:
+ - id: insert-license
+ name: add license for all ICON4Py Python source files
+ types: [python]
+ args:
+ [
+ --comment-style,
+ "|#|",
+ --license-filepath,
+ .license_header.txt,
+ --fuzzy-match-generates-todo,
+ ]
+
+ - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
+ rev: v2.4.0
+ hooks:
+ - id: pretty-format-ini
+ name: format INI config files
+ args: [--autofix]
+
+ - repo: https://github.com/pre-commit/mirrors-prettier
+ rev: v2.2.1
+ hooks:
+ - id: prettier
+ name: format JSON/YAML/Markdown files
+ args: [--prose-wrap=never, --print-width=88, --editorconfig]
+ types_or: [json, yaml, markdown]
+
+ - repo: https://github.com/asottile/yesqa
+ rev: v1.3.0
+ hooks:
+ - id: yesqa
+
+ - repo: https://github.com/psf/black
+ rev: 22.3.0
+ hooks:
+ - id: black
+ name: black Python formatter
+ args: [--target-version, py310, --config, tools/pyproject.toml]
+
+ - repo: https://github.com/asottile/blacken-docs
+ rev: v1.12.1
+ hooks:
+ - id: blacken-docs
+ name: black Python formatter for docstrings
+ additional_dependencies: [black==22.3.0]
+
+ - repo: https://github.com/pre-commit/mirrors-isort
+ rev: v5.10.1
+ hooks:
+ - id: isort
+ name: sort Python imports for icon4pytools
+
+ - repo: https://github.com/PyCQA/flake8
+ rev: 4.0.1
+ hooks:
+ - id: flake8
+ name: flake8 code style checks
+ additional_dependencies:
+ - darglint
+ - flake8-bugbear
+ - flake8-builtins
+ - flake8-debugger
+ - flake8-docstrings
+ - flake8-eradicate
+ - flake8-mutable
+ - pygments
+
+ - repo: local
+ hooks:
+ - id: mypy
+ name: mypy static type checker
+ entry: bash -c 'echo mypy disabled'
+ #entry: bash -c 'cd tools; mypy src/' --
+ language: system
+ types_or: [python, pyi]
+ always_run: true
+ pass_filenames: false
+ require_serial: true
+ stages: [commit]
diff --git a/tools/LICENSE b/tools/LICENSE
new file mode 100644
index 0000000000..f288702d2f
--- /dev/null
+++ b/tools/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/liskov/README.md b/tools/README.md
similarity index 62%
rename from liskov/README.md
rename to tools/README.md
index 3089c1d246..d2d54353cf 100644
--- a/liskov/README.md
+++ b/tools/README.md
@@ -1,14 +1,72 @@
-# icon4py-liskov
+# ICON4PyTools
-A preprocessor that facilitates integration of gt4py code into the ICON model.
+## Description
-## Installation
+Tools and utilities for integrating icon4py code into the ICON model.
-To install the icon4py-liskov package, follow the instructions in the `README.md` file located in the root of the repository.
+## Installation instructions
-## Description
+To install `icon4pytools` in a virtual environment, one can use pip with either the `requirements-dev.txt` or `requirements.txt` file. While the `requirements.txt` file will install the package along with its runtime dependencies, the `requirements-dev.txt` file additionally includes development dependencies required for running tests, generating documentation, and building the package from source. Furthermore by using the `requirements-dev.txt` file, the package will be installed in editable mode, allowing the user to make changes to the package's source code and immediately see the effects without having to reinstall the package every time. This is particularly useful during development and testing phases.
+
+```bash
+# create a virtual environment
+python3 -m venv .venv
+
+# activate the virtual environment
+source .venv/bin/activate
+
+# install all dependencies
+pip install -r requirements-dev.txt
+```
+
+## Command-line tools
+
+A variety of command-line tools are available in the shell after installation of `icon4pytools`.
+
+### `icon4pygen`
+
+A bindings generator that generates C++ and Fortran bindings from Gt4Py programs. This tools generates the following code:
+
+- GridTools C++ `gridtools::fn` header file (`.hpp`).
+- A Fortran interface file containing all wrapper functions which can be called from within ICON (`.f90`).
+- A corresponding C (`.cpp, .h`) interface which in turn calls the Gridtools C++ code, as well as the C++ verification utils.
+
+#### Usage
+
+```
+Usage: icon4pygen [OPTIONS] FENCIL [BLOCK_SIZE] [LEVELS_PER_THREAD] [OUTPATH]
+
+ Generate Gridtools C++ code for an icon4py fencil as well as all the associated C++ and Fortran bindings.
+
+ Arguments:
+ FENCIL: may be specified as :, where
+ is the dotted name of the containing module and is the name of the fencil.
+
+ BLOCK_SIZE: refers to the number of threads per block to use in a cuda kernel.
+
+ LEVELS_PER_THREAD: how many k-levels to process per thread.
+
+ OUTPATH: represents a path to the folder in which to write all generated code.
+
+Options:
+ --is_global Whether this is a global run.
+ --imperative Whether to use the imperative code generation backend.
+ --help Show this message and exit.
+```
+
+#### Autocomplete
+
+In order to turn on autocomplete for the available fencils in your shell for `icon4pygen` you need to execute the following in your shell:
+
+```bash
+eval "$(_ICON4PYGEN_COMPLETE=bash_source icon4pygen)"
+```
-The icon4py-liskov package includes the `icon_liskov` CLI tool which takes a fortran file as input and processes it with the ICON-Liskov DSL Preprocessor, generating code and inserting that into the target output file.
+To permanently enable autocomplete on your system add the above statement to your `~/.bashrc` file.
+
+## `icon_liskov`
+
+A preprocessor that facilitates integration of GT4Py code into the ICON model. `icon_liskov` is a CLI tool which takes a fortran file as input and processes it with the ICON-Liskov DSL Preprocessor, generating code and inserting that into the target output file.
`icon_liskov` can either operate in **integration** or **serialisation** mode. In **integration** mode liskov generates calls to Fortran wrapper functions which enable calling icon4py DSL code inside of ICON from Fortran. In **serialisation** mode ppser serialbox statements are generated allowing the serialisation of all variables in all stencils decorated with liskov directives.
@@ -141,3 +199,28 @@ This directive allows generating an nvtx end profile statement.
#### `!$DSL ENDIF()`
This directive generates an `#endif` statement.
+
+### `f2ser`
+
+This tool is designed to parse a well-defined Fortran granule interface and generate ppser statements for each variable in the interface. It uses the `f2py` library to perform the parsing and `liskov` for the generation tasks.
+
+### Usage
+
+`f2ser [OPTIONS] GRANULE_PATH OUTPUT_FILEPATH`
+
+### Arguments
+
+```
+GRANULE_PATH A path to the Fortran source file to be parsed.
+OUTPUT_FILEPATH A path to the output Fortran source file to be generated.
+```
+
+### Options
+
+```
+--dependencies PATH Optional list of dependency paths.
+--directory TEXT The directory to serialise the variables to.
+--prefix TEXT The prefix to use for each serialised variable.
+```
+
+**Note:** The output of f2ser still has to be preprocessed using `pp_ser.py`, which then yields a compilable unit. The serialised files will have `f2ser` as their prefix in the default folder location of the experiment.
diff --git a/tools/pyproject.toml b/tools/pyproject.toml
new file mode 100644
index 0000000000..24ff93a41c
--- /dev/null
+++ b/tools/pyproject.toml
@@ -0,0 +1,127 @@
+[build-system]
+requires = ["setuptools>=61.0", "wheel>=0.40.0"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "icon4pytools"
+description = "Tools and utilities for integrating icon4py code into the ICON model."
+readme = "README.md"
+requires-python = ">=3.10"
+license = {file = "LICENSE"}
+authors = [
+ {email = "gridtools@cscs.ch"},
+ {name = "ETH Zurich"}
+]
+classifiers = [
+ "Development Status :: 3 - Alpha",
+ "Intended Audience :: Science/Research",
+ "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
+ "Operating System :: POSIX",
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3 :: Only",
+ "Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: Implementation :: CPython",
+ "Topic :: Scientific/Engineering :: Atmospheric Science",
+ "Topic :: Scientific/Engineering :: Mathematics",
+ "Topic :: Scientific/Engineering :: Physics"
+]
+dependencies = [
+ "icon4py_atm_dyn_iconam",
+ "gt4py>=1.0.1",
+ "icon4py_common",
+ "tabulate>=0.8.9",
+ "fprettify>=0.3.7"
+]
+dynamic = ['version']
+
+[project.scripts]
+icon_liskov = "icon4pytools.liskov.cli:main"
+icon4pygen = "icon4pytools.icon4pygen.cli:main"
+f2ser = "icon4pytools.f2ser.cli:main"
+
+[project.urls]
+repository = "https://github.com/C2SM/icon4py"
+
+[tool.black]
+exclude = '''
+/(
+ \.git
+ | \.hg
+ | \.mypy_cache
+ | \.tox
+ | \.venv
+ | _build
+ | buck-out
+ | build
+ | dist
+)/
+'''
+include = '\.pyi?$'
+line-length = 100
+target-version = ['py310']
+
+[tool.coverage]
+
+[tool.coverage.html]
+directory = 'tests/_reports/coverage_html'
+
+[tool.coverage.paths]
+source = ['src/icon4pytools/']
+
+[tool.coverage.report]
+exclude_lines = [
+ 'raise AssertionError', # Don't complain if tests don't hit defensive assertion code
+ 'raise NotImplementedError', # Don't complain if tests don't hit defensive assertion code
+ 'if 0:', # Don't complain if non-runnable code isn't run
+ 'if __name__ == .__main__.:' # Don't complain if non-runnable code isn't run
+]
+ignore_errors = true
+
+[tool.coverage.run]
+parallel = true
+branch = true
+source_pkgs = ['icon4pytools']
+
+[tool.isort]
+lexicographical = true
+line_length = 100 # It should be the same as in `tool.black.line-length` above
+lines_after_imports = 2
+profile = 'black'
+sections = ['FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'TESTS', 'LOCALFOLDER']
+skip_gitignore = true
+skip_glob = ['*.venv/**', '_local/**']
+known_third_party = ['gt4py']
+multi_line_output = 3
+use_parentheses = true
+include_trailing_comma = true
+force_grid_wrap = 0
+
+[tool.mypy]
+install_types = true
+non_interactive = true
+exclude = [
+ '^tests/f2ser/*.py',
+ '^tests/icon4pygen/*.py',
+ '^tests/liskov/*.py',
+]
+disallow_incomplete_defs = true
+disallow_untyped_defs = true
+ignore_missing_imports = false
+implicit_reexport = true
+warn_unused_configs = true
+warn_unused_ignores = true
+warn_redundant_casts = true
+show_column_numbers = true
+show_error_codes = true
+
+[tool.pytest]
+
+[tool.pytest.ini_options]
+testpaths = 'tests'
+
+[tool.setuptools.dynamic]
+version = {attr = 'icon4pytools.__init__.__version__'}
+
+[tool.setuptools.package-data]
+'icon4pytools' = ['py.typed']
diff --git a/pyutils/requirements-dev.txt b/tools/requirements-dev.txt
similarity index 70%
rename from pyutils/requirements-dev.txt
rename to tools/requirements-dev.txt
index 2cb7bda5e8..217c64d713 100644
--- a/pyutils/requirements-dev.txt
+++ b/tools/requirements-dev.txt
@@ -1,3 +1,4 @@
-r ../base-requirements-dev.txt
-e ../common
+-e ../atm_dyn_iconam
-e .
diff --git a/liskov/requirements.txt b/tools/requirements.txt
similarity index 68%
rename from liskov/requirements.txt
rename to tools/requirements.txt
index c8420e5bf8..b6eac2aa8a 100644
--- a/liskov/requirements.txt
+++ b/tools/requirements.txt
@@ -1,3 +1,4 @@
-r ../base-requirements.txt
../common
+../atm_dyn_iconam
.
diff --git a/testutils/src/icon4py/testutils/liskov_test_utils.py b/tools/src/icon4pytools/__init__.py
similarity index 52%
rename from testutils/src/icon4py/testutils/liskov_test_utils.py
rename to tools/src/icon4pytools/__init__.py
index 526dcd39cf..b8a1e792ed 100644
--- a/testutils/src/icon4py/testutils/liskov_test_utils.py
+++ b/tools/src/icon4pytools/__init__.py
@@ -11,19 +11,26 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
-from pathlib import Path
+"""Package metadata: version, authors, license and copyright."""
-import icon4py.liskov.parsing.types as ts
-from icon4py.liskov.parsing.scan import DirectivesScanner
+from typing import Final
+from packaging import version as pkg_version
-def scan_for_directives(fpath: Path) -> list[ts.RawDirective]:
- collector = DirectivesScanner(fpath)
- return collector()
+__all__ = [
+ "__author__",
+ "__copyright__",
+ "__license__",
+ "__version__",
+ "__version_info__",
+]
-def insert_new_lines(fname: Path, lines: list[str]) -> None:
- """Append new lines into file."""
- with open(fname, "a") as f:
- for ln in lines:
- f.write(f"{ln}\n")
+
+__author__: Final = "ETH Zurich and individual contributors"
+__copyright__: Final = "Copyright (c) 2014-2022 ETH Zurich"
+__license__: Final = "GPL-3.0-or-later"
+
+
+__version__: Final = "0.0.4"
+__version_info__: Final = pkg_version.parse(__version__)
diff --git a/liskov/src/icon4py/liskov/external/__init__.py b/tools/src/icon4pytools/common/__init__.py
similarity index 100%
rename from liskov/src/icon4py/liskov/external/__init__.py
rename to tools/src/icon4pytools/common/__init__.py
diff --git a/common/src/icon4py/common/logger.py b/tools/src/icon4pytools/common/logger.py
similarity index 89%
rename from common/src/icon4py/common/logger.py
rename to tools/src/icon4pytools/common/logger.py
index 636a582d49..d7f7341fed 100644
--- a/common/src/icon4py/common/logger.py
+++ b/tools/src/icon4pytools/common/logger.py
@@ -18,9 +18,7 @@ def setup_logger(name: str, log_level: int = logging.INFO) -> logging.Logger:
"""Set up a logger with a given name and log level."""
logger = logging.getLogger(name)
logger.setLevel(log_level)
- formatter = logging.Formatter(
- "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
- )
+ formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
stream_handler = logging.StreamHandler()
stream_handler.setFormatter(formatter)
logger.addHandler(stream_handler)
diff --git a/liskov/src/icon4py/liskov/parsing/__init__.py b/tools/src/icon4pytools/f2ser/__init__.py
similarity index 100%
rename from liskov/src/icon4py/liskov/parsing/__init__.py
rename to tools/src/icon4pytools/f2ser/__init__.py
diff --git a/pyutils/src/icon4py/f2ser/cli.py b/tools/src/icon4pytools/f2ser/cli.py
similarity index 77%
rename from pyutils/src/icon4py/f2ser/cli.py
rename to tools/src/icon4pytools/f2ser/cli.py
index 8a65333249..290d8a54f9 100644
--- a/pyutils/src/icon4py/f2ser/cli.py
+++ b/tools/src/icon4pytools/f2ser/cli.py
@@ -16,20 +16,16 @@
import click
-from icon4py.f2ser.deserialise import ParsedGranuleDeserialiser
-from icon4py.f2ser.parse import GranuleParser
-from icon4py.liskov.codegen.serialisation.generate import (
- SerialisationCodeGenerator,
-)
-from icon4py.liskov.codegen.shared.write import CodegenWriter
+from icon4pytools.f2ser.deserialise import ParsedGranuleDeserialiser
+from icon4pytools.f2ser.parse import GranuleParser
+from icon4pytools.liskov.codegen.serialisation.generate import SerialisationCodeGenerator
+from icon4pytools.liskov.codegen.shared.write import CodegenWriter
@click.command("icon_f2ser")
@click.argument(
"granule_path",
- type=click.Path(
- exists=True, dir_okay=False, resolve_path=True, path_type=pathlib.Path
- ),
+ type=click.Path(exists=True, dir_okay=False, resolve_path=True, path_type=pathlib.Path),
)
@click.argument(
"output_filepath",
@@ -43,10 +39,16 @@
help="Optional list of dependency paths.",
)
@click.option(
- "--directory", type=str, help="Directory to serialise variables to.", default="."
+ "--directory",
+ type=str,
+ help="Directory to serialise variables to.",
+ default=".",
)
@click.option(
- "--prefix", type=str, help="Prefix to use for serialised files.", default="f2ser"
+ "--prefix",
+ type=str,
+ help="Prefix to use for serialised files.",
+ default="f2ser",
)
@click.option(
"--multinode",
diff --git a/pyutils/src/icon4py/f2ser/deserialise.py b/tools/src/icon4pytools/f2ser/deserialise.py
similarity index 92%
rename from pyutils/src/icon4py/f2ser/deserialise.py
rename to tools/src/icon4pytools/f2ser/deserialise.py
index daeee81950..883daddc94 100644
--- a/pyutils/src/icon4py/f2ser/deserialise.py
+++ b/tools/src/icon4pytools/f2ser/deserialise.py
@@ -11,8 +11,8 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
-from icon4py.f2ser.parse import CodegenContext, ParsedGranule
-from icon4py.liskov.codegen.serialisation.interface import (
+from icon4pytools.f2ser.parse import CodegenContext, ParsedGranule
+from icon4pytools.liskov.codegen.serialisation.interface import (
FieldSerialisationData,
ImportData,
InitData,
@@ -55,9 +55,7 @@ def _make_savepoints(self) -> None:
for intent, var_dict in intent_dict.items():
self._create_savepoint(subroutine_name, intent, var_dict)
- def _create_savepoint(
- self, subroutine_name: str, intent: str, var_dict: dict
- ) -> None:
+ def _create_savepoint(self, subroutine_name: str, intent: str, var_dict: dict) -> None:
"""Create a savepoint for the given variables.
Args:
@@ -73,9 +71,7 @@ def _create_savepoint(
FieldSerialisationData(
variable=var_name,
association=self._create_association(var_data, var_name),
- decomposed=var_data["decomposed"]
- if var_data.get("decomposed")
- else False,
+ decomposed=var_data["decomposed"] if var_data.get("decomposed") else False,
dimension=var_data.get("dimension"),
typespec=var_data.get("typespec"),
typename=var_data.get("typename"),
@@ -139,9 +135,7 @@ def _make_init_data(self) -> None:
for intent, var_dict in intent_dict.items()
if intent == "in"
][0]
- startln = self._get_codegen_line(
- first_intent_in_subroutine["codegen_ctx"], "init"
- )
+ startln = self._get_codegen_line(first_intent_in_subroutine["codegen_ctx"], "init")
self.data["Init"] = InitData(
startln=startln,
directory=self.directory,
diff --git a/pyutils/src/icon4py/f2ser/exceptions.py b/tools/src/icon4pytools/f2ser/exceptions.py
similarity index 100%
rename from pyutils/src/icon4py/f2ser/exceptions.py
rename to tools/src/icon4pytools/f2ser/exceptions.py
diff --git a/pyutils/src/icon4py/f2ser/parse.py b/tools/src/icon4pytools/f2ser/parse.py
similarity index 92%
rename from pyutils/src/icon4py/f2ser/parse.py
rename to tools/src/icon4pytools/f2ser/parse.py
index 5080ce9ba4..28fdacb725 100644
--- a/pyutils/src/icon4py/f2ser/parse.py
+++ b/tools/src/icon4pytools/f2ser/parse.py
@@ -15,11 +15,11 @@
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
-from typing import Optional
+from typing import Any, Optional
from numpy.f2py.crackfortran import crackfortran
-from icon4py.f2ser.exceptions import MissingDerivedTypeError, ParsingError
+from icon4pytools.f2ser.exceptions import MissingDerivedTypeError, ParsingError
def crack(path: Path) -> dict:
@@ -59,9 +59,7 @@ class GranuleParser:
parsed_types = parser()
"""
- def __init__(
- self, granule: Path, dependencies: Optional[list[Path]] = None
- ) -> None:
+ def __init__(self, granule: Path, dependencies: Optional[list[Path]] = None) -> None:
self.granule_path = granule
self.dependencies = dependencies
@@ -74,17 +72,14 @@ def __call__(self) -> ParsedGranule:
def parse_subroutines(self):
subroutines = self._extract_subroutines(crack(self.granule_path))
variables_grouped_by_intent = {
- name: self._extract_intent_vars(routine)
- for name, routine in subroutines.items()
+ name: self._extract_intent_vars(routine) for name, routine in subroutines.items()
}
- intrinsic_type_vars, derived_type_vars = self._parse_types(
- variables_grouped_by_intent
- )
+ intrinsic_type_vars, derived_type_vars = self._parse_types(variables_grouped_by_intent)
combined_type_vars = self._combine_types(derived_type_vars, intrinsic_type_vars)
with_lines = self._update_with_codegen_lines(combined_type_vars)
return with_lines
- def _extract_subroutines(self, parsed: dict[str, any]) -> dict[str, any]:
+ def _extract_subroutines(self, parsed: dict[str, Any]) -> dict[str, Any]:
"""Extract the _init and _run subroutines from the parsed granule.
Args:
@@ -100,9 +95,7 @@ def _extract_subroutines(self, parsed: dict[str, any]) -> dict[str, any]:
subroutines[name] = elt
if len(subroutines) != 2:
- raise ParsingError(
- f"Did not find _init and _run subroutines in {self.granule_path}"
- )
+ raise ParsingError(f"Did not find _init and _run subroutines in {self.granule_path}")
return subroutines
@@ -216,9 +209,7 @@ def _decompose_derived_types(derived_types: dict) -> dict:
new_type_name = f"{var_name}_{subtype_name}"
new_var_dict = var_dict.copy()
new_var_dict.update(subtype_spec)
- decomposed_vars[subroutine][intent][
- new_type_name
- ] = new_var_dict
+ decomposed_vars[subroutine][intent][new_type_name] = new_var_dict
new_var_dict["ptr_var"] = subtype_name
else:
decomposed_vars[subroutine][intent][var_name] = var_dict
@@ -255,9 +246,9 @@ def _update_with_codegen_lines(self, parsed_types: dict) -> dict:
with_lines = deepcopy(parsed_types)
for subroutine in with_lines:
for intent in with_lines[subroutine]:
- with_lines[subroutine][intent][
- "codegen_ctx"
- ] = self.get_subroutine_lines(subroutine)
+ with_lines[subroutine][intent]["codegen_ctx"] = self.get_subroutine_lines(
+ subroutine
+ )
return with_lines
def find_last_fortran_use_statement(self):
@@ -305,9 +296,7 @@ def get_subroutine_lines(self, subroutine_name: str) -> CodegenContext:
declaration_pattern = r".*::\s*(\w+\b)"
declaration_pattern_lines = [
i
- for i, line in enumerate(
- code.splitlines()[start_subroutine_ln:end_subroutine_ln]
- )
+ for i, line in enumerate(code.splitlines()[start_subroutine_ln:end_subroutine_ln])
if re.search(declaration_pattern, line)
]
if not declaration_pattern_lines:
@@ -319,6 +308,4 @@ def get_subroutine_lines(self, subroutine_name: str) -> CodegenContext:
end_subroutine_ln - 1
) # we want to generate the code before the end of the subroutine
- return CodegenContext(
- first_declaration_ln, last_declaration_ln, pre_end_subroutine_ln
- )
+ return CodegenContext(first_declaration_ln, last_declaration_ln, pre_end_subroutine_ln)
diff --git a/liskov/src/icon4py/liskov/pipeline/__init__.py b/tools/src/icon4pytools/icon4pygen/__init__.py
similarity index 100%
rename from liskov/src/icon4py/liskov/pipeline/__init__.py
rename to tools/src/icon4pytools/icon4pygen/__init__.py
diff --git a/pyutils/src/icon4py/icon4pygen/backend.py b/tools/src/icon4pytools/icon4pygen/backend.py
similarity index 94%
rename from pyutils/src/icon4py/icon4pygen/backend.py
rename to tools/src/icon4pytools/icon4pygen/backend.py
index caa138d5d9..80b5a10e9a 100644
--- a/pyutils/src/icon4py/icon4pygen/backend.py
+++ b/tools/src/icon4pytools/icon4pygen/backend.py
@@ -15,11 +15,11 @@
from gt4py.next.iterator import ir as itir
from gt4py.next.program_processors.codegens.gtfn.gtfn_backend import generate
-
from icon4py.common.dimension import Koff
-from icon4py.icon4pygen.bindings.utils import write_string
-from icon4py.icon4pygen.exceptions import MultipleFieldOperatorException
-from icon4py.icon4pygen.metadata import StencilInfo
+
+from icon4pytools.icon4pygen.bindings.utils import write_string
+from icon4pytools.icon4pygen.exceptions import MultipleFieldOperatorException
+from icon4pytools.icon4pygen.metadata import StencilInfo
H_START = "horizontal_start"
diff --git a/pyutils/src/icon4py/f2ser/__init__.py b/tools/src/icon4pytools/icon4pygen/bindings/__init__.py
similarity index 100%
rename from pyutils/src/icon4py/f2ser/__init__.py
rename to tools/src/icon4pytools/icon4pygen/bindings/__init__.py
diff --git a/pyutils/src/icon4py/icon4pygen/__init__.py b/tools/src/icon4pytools/icon4pygen/bindings/codegen/__init__.py
similarity index 100%
rename from pyutils/src/icon4py/icon4pygen/__init__.py
rename to tools/src/icon4pytools/icon4pygen/bindings/codegen/__init__.py
diff --git a/pyutils/src/icon4py/icon4pygen/bindings/codegen/cpp.py b/tools/src/icon4pytools/icon4pygen/bindings/codegen/cpp.py
similarity index 97%
rename from pyutils/src/icon4py/icon4pygen/bindings/codegen/cpp.py
rename to tools/src/icon4pytools/icon4pygen/bindings/codegen/cpp.py
index b7d65be709..ba6951f572 100644
--- a/pyutils/src/icon4py/icon4pygen/bindings/codegen/cpp.py
+++ b/tools/src/icon4pytools/icon4pygen/bindings/codegen/cpp.py
@@ -18,7 +18,7 @@
from gt4py.eve.codegen import JinjaTemplate as as_jinja
from gt4py.eve.codegen import Node, TemplatedGenerator, format_source
-from icon4py.icon4pygen.bindings.codegen.header import (
+from icon4pytools.icon4pygen.bindings.codegen.header import (
CppFreeFunc,
CppRunAndVerifyFuncDeclaration,
CppRunFuncDeclaration,
@@ -27,11 +27,9 @@
run_func_declaration,
run_verify_func_declaration,
)
-from icon4py.icon4pygen.bindings.codegen.render.offset import (
- GpuTriMeshOffsetRenderer,
-)
-from icon4py.icon4pygen.bindings.entities import Field, Offset
-from icon4py.icon4pygen.bindings.utils import write_string
+from icon4pytools.icon4pygen.bindings.codegen.render.offset import GpuTriMeshOffsetRenderer
+from icon4pytools.icon4pygen.bindings.entities import Field, Offset
+from icon4pytools.icon4pygen.bindings.utils import write_string
class CppDefGenerator(TemplatedGenerator):
@@ -665,12 +663,8 @@ def _get_field_data(self) -> tuple:
]
sparse_fields = [field for field in self.fields if field.is_sparse()]
compound_fields = [field for field in self.fields if field.is_compound()]
- sparse_offsets = [
- offset for offset in self.offsets if not offset.is_compound_location()
- ]
- strided_offsets = [
- offset for offset in self.offsets if offset.is_compound_location()
- ]
+ sparse_offsets = [offset for offset in self.offsets if not offset.is_compound_location()]
+ strided_offsets = [offset for offset in self.offsets if offset.is_compound_location()]
all_fields = self.fields
offsets = dict(sparse=sparse_offsets, strided=strided_offsets)
@@ -715,9 +709,7 @@ def __post_init__(self) -> None: # type: ignore
),
public_utilities=PublicUtilities(fields=fields["output"]),
copy_pointers=CopyPointers(fields=self.fields),
- private_members=PrivateMembers(
- fields=self.fields, out_fields=fields["output"]
- ),
+ private_members=PrivateMembers(fields=self.fields, out_fields=fields["output"]),
setup_func=StencilClassSetupFunc(
funcname=self.stencil_name,
out_fields=fields["output"],
diff --git a/pyutils/src/icon4py/icon4pygen/bindings/codegen/f90.py b/tools/src/icon4pytools/icon4pygen/bindings/codegen/f90.py
similarity index 89%
rename from pyutils/src/icon4py/icon4pygen/bindings/codegen/f90.py
rename to tools/src/icon4pytools/icon4pygen/bindings/codegen/f90.py
index c4d22d753e..a3cc0a3e41 100644
--- a/pyutils/src/icon4py/icon4pygen/bindings/codegen/f90.py
+++ b/tools/src/icon4pytools/icon4pygen/bindings/codegen/f90.py
@@ -19,8 +19,8 @@
from gt4py.eve.codegen import JinjaTemplate as as_jinja
from gt4py.eve.codegen import TemplatedGenerator
-from icon4py.icon4pygen.bindings.entities import Field, Offset
-from icon4py.icon4pygen.bindings.utils import format_fortran_code, write_string
+from icon4pytools.icon4pygen.bindings.entities import Field, Offset
+from icon4pytools.icon4pygen.bindings.utils import format_fortran_code, write_string
_DOMAIN_ARGS = [
@@ -164,9 +164,7 @@ class F90Generator(TemplatedGenerator):
F90Field = as_jinja("{{ name }}{% if suffix %}_{{ suffix }}{% endif %}")
- F90OpenACCField = as_jinja(
- "!$ACC {{ name }}{% if suffix %}_{{ suffix }}{% endif %}"
- )
+ F90OpenACCField = as_jinja("!$ACC {{ name }}{% if suffix %}_{{ suffix }}{% endif %}")
F90TypedField = as_jinja(
"{{ dtype }}, {% if dims %}{{ dims }},{% endif %} target {% if _this_node.optional %} , optional {% endif %}:: {{ name }}{% if suffix %}_{{ suffix }}{% endif %} "
@@ -228,13 +226,10 @@ def __post_init__(self) -> None: # type: ignore
)
for field in self.all_fields
] + [
- F90TypedField(name=name, dtype="integer(c_int)", dims="value")
- for name in _DOMAIN_ARGS
+ F90TypedField(name=name, dtype="integer(c_int)", dims="value") for name in _DOMAIN_ARGS
]
- self.params = F90EntityList(
- fields=param_fields, line_end=", &", line_end_last=" &"
- )
+ self.params = F90EntityList(fields=param_fields, line_end=", &", line_end_last=" &")
self.binds = F90EntityList(fields=bind_fields)
@@ -278,19 +273,18 @@ def __post_init__(self) -> None: # type: ignore
)
for field in self.tol_fields:
- param_fields += [
- F90Field(name=field.name, suffix=s) for s in ["rel_tol", "abs_tol"]
- ]
+ param_fields += [F90Field(name=field.name, suffix=s) for s in ["rel_tol", "abs_tol"]]
bind_fields += [
F90TypedField(
- name=field.name, suffix=s, dtype="real(c_double)", dims="value"
+ name=field.name,
+ suffix=s,
+ dtype="real(c_double)",
+ dims="value",
)
for s in ["rel_tol", "abs_tol"]
]
- self.params = F90EntityList(
- fields=param_fields, line_end=", &", line_end_last=" &"
- )
+ self.params = F90EntityList(fields=param_fields, line_end=", &", line_end_last=" &")
self.binds = F90EntityList(fields=bind_fields)
@@ -317,21 +311,24 @@ def __post_init__(self) -> None: # type: ignore
F90TypedField(name="mesh", dtype="type(c_ptr)", dims="value"),
F90TypedField(name="k_size", dtype="integer(c_int)", dims="value"),
F90TypedField(
- name="stream", dtype="integer(kind=acc_handle_kind)", dims="value"
+ name="stream",
+ dtype="integer(kind=acc_handle_kind)",
+ dims="value",
),
F90TypedField(name="json_record", dtype="type(c_ptr)", dims="value"),
F90TypedField(name="mesh_info_vtk", dtype="type(c_ptr)", dims="value"),
F90TypedField(name="verify", dtype="type(c_ptr)", dims="value"),
] + [
F90TypedField(
- name=field.name, dtype="integer(c_int)", dims="value", suffix="kmax"
+ name=field.name,
+ dtype="integer(c_int)",
+ dims="value",
+ suffix="kmax",
)
for field in self.out_fields
]
- self.params = F90EntityList(
- fields=param_fields, line_end=", &", line_end_last=" &"
- )
+ self.params = F90EntityList(fields=param_fields, line_end=", &", line_end_last=" &")
self.binds = F90EntityList(fields=bind_fields)
@@ -393,9 +390,7 @@ def __post_init__(self) -> None: # type: ignore
for field in self.tol_fields
]
open_acc_fields = [
- F90OpenACCField(name=field.name)
- for field in self.all_fields
- if field.rank() != 0
+ F90OpenACCField(name=field.name) for field in self.all_fields if field.rank() != 0
] + [
F90OpenACCField(name=field.name, suffix="before")
for field in self.out_fields
@@ -425,9 +420,7 @@ def __post_init__(self) -> None: # type: ignore
]
for field in self.tol_fields:
- param_fields += [
- F90Field(name=field.name, suffix=s) for s in ["rel_tol", "abs_tol"]
- ]
+ param_fields += [F90Field(name=field.name, suffix=s) for s in ["rel_tol", "abs_tol"]]
bind_fields += [
F90TypedField(
name=field.name,
@@ -439,25 +432,18 @@ def __post_init__(self) -> None: # type: ignore
for s in ["rel_tol", "abs_tol"]
]
run_ver_param_fields += [
- F90Field(name=field.name, suffix=s)
- for s in ["rel_err_tol", "abs_err_tol"]
+ F90Field(name=field.name, suffix=s) for s in ["rel_err_tol", "abs_err_tol"]
]
- self.params = F90EntityList(
- fields=param_fields, line_end=", &", line_end_last=" &"
- )
+ self.params = F90EntityList(fields=param_fields, line_end=", &", line_end_last=" &")
self.binds = F90EntityList(fields=bind_fields)
self.tol_decls = F90EntityList(fields=tol_fields)
self.conditionals = F90EntityList(fields=cond_fields)
- self.openacc = F90EntityList(
- fields=open_acc_fields, line_end=", &", line_end_last=" &"
- )
+ self.openacc = F90EntityList(fields=open_acc_fields, line_end=", &", line_end_last=" &")
self.run_ver_params = F90EntityList(
fields=run_ver_param_fields, line_end=", &", line_end_last=" &"
)
- self.run_params = F90EntityList(
- fields=run_param_fields, line_end=", &", line_end_last=" &"
- )
+ self.run_params = F90EntityList(fields=run_param_fields, line_end=", &", line_end_last=" &")
class F90WrapSetupFun(Node):
@@ -487,7 +473,9 @@ def __post_init__(self) -> None: # type: ignore
F90TypedField(name="mesh", dtype="type(c_ptr)", dims="value"),
F90TypedField(name="k_size", dtype="integer(c_int)", dims="value"),
F90TypedField(
- name="stream", dtype="integer(kind=acc_handle_kind)", dims="value"
+ name="stream",
+ dtype="integer(kind=acc_handle_kind)",
+ dims="value",
),
F90TypedField(name="json_record", dtype="type(c_ptr)", dims="value"),
F90TypedField(name="mesh_info_vtk", dtype="type(c_ptr)", dims="value"),
@@ -526,9 +514,7 @@ def __post_init__(self) -> None: # type: ignore
]
] + [F90Field(name=field.name, suffix="kvert_max") for field in self.out_fields]
- self.params = F90EntityList(
- fields=param_fields, line_end=", &", line_end_last=" &"
- )
+ self.params = F90EntityList(fields=param_fields, line_end=", &", line_end_last=" &")
self.binds = F90EntityList(fields=bind_fields)
self.vert_decls = F90EntityList(fields=vert_fields)
self.vert_conditionals = F90EntityList(fields=vert_conditionals_fields)
@@ -586,7 +572,10 @@ def __post_init__(self) -> None: # type: ignore
def generate_f90_file(
- stencil_name: str, fields: Sequence[Field], offsets: Sequence[Offset], outpath: Path
+ stencil_name: str,
+ fields: Sequence[Field],
+ offsets: Sequence[Offset],
+ outpath: Path,
) -> None:
f90 = F90File(stencil_name=stencil_name, fields=fields, offsets=offsets)
source = F90Generator.apply(f90)
diff --git a/pyutils/src/icon4py/icon4pygen/bindings/codegen/header.py b/tools/src/icon4pytools/icon4pygen/bindings/codegen/header.py
similarity index 97%
rename from pyutils/src/icon4py/icon4pygen/bindings/codegen/header.py
rename to tools/src/icon4pytools/icon4pygen/bindings/codegen/header.py
index 321dae71c2..045cea7827 100644
--- a/pyutils/src/icon4py/icon4pygen/bindings/codegen/header.py
+++ b/tools/src/icon4pytools/icon4pygen/bindings/codegen/header.py
@@ -19,8 +19,8 @@
from gt4py.eve.codegen import JinjaTemplate as as_jinja
from gt4py.eve.codegen import TemplatedGenerator, format_source
-from icon4py.icon4pygen.bindings.entities import Field
-from icon4py.icon4pygen.bindings.utils import write_string
+from icon4pytools.icon4pygen.bindings.entities import Field
+from icon4pytools.icon4pygen.bindings.utils import write_string
run_func_declaration = as_jinja(
diff --git a/pyutils/src/icon4py/icon4pygen/bindings/__init__.py b/tools/src/icon4pytools/icon4pygen/bindings/codegen/render/__init__.py
similarity index 100%
rename from pyutils/src/icon4py/icon4pygen/bindings/__init__.py
rename to tools/src/icon4pytools/icon4pygen/bindings/codegen/render/__init__.py
diff --git a/pyutils/src/icon4py/icon4pygen/bindings/codegen/render/field.py b/tools/src/icon4pytools/icon4pygen/bindings/codegen/render/field.py
similarity index 88%
rename from pyutils/src/icon4py/icon4pygen/bindings/codegen/render/field.py
rename to tools/src/icon4pytools/icon4pygen/bindings/codegen/render/field.py
index 6b21fd7476..e9106fba0e 100644
--- a/pyutils/src/icon4py/icon4pygen/bindings/codegen/render/field.py
+++ b/tools/src/icon4pytools/icon4pygen/bindings/codegen/render/field.py
@@ -13,12 +13,12 @@
from dataclasses import dataclass
-from icon4py.icon4pygen.bindings.codegen.type_conversion import (
+from icon4pytools.icon4pygen.bindings.codegen.type_conversion import (
BUILTIN_TO_CPP_TYPE,
BUILTIN_TO_ISO_C_TYPE,
)
-from icon4py.icon4pygen.bindings.codegen.types import FieldEntity
-from icon4py.icon4pygen.bindings.exceptions import BindingsRenderingException
+from icon4pytools.icon4pygen.bindings.codegen.types import FieldEntity
+from icon4pytools.icon4pygen.bindings.exceptions import BindingsRenderingException
@dataclass(frozen=True)
@@ -34,11 +34,7 @@ def render_pointer(self) -> str:
def render_dim_tags(self) -> str:
"""Render c++ dimension tags."""
tags = []
- if (
- self.entity.is_dense()
- or self.entity.is_sparse()
- or self.entity.is_compound()
- ):
+ if self.entity.is_dense() or self.entity.is_sparse() or self.entity.is_compound():
tags.append("unstructured::dim::horizontal")
if self.entity.has_vertical_dimension:
tags.append("unstructured::dim::vertical")
@@ -50,9 +46,7 @@ def render_sid(self) -> str:
raise BindingsRenderingException("can not render sid of a scalar")
# We want to compute the rank without the sparse dimension, i.e. if a field is horizontal, vertical or both.
- dense_rank = self.entity.rank() - int(
- self.entity.is_sparse() or self.entity.is_compound()
- )
+ dense_rank = self.entity.rank() - int(self.entity.is_sparse() or self.entity.is_compound())
if dense_rank == 1:
values_str = "1"
elif self.entity.is_compound():
diff --git a/pyutils/src/icon4py/icon4pygen/bindings/codegen/render/location.py b/tools/src/icon4pytools/icon4pygen/bindings/codegen/render/location.py
similarity index 92%
rename from pyutils/src/icon4py/icon4pygen/bindings/codegen/render/location.py
rename to tools/src/icon4pytools/icon4pygen/bindings/codegen/render/location.py
index 56dd9cf70c..ea054d9971 100644
--- a/pyutils/src/icon4py/icon4pygen/bindings/codegen/render/location.py
+++ b/tools/src/icon4pytools/icon4pygen/bindings/codegen/render/location.py
@@ -11,7 +11,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
-from icon4py.icon4pygen.bindings.exceptions import BindingsRenderingException
+from icon4pytools.icon4pygen.bindings.exceptions import BindingsRenderingException
class LocationRenderer:
diff --git a/pyutils/src/icon4py/icon4pygen/bindings/codegen/render/offset.py b/tools/src/icon4pytools/icon4pygen/bindings/codegen/render/offset.py
similarity index 89%
rename from pyutils/src/icon4py/icon4pygen/bindings/codegen/render/offset.py
rename to tools/src/icon4pytools/icon4pygen/bindings/codegen/render/offset.py
index ee496d3ad2..aa40dcf2ad 100644
--- a/pyutils/src/icon4py/icon4pygen/bindings/codegen/render/offset.py
+++ b/tools/src/icon4pytools/icon4pygen/bindings/codegen/render/offset.py
@@ -14,8 +14,8 @@
from dataclasses import dataclass
from typing import Sequence
-from icon4py.icon4pygen.bindings.codegen.types import OffsetEntity
-from icon4py.icon4pygen.bindings.locations import BasicLocation, ChainedLocation
+from icon4pytools.icon4pygen.bindings.codegen.types import OffsetEntity
+from icon4pytools.icon4pygen.bindings.locations import BasicLocation, ChainedLocation
@dataclass(frozen=True)
@@ -77,9 +77,7 @@ def __init__(self, offsets: Sequence[OffsetEntity]):
def make_table_vars(self) -> list[str]:
if not self.has_offsets:
return []
- unique_offsets = sorted(
- {self._make_table_var(offset) for offset in self.offsets}
- )
+ unique_offsets = sorted({self._make_table_var(offset) for offset in self.offsets})
return list(unique_offsets)
def make_neighbor_tables(self) -> list[str]:
@@ -103,7 +101,4 @@ def _make_table_var(offset: OffsetEntity) -> str:
@staticmethod
def _make_location_type(offset: OffsetEntity) -> list[str]:
- return [
- f"LocationType::{loc.render_location_type()}"
- for loc in offset.target[1].chain
- ]
+ return [f"LocationType::{loc.render_location_type()}" for loc in offset.target[1].chain]
diff --git a/pyutils/src/icon4py/icon4pygen/bindings/codegen/type_conversion.py b/tools/src/icon4pytools/icon4pygen/bindings/codegen/type_conversion.py
similarity index 100%
rename from pyutils/src/icon4py/icon4pygen/bindings/codegen/type_conversion.py
rename to tools/src/icon4pytools/icon4pygen/bindings/codegen/type_conversion.py
diff --git a/pyutils/src/icon4py/icon4pygen/bindings/codegen/types.py b/tools/src/icon4pytools/icon4pygen/bindings/codegen/types.py
similarity index 96%
rename from pyutils/src/icon4py/icon4pygen/bindings/codegen/types.py
rename to tools/src/icon4pytools/icon4pygen/bindings/codegen/types.py
index 385467fb82..87ffad337c 100644
--- a/pyutils/src/icon4py/icon4pygen/bindings/codegen/types.py
+++ b/tools/src/icon4pytools/icon4pygen/bindings/codegen/types.py
@@ -17,7 +17,7 @@
from gt4py.next.type_system import type_specifications as ts
-from icon4py.icon4pygen.bindings.locations import (
+from icon4pytools.icon4pygen.bindings.locations import (
BasicLocation,
ChainedLocation,
CompoundLocation,
diff --git a/pyutils/src/icon4py/icon4pygen/bindings/entities.py b/tools/src/icon4pytools/icon4pygen/bindings/entities.py
similarity index 90%
rename from pyutils/src/icon4py/icon4pygen/bindings/entities.py
rename to tools/src/icon4pytools/icon4pygen/bindings/entities.py
index 99f6fa5e1d..a9297d9c5f 100644
--- a/pyutils/src/icon4py/icon4pygen/bindings/entities.py
+++ b/tools/src/icon4pytools/icon4pygen/bindings/entities.py
@@ -17,17 +17,11 @@
from gt4py.next.ffront import program_ast as past
from gt4py.next.type_system import type_specifications as ts
-from icon4py.icon4pygen.bindings.codegen.render.field import FieldRenderer
-from icon4py.icon4pygen.bindings.codegen.render.offset import OffsetRenderer
-from icon4py.icon4pygen.bindings.codegen.types import (
- FieldEntity,
- FieldIntent,
- OffsetEntity,
-)
-from icon4py.icon4pygen.bindings.exceptions import (
- BindingsTypeConsistencyException,
-)
-from icon4py.icon4pygen.bindings.locations import (
+from icon4pytools.icon4pygen.bindings.codegen.render.field import FieldRenderer
+from icon4pytools.icon4pygen.bindings.codegen.render.offset import OffsetRenderer
+from icon4pytools.icon4pygen.bindings.codegen.types import FieldEntity, FieldIntent, OffsetEntity
+from icon4pytools.icon4pygen.bindings.exceptions import BindingsTypeConsistencyException
+from icon4pytools.icon4pygen.bindings.locations import (
BASIC_LOCATIONS,
BasicLocation,
Cell,
@@ -36,8 +30,8 @@
Edge,
Vertex,
)
-from icon4py.icon4pygen.bindings.utils import calc_num_neighbors
-from icon4py.icon4pygen.metadata import FieldInfo
+from icon4pytools.icon4pygen.bindings.utils import calc_num_neighbors
+from icon4pytools.icon4pygen.metadata import FieldInfo
def chain_from_str(chain: list[str] | str) -> list[BasicLocation]:
@@ -77,9 +71,7 @@ def _handle_source(chain: str) -> Union[BasicLocation, CompoundLocation]:
if source in [str(loc()) for loc in BASIC_LOCATIONS.values()]:
return chain_from_str(source)[0]
- elif all(
- char in [str(loc()) for loc in BASIC_LOCATIONS.values()] for char in source
- ):
+ elif all(char in [str(loc()) for loc in BASIC_LOCATIONS.values()] for char in source):
return CompoundLocation(chain_from_str(source))
else:
raise BindingsTypeConsistencyException(f"Invalid source {source}")
@@ -165,9 +157,7 @@ def _update_horizontal_location(self, field: past.DataSymbol) -> None:
if not isinstance(field.type, ts.FieldType):
return
- maybe_horizontal_dimension = list(
- filter(lambda dim: dim.value != "K", field.type.dims)
- )
+ maybe_horizontal_dimension = list(filter(lambda dim: dim.value != "K", field.type.dims))
# early abort if field is vertical
if not len(maybe_horizontal_dimension):
diff --git a/pyutils/src/icon4py/icon4pygen/bindings/exceptions.py b/tools/src/icon4pytools/icon4pygen/bindings/exceptions.py
similarity index 100%
rename from pyutils/src/icon4py/icon4pygen/bindings/exceptions.py
rename to tools/src/icon4pytools/icon4pygen/bindings/exceptions.py
diff --git a/pyutils/src/icon4py/icon4pygen/bindings/locations.py b/tools/src/icon4pytools/icon4pygen/bindings/locations.py
similarity index 91%
rename from pyutils/src/icon4py/icon4pygen/bindings/locations.py
rename to tools/src/icon4pytools/icon4pygen/bindings/locations.py
index 8222a0c20c..4071da48b6 100644
--- a/pyutils/src/icon4py/icon4pygen/bindings/locations.py
+++ b/tools/src/icon4pytools/icon4pygen/bindings/locations.py
@@ -15,9 +15,9 @@
from typing import Iterator
from gt4py.next.ffront.fbuiltins import Dimension
-
from icon4py.common.dimension import CellDim, EdgeDim, VertexDim
-from icon4py.icon4pygen.bindings.codegen.render.location import LocationRenderer
+
+from icon4pytools.icon4pygen.bindings.codegen.render.location import LocationRenderer
class BasicLocation:
@@ -64,9 +64,7 @@ def __init__(self, chain: list[BasicLocation]) -> None:
if is_valid(chain):
self.chain = chain
else:
- raise Exception(
- f"chain {chain} contains two of the same elements in succession"
- )
+ raise Exception(f"chain {chain} contains two of the same elements in succession")
def __iter__(self) -> Iterator[BasicLocation]:
return iter(self.chain)
diff --git a/liskov/src/icon4py/liskov/py.typed b/tools/src/icon4pytools/icon4pygen/bindings/py.typed
similarity index 100%
rename from liskov/src/icon4py/liskov/py.typed
rename to tools/src/icon4pytools/icon4pygen/bindings/py.typed
diff --git a/pyutils/src/icon4py/icon4pygen/bindings/utils.py b/tools/src/icon4pytools/icon4pygen/bindings/utils.py
similarity index 96%
rename from pyutils/src/icon4py/icon4pygen/bindings/utils.py
rename to tools/src/icon4pytools/icon4pygen/bindings/utils.py
index 83d2770d1c..5d5cb72c1e 100644
--- a/pyutils/src/icon4py/icon4pygen/bindings/utils.py
+++ b/tools/src/icon4pytools/icon4pygen/bindings/utils.py
@@ -18,7 +18,7 @@
from gt4py.next.common import Dimension
-from icon4py.icon4pygen.icochainsize import IcoChainSize
+from icon4pytools.icon4pygen.icochainsize import IcoChainSize
PYTHON_PATH = sys.executable
diff --git a/pyutils/src/icon4py/icon4pygen/bindings/workflow.py b/tools/src/icon4pytools/icon4pygen/bindings/workflow.py
similarity index 81%
rename from pyutils/src/icon4py/icon4pygen/bindings/workflow.py
rename to tools/src/icon4pytools/icon4pygen/bindings/workflow.py
index ef7b88529d..83a5d1f6ee 100644
--- a/pyutils/src/icon4py/icon4pygen/bindings/workflow.py
+++ b/tools/src/icon4pytools/icon4pygen/bindings/workflow.py
@@ -13,12 +13,12 @@
from pathlib import Path
-from icon4py.icon4pygen.bindings.codegen.cpp import generate_cpp_definition
-from icon4py.icon4pygen.bindings.codegen.f90 import generate_f90_file
-from icon4py.icon4pygen.bindings.codegen.header import generate_cpp_header
-from icon4py.icon4pygen.bindings.entities import Field, Offset
-from icon4py.icon4pygen.bindings.utils import check_dir_exists
-from icon4py.icon4pygen.metadata import StencilInfo
+from icon4pytools.icon4pygen.bindings.codegen.cpp import generate_cpp_definition
+from icon4pytools.icon4pygen.bindings.codegen.f90 import generate_f90_file
+from icon4pytools.icon4pygen.bindings.codegen.header import generate_cpp_header
+from icon4pytools.icon4pygen.bindings.entities import Field, Offset
+from icon4pytools.icon4pygen.bindings.utils import check_dir_exists
+from icon4pytools.icon4pygen.metadata import StencilInfo
class PyBindGen:
@@ -34,9 +34,7 @@ class PyBindGen:
Furthermore, we also serialise data to .csv or .vtk files in case of verification failure.
"""
- def __init__(
- self, stencil_info: StencilInfo, levels_per_thread: int, block_size: int
- ) -> None:
+ def __init__(self, stencil_info: StencilInfo, levels_per_thread: int, block_size: int) -> None:
self.stencil_name = stencil_info.itir.id
self.fields, self.offsets = self._stencil_info_to_binding_type(stencil_info)
self.levels_per_thread = levels_per_thread
diff --git a/pyutils/src/icon4py/icon4pygen/cli.py b/tools/src/icon4pytools/icon4pygen/cli.py
similarity index 83%
rename from pyutils/src/icon4py/icon4pygen/cli.py
rename to tools/src/icon4pytools/icon4pygen/cli.py
index b27c529d31..66180adf44 100644
--- a/pyutils/src/icon4py/icon4pygen/cli.py
+++ b/tools/src/icon4pytools/icon4pygen/cli.py
@@ -22,9 +22,9 @@
class ModuleType(click.ParamType):
names = [
- "icon4py.atm_dyn_iconam.mo_nh_diffusion_stencil_",
- "icon4py.atm_dyn_iconam.mo_solve_nonhydro_stencil_",
- "icon4py.atm_dyn_iconam.mo_velocity_advection_stencil_",
+ "icon4pytools.atm_dyn_iconam.mo_nh_diffusion_stencil_",
+ "icon4pytools.atm_dyn_iconam.mo_solve_nonhydro_stencil_",
+ "icon4pytools.atm_dyn_iconam.mo_velocity_advection_stencil_",
]
def shell_complete(self, ctx, param, incomplete):
@@ -45,9 +45,7 @@ def shell_complete(self, ctx, param, incomplete):
@click.argument("fencil", type=ModuleType())
@click.argument("block_size", type=int, default=128)
@click.argument("levels_per_thread", type=int, default=4)
-@click.option(
- "--is_global", is_flag=True, type=bool, help="Whether this is a global run."
-)
+@click.option("--is_global", is_flag=True, type=bool, help="Whether this is a global run.")
@click.argument(
"outpath",
type=click.Path(dir_okay=True, resolve_path=True, path_type=pathlib.Path),
@@ -76,9 +74,9 @@ def main(
LEVELS_PER_THREAD: how many k-levels to process per thread.
OUTPATH: represents a path to the folder in which to write all generated code.
"""
- from icon4py.icon4pygen.backend import GTHeader
- from icon4py.icon4pygen.bindings.workflow import PyBindGen
- from icon4py.icon4pygen.metadata import get_stencil_info, import_definition
+ from icon4pytools.icon4pygen.backend import GTHeader
+ from icon4pytools.icon4pygen.bindings.workflow import PyBindGen
+ from icon4pytools.icon4pygen.metadata import get_stencil_info, import_definition
fencil_def = import_definition(fencil)
stencil_info = get_stencil_info(fencil_def, is_global)
diff --git a/pyutils/src/icon4py/icon4pygen/exceptions.py b/tools/src/icon4pytools/icon4pygen/exceptions.py
similarity index 100%
rename from pyutils/src/icon4py/icon4pygen/exceptions.py
rename to tools/src/icon4pytools/icon4pygen/exceptions.py
diff --git a/pyutils/src/icon4py/icon4pygen/icochainsize.py b/tools/src/icon4pytools/icon4pygen/icochainsize.py
similarity index 51%
rename from pyutils/src/icon4py/icon4pygen/icochainsize.py
rename to tools/src/icon4pytools/icon4pygen/icochainsize.py
index 8787c3cfe6..38f3b825ac 100644
--- a/pyutils/src/icon4py/icon4pygen/icochainsize.py
+++ b/tools/src/icon4pytools/icon4pygen/icochainsize.py
@@ -11,110 +11,109 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
+r"""
+We encode the grid as follows.
+
+ \|{-1, 1} \|{0, 1} \|
+ -*-------------------------*-------------------------*-
+ |\ {-1, 1, 0} |\ {0, 1, 0} |\
+ | \ | \ |
+ | \ | \ |
+ | \ {-1, 0, 1} | \ {0, 0, 1} |
+ | \ | \ |
+ | \ | \ |
+ | \ | \ |
+ | \ | \ |
+ | \ | \ |
+ | \ | \ |
+ | \{-1, 0, 1} | \{0, 0, 1} |
+ | \ | \ |
+ | \ | \ |
+ | \ | \ |
+ |{-1, 0, 2} \ |{0, 0, 2} \ |
+ | \ | \ |
+ | \ | \ |
+ | \ | \ |
+ | \ | \ |
+ | \ | \ |
+ | \ | \ |
+ | {-1, 0, 0} \ | {0, 0, 0} \ |
+ | \ | \ |
+ | \ | \ |
+ \|{-1, 0} \|{0, 0} \|
+ -*-------------------------*-------------------------*-
+ |\ {-1, 0, 0} |\ {0, 0, 0} |\
+ | \ | \ |
+ | \ | \ |
+ | \ {-1, -1, 1} | \ {0, -1, 1} |
+ | \ | \ |
+ | \ | \ |
+ | \ | \ |
+ | \ | \ |
+ | \ | \ |
+ | \ | \ |
+ | \{-1, -1, 1} | \{0, -1, 1} |
+ | \ | \ |
+ | \ | \ |
+ | \ | \ |
+ |{-1, -1, 2} \ |{0, -1, 2} \ |
+ | \ | \ |
+ | \ | \ |
+ | \ | \ |
+ | \ | \ |
+ | \ | \ |
+ | \ | \ |
+ | {-1, -1, 0} \ | {0, -1, 0} \ |
+ | \ | \ |
+ | \ | \ |
+ \|{-1, -1} \|{0, -1} \|
+ -*-------------------------*-------------------------*-
+ |\ {-1, -1, 0} |\ {0, -1, 0} |\
+
+
+ Which is described by this general pattern:
+
+ |\
+ | \
+ | \
+ | \ {x, y, 1}
+ | \
+ | \
+ | \
+ | \
+ | \
+ | \
+ | \{x, y, 1}
+ | \
+ | \
+ | \
+ |{x, y, 2} \
+ | \
+ | \
+ | \
+ | \
+ | \
+ | \
+ | {x, y, 0} \
+ | \
+ | \
+ |{x, y} \
+ *-------------------------
+ {x, y, 0}
+
+ Note: Each location type uses a separate _id-space_.
+ {x, y, 0} can both mean an edge or cell. It's up to the user to ensure
+ they know what location type is meant.
+ /
+"""
+
from dataclasses import dataclass
from typing import List, TypeAlias
from gt4py.next.common import Dimension
-
from icon4py.common.dimension import CellDim, EdgeDim, VertexDim
-#
-# We encode the grid as follows:
-#
-# \|{-1, 1} \|{0, 1} \|
-# -*-------------------------*-------------------------*-
-# |\ {-1, 1, 0} |\ {0, 1, 0} |\
-# | \ | \ |
-# | \ | \ |
-# | \ {-1, 0, 1} | \ {0, 0, 1} |
-# | \ | \ |
-# | \ | \ |
-# | \ | \ |
-# | \ | \ |
-# | \ | \ |
-# | \ | \ |
-# | \{-1, 0, 1} | \{0, 0, 1} |
-# | \ | \ |
-# | \ | \ |
-# | \ | \ |
-# |{-1, 0, 2} \ |{0, 0, 2} \ |
-# | \ | \ |
-# | \ | \ |
-# | \ | \ |
-# | \ | \ |
-# | \ | \ |
-# | \ | \ |
-# | {-1, 0, 0} \ | {0, 0, 0} \ |
-# | \ | \ |
-# | \ | \ |
-# \|{-1, 0} \|{0, 0} \|
-# -*-------------------------*-------------------------*-
-# |\ {-1, 0, 0} |\ {0, 0, 0} |\
-# | \ | \ |
-# | \ | \ |
-# | \ {-1, -1, 1} | \ {0, -1, 1} |
-# | \ | \ |
-# | \ | \ |
-# | \ | \ |
-# | \ | \ |
-# | \ | \ |
-# | \ | \ |
-# | \{-1, -1, 1} | \{0, -1, 1} |
-# | \ | \ |
-# | \ | \ |
-# | \ | \ |
-# |{-1, -1, 2} \ |{0, -1, 2} \ |
-# | \ | \ |
-# | \ | \ |
-# | \ | \ |
-# | \ | \ |
-# | \ | \ |
-# | \ | \ |
-# | {-1, -1, 0} \ | {0, -1, 0} \ |
-# | \ | \ |
-# | \ | \ |
-# \|{-1, -1} \|{0, -1} \|
-# -*-------------------------*-------------------------*-
-# |\ {-1, -1, 0} |\ {0, -1, 0} |\
-#
-#
-# Which is described by this general pattern:
-#
-# |\
-# | \
-# | \
-# | \ {x, y, 1}
-# | \
-# | \
-# | \
-# | \
-# | \
-# | \
-# | \{x, y, 1}
-# | \
-# | \
-# | \
-# |{x, y, 2} \
-# | \
-# | \
-# | \
-# | \
-# | \
-# | \
-# | {x, y, 0} \
-# | \
-# | \
-# |{x, y} \
-# *-------------------------
-# {x, y, 0}
-#
-# Note: Each location type uses a separate _id-space_.
-# {x, y, 0} can both mean an edge or cell. It's up to the user to ensure
-# they know what location type is meant.
-# /
-
-
@dataclass
class Connection:
start: Dimension
diff --git a/pyutils/src/icon4py/icon4pygen/metadata.py b/tools/src/icon4pytools/icon4pygen/metadata.py
similarity index 93%
rename from pyutils/src/icon4py/icon4pygen/metadata.py
rename to tools/src/icon4pytools/icon4pygen/metadata.py
index 01e8a0afd1..1f1b42e4cb 100644
--- a/pyutils/src/icon4py/icon4pygen/metadata.py
+++ b/tools/src/icon4pytools/icon4pygen/metadata.py
@@ -25,13 +25,13 @@
from gt4py.next.iterator import ir as itir
from gt4py.next.iterator.runtime import FendefDispatcher
from gt4py.next.type_system import type_specifications as ts
-
from icon4py.common.dimension import CellDim, EdgeDim, Koff, VertexDim
-from icon4py.icon4pygen.exceptions import (
+
+from icon4pytools.icon4pygen.exceptions import (
InvalidConnectivityException,
MultipleFieldOperatorException,
)
-from icon4py.icon4pygen.icochainsize import IcoChainSize
+from icon4pytools.icon4pygen.icochainsize import IcoChainSize
@dataclass(frozen=True)
@@ -142,9 +142,7 @@ def get_fvprog(fencil_def: Program | Any) -> Program:
return fvprog
-def provide_offset(
- offset: str, is_global: bool = False
-) -> DummyConnectivity | Dimension:
+def provide_offset(offset: str, is_global: bool = False) -> DummyConnectivity | Dimension:
if offset == Koff.value:
assert len(Koff.target) == 1
assert Koff.source == Koff.target[0]
@@ -166,9 +164,7 @@ def provide_neighbor_table(chain: str, is_global: bool) -> DummyConnectivity:
and pass the tokens after to the algorithm below
"""
# note: this seems really brittle. maybe agree on a keyword to indicate new sparse fields?
- new_sparse_field = any(
- len(token) > 1 for token in chain.split("2")
- ) and not chain.endswith("O")
+ new_sparse_field = any(len(token) > 1 for token in chain.split("2")) and not chain.endswith("O")
if new_sparse_field:
chain = chain.split("2")[1]
skip_values = False
@@ -199,13 +195,9 @@ def provide_neighbor_table(chain: str, is_global: bool) -> DummyConnectivity:
def scan_for_offsets(fvprog: Program) -> list[eve.concepts.SymbolRef]:
"""Scan PAST node for offsets and return a set of all offsets."""
- all_types = (
- fvprog.past_node.pre_walk_values().if_isinstance(past.Symbol).getattr("type")
- )
+ all_types = fvprog.past_node.pre_walk_values().if_isinstance(past.Symbol).getattr("type")
all_field_types = [
- symbol_type
- for symbol_type in all_types
- if isinstance(symbol_type, ts.FieldType)
+ symbol_type for symbol_type in all_types if isinstance(symbol_type, ts.FieldType)
]
all_dims = set(i for j in all_field_types for i in j.dims)
all_offset_labels = (
diff --git a/pyutils/src/icon4py/icon4pygen/bindings/py.typed b/tools/src/icon4pytools/icon4pygen/py.typed
similarity index 100%
rename from pyutils/src/icon4py/icon4pygen/bindings/py.typed
rename to tools/src/icon4pytools/icon4pygen/py.typed
diff --git a/pyutils/src/icon4py/icon4pygen/bindings/codegen/__init__.py b/tools/src/icon4pytools/liskov/__init__.py
similarity index 100%
rename from pyutils/src/icon4py/icon4pygen/bindings/codegen/__init__.py
rename to tools/src/icon4pytools/liskov/__init__.py
diff --git a/liskov/src/icon4py/liskov/cli.py b/tools/src/icon4pytools/liskov/cli.py
similarity index 86%
rename from liskov/src/icon4py/liskov/cli.py
rename to tools/src/icon4pytools/liskov/cli.py
index 6c0fa90b6e..a16e0a428e 100644
--- a/liskov/src/icon4py/liskov/cli.py
+++ b/tools/src/icon4pytools/liskov/cli.py
@@ -15,9 +15,9 @@
import click
-from icon4py.common.logger import setup_logger
-from icon4py.liskov.external.exceptions import MissingCommandError
-from icon4py.liskov.pipeline.collection import (
+from icon4pytools.common.logger import setup_logger
+from icon4pytools.liskov.external.exceptions import MissingCommandError
+from icon4pytools.liskov.pipeline.collection import (
load_gt4py_stencils,
parse_fortran_file,
run_code_generation,
@@ -52,9 +52,7 @@ def main(ctx):
)
@click.argument(
"input_path",
- type=click.Path(
- exists=True, dir_okay=False, resolve_path=True, path_type=pathlib.Path
- ),
+ type=click.Path(exists=True, dir_okay=False, resolve_path=True, path_type=pathlib.Path),
)
@click.argument(
"output_path",
@@ -84,9 +82,7 @@ def integrate(input_path, output_path, profile, metadatagen):
)
@click.argument(
"input_path",
- type=click.Path(
- exists=True, dir_okay=False, resolve_path=True, path_type=pathlib.Path
- ),
+ type=click.Path(exists=True, dir_okay=False, resolve_path=True, path_type=pathlib.Path),
)
@click.argument(
"output_path",
diff --git a/liskov/src/icon4py/liskov/codegen/__init__.py b/tools/src/icon4pytools/liskov/codegen/__init__.py
similarity index 90%
rename from liskov/src/icon4py/liskov/codegen/__init__.py
rename to tools/src/icon4pytools/liskov/codegen/__init__.py
index 8d0cdb4874..1aa7ef4063 100644
--- a/liskov/src/icon4py/liskov/codegen/__init__.py
+++ b/tools/src/icon4pytools/liskov/codegen/__init__.py
@@ -12,4 +12,4 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# required import for CheckForDirectiveClasses metaclass
-import icon4py.liskov.parsing.types as ts # noqa: F401
+import icon4pytools.liskov.parsing.types as ts # noqa: F401
diff --git a/pyutils/src/icon4py/icon4pygen/bindings/codegen/render/__init__.py b/tools/src/icon4pytools/liskov/codegen/integration/__init__.py
similarity index 100%
rename from pyutils/src/icon4py/icon4pygen/bindings/codegen/render/__init__.py
rename to tools/src/icon4pytools/liskov/codegen/integration/__init__.py
diff --git a/liskov/src/icon4py/liskov/codegen/integration/deserialise.py b/tools/src/icon4pytools/liskov/codegen/integration/deserialise.py
similarity index 86%
rename from liskov/src/icon4py/liskov/codegen/integration/deserialise.py
rename to tools/src/icon4pytools/liskov/codegen/integration/deserialise.py
index 46d09eaca8..8ca5120360 100644
--- a/liskov/src/icon4py/liskov/codegen/integration/deserialise.py
+++ b/tools/src/icon4pytools/liskov/codegen/integration/deserialise.py
@@ -13,10 +13,10 @@
from typing import Any, Optional, Protocol, Type
-import icon4py.liskov.parsing.parse
-import icon4py.liskov.parsing.types as ts
-from icon4py.common.logger import setup_logger
-from icon4py.liskov.codegen.integration.interface import (
+import icon4pytools.liskov.parsing.parse
+import icon4pytools.liskov.parsing.types as ts
+from icon4pytools.common.logger import setup_logger
+from icon4pytools.liskov.codegen.integration.interface import (
BoundsData,
DeclareData,
EndCreateData,
@@ -32,14 +32,14 @@
StartStencilData,
UnusedDirective,
)
-from icon4py.liskov.codegen.shared.deserialise import Deserialiser
-from icon4py.liskov.codegen.shared.types import CodeGenInput
-from icon4py.liskov.parsing.exceptions import (
+from icon4pytools.liskov.codegen.shared.deserialise import Deserialiser
+from icon4pytools.liskov.codegen.shared.types import CodeGenInput
+from icon4pytools.liskov.parsing.exceptions import (
DirectiveSyntaxError,
MissingBoundsError,
MissingDirectiveArgumentError,
)
-from icon4py.liskov.parsing.utils import (
+from icon4pytools.liskov.parsing.utils import (
extract_directive,
flatten_list_of_dicts,
string_to_bool,
@@ -115,27 +115,27 @@ def __call__(self, parsed: ts.ParsedDict) -> CodeGenInput:
class EndCreateDataFactory(RequiredSingleUseDataFactory):
- directive_cls: Type[ts.ParsedDirective] = icon4py.liskov.parsing.parse.EndCreate
+ directive_cls: Type[ts.ParsedDirective] = icon4pytools.liskov.parsing.parse.EndCreate
dtype: Type[EndCreateData] = EndCreateData
class ImportsDataFactory(RequiredSingleUseDataFactory):
- directive_cls: Type[ts.ParsedDirective] = icon4py.liskov.parsing.parse.Imports
+ directive_cls: Type[ts.ParsedDirective] = icon4pytools.liskov.parsing.parse.Imports
dtype: Type[ImportsData] = ImportsData
class EndIfDataFactory(OptionalMultiUseDataFactory):
- directive_cls: Type[ts.ParsedDirective] = icon4py.liskov.parsing.parse.EndIf
+ directive_cls: Type[ts.ParsedDirective] = icon4pytools.liskov.parsing.parse.EndIf
dtype: Type[EndIfData] = EndIfData
class EndProfileDataFactory(OptionalMultiUseDataFactory):
- directive_cls: Type[ts.ParsedDirective] = icon4py.liskov.parsing.parse.EndProfile
+ directive_cls: Type[ts.ParsedDirective] = icon4pytools.liskov.parsing.parse.EndProfile
dtype: Type[EndProfileData] = EndProfileData
class StartCreateDataFactory(DataFactoryBase):
- directive_cls: Type[ts.ParsedDirective] = icon4py.liskov.parsing.parse.StartCreate
+ directive_cls: Type[ts.ParsedDirective] = icon4pytools.liskov.parsing.parse.StartCreate
dtype: Type[StartCreateData] = StartCreateData
def __call__(self, parsed: ts.ParsedDict) -> StartCreateData:
@@ -151,7 +151,7 @@ def __call__(self, parsed: ts.ParsedDict) -> StartCreateData:
class DeclareDataFactory(DataFactoryBase):
- directive_cls: Type[ts.ParsedDirective] = icon4py.liskov.parsing.parse.Declare
+ directive_cls: Type[ts.ParsedDirective] = icon4pytools.liskov.parsing.parse.Declare
dtype: Type[DeclareData] = DeclareData
@staticmethod
@@ -163,9 +163,7 @@ def __call__(self, parsed: ts.ParsedDict) -> list[DeclareData]:
extracted = extract_directive(parsed["directives"], self.directive_cls)
for i, directive in enumerate(extracted):
named_args = parsed["content"]["Declare"][i]
- ident_type = pop_item_from_dict(
- named_args, "type", DEFAULT_DECLARE_IDENT_TYPE
- )
+ ident_type = pop_item_from_dict(named_args, "type", DEFAULT_DECLARE_IDENT_TYPE)
suffix = pop_item_from_dict(named_args, "suffix", DEFAULT_DECLARE_SUFFIX)
deserialised.append(
self.dtype(
@@ -179,7 +177,7 @@ def __call__(self, parsed: ts.ParsedDict) -> list[DeclareData]:
class StartProfileDataFactory(DataFactoryBase):
- directive_cls: Type[ts.ParsedDirective] = icon4py.liskov.parsing.parse.StartProfile
+ directive_cls: Type[ts.ParsedDirective] = icon4pytools.liskov.parsing.parse.StartProfile
dtype: Type[StartProfileData] = StartProfileData
def __call__(self, parsed: ts.ParsedDict) -> list[StartProfileData]:
@@ -188,14 +186,12 @@ def __call__(self, parsed: ts.ParsedDict) -> list[StartProfileData]:
for i, directive in enumerate(extracted):
named_args = parsed["content"]["StartProfile"][i]
stencil_name = _extract_stencil_name(named_args, directive)
- deserialised.append(
- self.dtype(name=stencil_name, startln=directive.startln)
- )
+ deserialised.append(self.dtype(name=stencil_name, startln=directive.startln))
return deserialised
class EndStencilDataFactory(DataFactoryBase):
- directive_cls: Type[ts.ParsedDirective] = icon4py.liskov.parsing.parse.EndStencil
+ directive_cls: Type[ts.ParsedDirective] = icon4pytools.liskov.parsing.parse.EndStencil
dtype: Type[EndStencilData] = EndStencilData
def __call__(self, parsed: ts.ParsedDict) -> list[EndStencilData]:
@@ -218,7 +214,7 @@ def __call__(self, parsed: ts.ParsedDict) -> list[EndStencilData]:
class StartStencilDataFactory(DataFactoryBase):
- directive_cls: Type[ts.ParsedDirective] = icon4py.liskov.parsing.parse.StartStencil
+ directive_cls: Type[ts.ParsedDirective] = icon4pytools.liskov.parsing.parse.StartStencil
dtype: Type[StartStencilData] = StartStencilData
def __call__(self, parsed: ts.ParsedDict) -> list[StartStencilData]:
@@ -232,20 +228,13 @@ def __call__(self, parsed: ts.ParsedDict) -> list[StartStencilData]:
"""
deserialised = []
field_dimensions = flatten_list_of_dicts(
- [
- DeclareDataFactory.get_field_dimensions(dim)
- for dim in parsed["content"]["Declare"]
- ]
+ [DeclareDataFactory.get_field_dimensions(dim) for dim in parsed["content"]["Declare"]]
)
directives = extract_directive(parsed["directives"], self.directive_cls)
for i, directive in enumerate(directives):
named_args = parsed["content"]["StartStencil"][i]
- acc_present = string_to_bool(
- pop_item_from_dict(named_args, "accpresent", "true")
- )
- mergecopy = string_to_bool(
- pop_item_from_dict(named_args, "mergecopy", "false")
- )
+ acc_present = string_to_bool(pop_item_from_dict(named_args, "accpresent", "true"))
+ mergecopy = string_to_bool(pop_item_from_dict(named_args, "mergecopy", "false"))
copies = string_to_bool(pop_item_from_dict(named_args, "copies", "true"))
stencil_name = _extract_stencil_name(named_args, directive)
bounds = self._make_bounds(named_args)
@@ -353,7 +342,7 @@ def _update_tolerances(
class InsertDataFactory(DataFactoryBase):
- directive_cls: Type[ts.ParsedDirective] = icon4py.liskov.parsing.parse.Insert
+ directive_cls: Type[ts.ParsedDirective] = icon4pytools.liskov.parsing.parse.Insert
dtype: Type[InsertData] = InsertData
def __call__(self, parsed: ts.ParsedDict) -> list[InsertData]:
diff --git a/liskov/src/icon4py/liskov/codegen/integration/exceptions.py b/tools/src/icon4pytools/liskov/codegen/integration/exceptions.py
similarity index 100%
rename from liskov/src/icon4py/liskov/codegen/integration/exceptions.py
rename to tools/src/icon4pytools/liskov/codegen/integration/exceptions.py
diff --git a/liskov/src/icon4py/liskov/codegen/integration/generate.py b/tools/src/icon4pytools/liskov/codegen/integration/generate.py
similarity index 94%
rename from liskov/src/icon4py/liskov/codegen/integration/generate.py
rename to tools/src/icon4pytools/liskov/codegen/integration/generate.py
index cc8af30138..966d7e1b49 100644
--- a/liskov/src/icon4py/liskov/codegen/integration/generate.py
+++ b/tools/src/icon4pytools/liskov/codegen/integration/generate.py
@@ -13,13 +13,13 @@
from typing import Any
-from icon4py.common.logger import setup_logger
-from icon4py.liskov.codegen.integration.interface import (
+from icon4pytools.common.logger import setup_logger
+from icon4pytools.liskov.codegen.integration.interface import (
IntegrationCodeInterface,
StartStencilData,
UnusedDirective,
)
-from icon4py.liskov.codegen.integration.template import (
+from icon4pytools.liskov.codegen.integration.template import (
DeclareStatement,
DeclareStatementGenerator,
EndCreateStatement,
@@ -43,9 +43,9 @@
StartStencilStatement,
StartStencilStatementGenerator,
)
-from icon4py.liskov.codegen.shared.generate import CodeGenerator
-from icon4py.liskov.codegen.shared.types import GeneratedCode
-from icon4py.liskov.external.metadata import CodeMetadata
+from icon4pytools.liskov.codegen.shared.generate import CodeGenerator
+from icon4pytools.liskov.codegen.shared.types import GeneratedCode
+from icon4pytools.liskov.external.metadata import CodeMetadata
logger = setup_logger(__name__)
@@ -217,7 +217,9 @@ def _generate_profile(self) -> None:
for end in self.interface.EndProfile: # type: ignore
logger.info("Generating nvtx end statement.")
self._generate(
- EndProfileStatement, EndProfileStatementGenerator, end.startln
+ EndProfileStatement,
+ EndProfileStatementGenerator,
+ end.startln,
)
def _generate_insert(self) -> None:
diff --git a/liskov/src/icon4py/liskov/codegen/integration/interface.py b/tools/src/icon4pytools/liskov/codegen/integration/interface.py
similarity index 97%
rename from liskov/src/icon4py/liskov/codegen/integration/interface.py
rename to tools/src/icon4pytools/liskov/codegen/integration/interface.py
index e7fa5385e1..30ffb405b6 100644
--- a/liskov/src/icon4py/liskov/codegen/integration/interface.py
+++ b/tools/src/icon4pytools/liskov/codegen/integration/interface.py
@@ -14,7 +14,7 @@
from dataclasses import dataclass
from typing import Optional, Sequence
-from icon4py.liskov.codegen.shared.types import CodeGenInput
+from icon4pytools.liskov.codegen.shared.types import CodeGenInput
class UnusedDirective:
diff --git a/liskov/src/icon4py/liskov/codegen/integration/template.py b/tools/src/icon4pytools/liskov/codegen/integration/template.py
similarity index 96%
rename from liskov/src/icon4py/liskov/codegen/integration/template.py
rename to tools/src/icon4pytools/liskov/codegen/integration/template.py
index 65c0785a0a..cfedc141d9 100644
--- a/liskov/src/icon4py/liskov/codegen/integration/template.py
+++ b/tools/src/icon4pytools/liskov/codegen/integration/template.py
@@ -19,12 +19,9 @@
from gt4py.eve.codegen import JinjaTemplate as as_jinja
from gt4py.eve.codegen import TemplatedGenerator
-from icon4py.liskov.codegen.integration.exceptions import UndeclaredFieldError
-from icon4py.liskov.codegen.integration.interface import (
- DeclareData,
- StartStencilData,
-)
-from icon4py.liskov.external.metadata import CodeMetadata
+from icon4pytools.liskov.codegen.integration.exceptions import UndeclaredFieldError
+from icon4pytools.liskov.codegen.integration.interface import DeclareData, StartStencilData
+from icon4pytools.liskov.external.metadata import CodeMetadata
def enclose_in_parentheses(string: str) -> str:
@@ -236,9 +233,7 @@ class StartStencilStatement(eve.Node):
def __post_init__(self) -> None: # type: ignore
all_fields = [Field(**asdict(f)) for f in self.stencil_data.fields]
- self.copy_declarations = [
- self.make_copy_declaration(f) for f in all_fields if f.out
- ]
+ self.copy_declarations = [self.make_copy_declaration(f) for f in all_fields if f.out]
self.acc_present = "PRESENT" if self.stencil_data.acc_present else "NONE"
@staticmethod
diff --git a/testutils/src/icon4py/testutils/__init__.py b/tools/src/icon4pytools/liskov/codegen/serialisation/__init__.py
similarity index 100%
rename from testutils/src/icon4py/testutils/__init__.py
rename to tools/src/icon4pytools/liskov/codegen/serialisation/__init__.py
diff --git a/liskov/src/icon4py/liskov/codegen/serialisation/deserialise.py b/tools/src/icon4pytools/liskov/codegen/serialisation/deserialise.py
similarity index 90%
rename from liskov/src/icon4py/liskov/codegen/serialisation/deserialise.py
rename to tools/src/icon4pytools/liskov/codegen/serialisation/deserialise.py
index f477747260..9db5533201 100644
--- a/liskov/src/icon4py/liskov/codegen/serialisation/deserialise.py
+++ b/tools/src/icon4pytools/liskov/codegen/serialisation/deserialise.py
@@ -12,16 +12,16 @@
# SPDX-License-Identifier: GPL-3.0-or-later
import uuid
-import icon4py.liskov.parsing.parse
-import icon4py.liskov.parsing.types as ts
-from icon4py.common.logger import setup_logger
-from icon4py.liskov.codegen.integration.deserialise import (
+import icon4pytools.liskov.parsing.parse
+import icon4pytools.liskov.parsing.types as ts
+from icon4pytools.common.logger import setup_logger
+from icon4pytools.liskov.codegen.integration.deserialise import (
TOLERANCE_ARGS,
DeclareDataFactory,
_extract_stencil_name,
pop_item_from_dict,
)
-from icon4py.liskov.codegen.serialisation.interface import (
+from icon4pytools.liskov.codegen.serialisation.interface import (
FieldSerialisationData,
ImportData,
InitData,
@@ -29,8 +29,8 @@
SavepointData,
SerialisationCodeInterface,
)
-from icon4py.liskov.codegen.shared.deserialise import Deserialiser
-from icon4py.liskov.parsing.utils import extract_directive
+from icon4pytools.liskov.codegen.shared.deserialise import Deserialiser
+from icon4pytools.liskov.parsing.utils import extract_directive
logger = setup_logger(__name__)
@@ -62,10 +62,10 @@ class SavepointDataFactory:
def __call__(self, parsed: ts.ParsedDict) -> list[SavepointData]:
"""Create a list of Start and End Savepoints for each Start and End Stencil directive."""
start_stencil = extract_directive(
- parsed["directives"], icon4py.liskov.parsing.parse.StartStencil
+ parsed["directives"], icon4pytools.liskov.parsing.parse.StartStencil
)
end_stencil = extract_directive(
- parsed["directives"], icon4py.liskov.parsing.parse.EndStencil
+ parsed["directives"], icon4pytools.liskov.parsing.parse.EndStencil
)
gpu_fields = self.get_gpu_fields(parsed)
@@ -178,9 +178,7 @@ def _get_timestep_variables(stencil_name: str) -> dict:
if "mo_icon_interpolation_scalar" in stencil_name:
timestep_variables["jstep"] = "jstep_ptr"
- timestep_variables[
- "mo_icon_interpolation_ctr"
- ] = "mo_icon_interpolation_ctr"
+ timestep_variables["mo_icon_interpolation_ctr"] = "mo_icon_interpolation_ctr"
if "mo_advection_traj" in stencil_name:
timestep_variables["jstep"] = "jstep_ptr"
@@ -211,7 +209,7 @@ class ImportDataFactory:
def __call__(self, parsed: ts.ParsedDict) -> ImportData:
imports = extract_directive(
- parsed["directives"], icon4py.liskov.parsing.parse.Imports
+ parsed["directives"], icon4pytools.liskov.parsing.parse.Imports
)[0]
return self.dtype(startln=imports.startln)
diff --git a/liskov/src/icon4py/liskov/codegen/serialisation/generate.py b/tools/src/icon4pytools/liskov/codegen/serialisation/generate.py
similarity index 86%
rename from liskov/src/icon4py/liskov/codegen/serialisation/generate.py
rename to tools/src/icon4pytools/liskov/codegen/serialisation/generate.py
index 7fda920d2c..fed5b8f735 100644
--- a/liskov/src/icon4py/liskov/codegen/serialisation/generate.py
+++ b/tools/src/icon4pytools/liskov/codegen/serialisation/generate.py
@@ -12,18 +12,16 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from typing import Any
-from icon4py.common.logger import setup_logger
-from icon4py.liskov.codegen.serialisation.interface import (
- SerialisationCodeInterface,
-)
-from icon4py.liskov.codegen.serialisation.template import (
+from icon4pytools.common.logger import setup_logger
+from icon4pytools.liskov.codegen.serialisation.interface import SerialisationCodeInterface
+from icon4pytools.liskov.codegen.serialisation.template import (
ImportStatement,
ImportStatementGenerator,
SavepointStatement,
SavepointStatementGenerator,
)
-from icon4py.liskov.codegen.shared.generate import CodeGenerator
-from icon4py.liskov.codegen.shared.types import GeneratedCode
+from icon4pytools.liskov.codegen.shared.generate import CodeGenerator
+from icon4pytools.liskov.codegen.shared.types import GeneratedCode
logger = setup_logger(__name__)
diff --git a/liskov/src/icon4py/liskov/codegen/serialisation/interface.py b/tools/src/icon4pytools/liskov/codegen/serialisation/interface.py
similarity index 95%
rename from liskov/src/icon4py/liskov/codegen/serialisation/interface.py
rename to tools/src/icon4pytools/liskov/codegen/serialisation/interface.py
index 301a4d2366..45f4c7271c 100644
--- a/liskov/src/icon4py/liskov/codegen/serialisation/interface.py
+++ b/tools/src/icon4pytools/liskov/codegen/serialisation/interface.py
@@ -14,7 +14,7 @@
from dataclasses import dataclass
from typing import Optional
-from icon4py.liskov.codegen.shared.types import CodeGenInput
+from icon4pytools.liskov.codegen.shared.types import CodeGenInput
@dataclass
diff --git a/liskov/src/icon4py/liskov/codegen/serialisation/template.py b/tools/src/icon4pytools/liskov/codegen/serialisation/template.py
similarity index 94%
rename from liskov/src/icon4py/liskov/codegen/serialisation/template.py
rename to tools/src/icon4pytools/liskov/codegen/serialisation/template.py
index 120e73bed2..8c9f8d5325 100644
--- a/liskov/src/icon4py/liskov/codegen/serialisation/template.py
+++ b/tools/src/icon4pytools/liskov/codegen/serialisation/template.py
@@ -17,7 +17,7 @@
from gt4py.eve.codegen import JinjaTemplate as as_jinja
from gt4py.eve.codegen import TemplatedGenerator
-from icon4py.liskov.codegen.serialisation.interface import InitData, SavepointData
+from icon4pytools.liskov.codegen.serialisation.interface import InitData, SavepointData
class Field(eve.Node):
@@ -49,15 +49,11 @@ class SavepointStatement(eve.Node):
multinode: bool
standard_fields: StandardFields = eve.datamodels.field(init=False)
decomposed_fields: DecomposedFields = eve.datamodels.field(init=False)
- decomposed_field_declarations: DecomposedFieldDeclarations = eve.datamodels.field(
- init=False
- )
+ decomposed_field_declarations: DecomposedFieldDeclarations = eve.datamodels.field(init=False)
def __post_init__(self):
self.standard_fields = StandardFields(
- fields=[
- Field(**asdict(f)) for f in self.savepoint.fields if not f.decomposed
- ]
+ fields=[Field(**asdict(f)) for f in self.savepoint.fields if not f.decomposed]
)
self.decomposed_fields = DecomposedFields(
fields=[Field(**asdict(f)) for f in self.savepoint.fields if f.decomposed]
diff --git a/liskov/setup.py b/tools/src/icon4pytools/liskov/codegen/shared/__init__.py
similarity index 88%
rename from liskov/setup.py
rename to tools/src/icon4pytools/liskov/codegen/shared/__init__.py
index 9c9f7b81c8..15dfdb0098 100644
--- a/liskov/setup.py
+++ b/tools/src/icon4pytools/liskov/codegen/shared/__init__.py
@@ -10,9 +10,3 @@
# distribution for a copy of the license or check .
#
# SPDX-License-Identifier: GPL-3.0-or-later
-
-from setuptools import setup
-
-
-if __name__ == "__main__":
- setup()
diff --git a/liskov/src/icon4py/liskov/codegen/shared/deserialise.py b/tools/src/icon4pytools/liskov/codegen/shared/deserialise.py
similarity index 83%
rename from liskov/src/icon4py/liskov/codegen/shared/deserialise.py
rename to tools/src/icon4pytools/liskov/codegen/shared/deserialise.py
index 6cb02811ab..e71ef9fe3f 100644
--- a/liskov/src/icon4py/liskov/codegen/shared/deserialise.py
+++ b/tools/src/icon4pytools/liskov/codegen/shared/deserialise.py
@@ -13,13 +13,11 @@
from typing import Callable
-import icon4py.liskov.parsing.types as ts
-from icon4py.common.logger import setup_logger
-from icon4py.liskov.codegen.integration.interface import IntegrationCodeInterface
-from icon4py.liskov.codegen.serialisation.interface import (
- SerialisationCodeInterface,
-)
-from icon4py.liskov.pipeline.definition import Step
+import icon4pytools.liskov.parsing.types as ts
+from icon4pytools.common.logger import setup_logger
+from icon4pytools.liskov.codegen.integration.interface import IntegrationCodeInterface
+from icon4pytools.liskov.codegen.serialisation.interface import SerialisationCodeInterface
+from icon4pytools.liskov.pipeline.definition import Step
logger = setup_logger(__name__)
diff --git a/liskov/src/icon4py/liskov/codegen/shared/generate.py b/tools/src/icon4pytools/liskov/codegen/shared/generate.py
similarity index 93%
rename from liskov/src/icon4py/liskov/codegen/shared/generate.py
rename to tools/src/icon4pytools/liskov/codegen/shared/generate.py
index 47931e3af4..9b6f14d3d8 100644
--- a/liskov/src/icon4py/liskov/codegen/shared/generate.py
+++ b/tools/src/icon4pytools/liskov/codegen/shared/generate.py
@@ -17,9 +17,9 @@
import gt4py.eve as eve
from gt4py.eve.codegen import TemplatedGenerator
-from icon4py.icon4pygen.bindings.utils import format_fortran_code
-from icon4py.liskov.codegen.shared.types import CodeGenInput, GeneratedCode
-from icon4py.liskov.pipeline.definition import Step
+from icon4pytools.icon4pygen.bindings.utils import format_fortran_code
+from icon4pytools.liskov.codegen.shared.types import CodeGenInput, GeneratedCode
+from icon4pytools.liskov.pipeline.definition import Step
class CodeGenerator(Step):
diff --git a/liskov/src/icon4py/liskov/codegen/shared/types.py b/tools/src/icon4pytools/liskov/codegen/shared/types.py
similarity index 100%
rename from liskov/src/icon4py/liskov/codegen/shared/types.py
rename to tools/src/icon4pytools/liskov/codegen/shared/types.py
diff --git a/liskov/src/icon4py/liskov/codegen/shared/write.py b/tools/src/icon4pytools/liskov/codegen/shared/write.py
similarity index 94%
rename from liskov/src/icon4py/liskov/codegen/shared/write.py
rename to tools/src/icon4pytools/liskov/codegen/shared/write.py
index 588d90e6d3..a4ab1d7d0c 100644
--- a/liskov/src/icon4py/liskov/codegen/shared/write.py
+++ b/tools/src/icon4pytools/liskov/codegen/shared/write.py
@@ -13,10 +13,10 @@
from pathlib import Path
from typing import List
-from icon4py.common.logger import setup_logger
-from icon4py.liskov.codegen.shared.types import GeneratedCode
-from icon4py.liskov.parsing.types import DIRECTIVE_IDENT
-from icon4py.liskov.pipeline.definition import Step
+from icon4pytools.common.logger import setup_logger
+from icon4pytools.liskov.codegen.shared.types import GeneratedCode
+from icon4pytools.liskov.parsing.types import DIRECTIVE_IDENT
+from icon4pytools.liskov.pipeline.definition import Step
logger = setup_logger(__name__)
diff --git a/testutils/setup.py b/tools/src/icon4pytools/liskov/external/__init__.py
similarity index 88%
rename from testutils/setup.py
rename to tools/src/icon4pytools/liskov/external/__init__.py
index 9c9f7b81c8..15dfdb0098 100644
--- a/testutils/setup.py
+++ b/tools/src/icon4pytools/liskov/external/__init__.py
@@ -10,9 +10,3 @@
# distribution for a copy of the license or check .
#
# SPDX-License-Identifier: GPL-3.0-or-later
-
-from setuptools import setup
-
-
-if __name__ == "__main__":
- setup()
diff --git a/liskov/src/icon4py/liskov/external/exceptions.py b/tools/src/icon4pytools/liskov/external/exceptions.py
similarity index 100%
rename from liskov/src/icon4py/liskov/external/exceptions.py
rename to tools/src/icon4pytools/liskov/external/exceptions.py
diff --git a/liskov/src/icon4py/liskov/external/gt4py.py b/tools/src/icon4pytools/liskov/external/gt4py.py
similarity index 83%
rename from liskov/src/icon4py/liskov/external/gt4py.py
rename to tools/src/icon4pytools/liskov/external/gt4py.py
index d02397b1db..4ad14ef9d3 100644
--- a/liskov/src/icon4py/liskov/external/gt4py.py
+++ b/tools/src/icon4pytools/liskov/external/gt4py.py
@@ -17,14 +17,11 @@
from gt4py.next.ffront.decorator import Program
-from icon4py.common.logger import setup_logger
-from icon4py.icon4pygen.metadata import get_stencil_info
-from icon4py.liskov.codegen.integration.interface import IntegrationCodeInterface
-from icon4py.liskov.external.exceptions import (
- IncompatibleFieldError,
- UnknownStencilError,
-)
-from icon4py.liskov.pipeline.definition import Step
+from icon4pytools.common.logger import setup_logger
+from icon4pytools.icon4pygen.metadata import get_stencil_info
+from icon4pytools.liskov.codegen.integration.interface import IntegrationCodeInterface
+from icon4pytools.liskov.external.exceptions import IncompatibleFieldError, UnknownStencilError
+from icon4pytools.liskov.pipeline.definition import Step
logger = setup_logger(__name__)
@@ -48,7 +45,7 @@ def __call__(self, data: Any = None) -> IntegrationCodeInterface:
field_info = gt4py_fields[f.variable]
except KeyError:
raise IncompatibleFieldError(
- f"Used field variable name that is incompatible with the expected field names defined in {s.name} in icon4py."
+ f"Used field variable name that is incompatible with the expected field names defined in {s.name} in icon4pytools."
)
f.out = field_info.out
f.inp = field_info.inp
@@ -65,16 +62,14 @@ def _collect_icon4py_stencil(self, stencil_name: str) -> Program:
err_counter += 1
if err_counter == len(self._STENCIL_PACKAGES):
- raise UnknownStencilError(
- f"Did not find module: {stencil_name} in icon4py."
- )
+ raise UnknownStencilError(f"Did not find module: {stencil_name} in icon4pytools.")
module_members = getmembers(module)
found_stencil = [elt for elt in module_members if elt[0] == stencil_name]
if len(found_stencil) == 0:
raise UnknownStencilError(
- f"Did not find module member: {stencil_name} in module: {module.__name__} in icon4py."
+ f"Did not find module member: {stencil_name} in module: {module.__name__} in icon4pytools."
)
return found_stencil[0][1]
diff --git a/liskov/src/icon4py/liskov/external/metadata.py b/tools/src/icon4pytools/liskov/external/metadata.py
similarity index 90%
rename from liskov/src/icon4py/liskov/external/metadata.py
rename to tools/src/icon4pytools/liskov/external/metadata.py
index 756d92dcea..b9d6728fdf 100644
--- a/liskov/src/icon4py/liskov/external/metadata.py
+++ b/tools/src/icon4pytools/liskov/external/metadata.py
@@ -15,8 +15,8 @@
import click
-import icon4py.liskov
-from icon4py.liskov.external.exceptions import MissingClickContextError
+from icon4pytools import __version__
+from icon4pytools.liskov.external.exceptions import MissingClickContextError
class CodeMetadata:
@@ -41,4 +41,4 @@ def cli_params(self) -> dict[str, Any]:
@property
def version(self) -> str:
"""Get the current version."""
- return icon4py.liskov.__version__
+ return __version__
diff --git a/pyutils/setup.py b/tools/src/icon4pytools/liskov/parsing/__init__.py
similarity index 88%
rename from pyutils/setup.py
rename to tools/src/icon4pytools/liskov/parsing/__init__.py
index 9c9f7b81c8..15dfdb0098 100644
--- a/pyutils/setup.py
+++ b/tools/src/icon4pytools/liskov/parsing/__init__.py
@@ -10,9 +10,3 @@
# distribution for a copy of the license or check .
#
# SPDX-License-Identifier: GPL-3.0-or-later
-
-from setuptools import setup
-
-
-if __name__ == "__main__":
- setup()
diff --git a/liskov/src/icon4py/liskov/parsing/exceptions.py b/tools/src/icon4pytools/liskov/parsing/exceptions.py
similarity index 100%
rename from liskov/src/icon4py/liskov/parsing/exceptions.py
rename to tools/src/icon4pytools/liskov/parsing/exceptions.py
diff --git a/liskov/src/icon4py/liskov/parsing/parse.py b/tools/src/icon4pytools/liskov/parsing/parse.py
similarity index 92%
rename from liskov/src/icon4py/liskov/parsing/parse.py
rename to tools/src/icon4pytools/liskov/parsing/parse.py
index 3543fb7c37..02759621a5 100644
--- a/liskov/src/icon4py/liskov/parsing/parse.py
+++ b/tools/src/icon4pytools/liskov/parsing/parse.py
@@ -17,12 +17,12 @@
from pathlib import Path
from typing import Optional, Sequence, Type
-import icon4py.liskov.parsing.types as ts
-from icon4py.common.logger import setup_logger
-from icon4py.liskov.parsing.exceptions import UnsupportedDirectiveError
-from icon4py.liskov.parsing.types import ParsedDirective, RawDirective
-from icon4py.liskov.parsing.validation import VALIDATORS
-from icon4py.liskov.pipeline.definition import Step
+import icon4pytools.liskov.parsing.types as ts
+from icon4pytools.common.logger import setup_logger
+from icon4pytools.liskov.parsing.exceptions import UnsupportedDirectiveError
+from icon4pytools.liskov.parsing.types import ParsedDirective, RawDirective
+from icon4pytools.liskov.parsing.validation import VALIDATORS
+from icon4pytools.liskov.pipeline.definition import Step
REPLACE_CHARS = [ts.DIRECTIVE_IDENT, "&", "\n"]
@@ -81,18 +81,14 @@ def _determine_type(
)
return typed
- def _preprocess(
- self, directives: Sequence[ts.ParsedDirective]
- ) -> Sequence[ts.ParsedDirective]:
+ def _preprocess(self, directives: Sequence[ts.ParsedDirective]) -> Sequence[ts.ParsedDirective]:
"""Preprocess the directives by removing unnecessary characters and formatting the directive strings."""
return [
d.__class__(self._clean_string(d.string), d.startln, d.endln) # type: ignore
for d in directives
]
- def _run_validation_passes(
- self, preprocessed: Sequence[ts.ParsedDirective]
- ) -> None:
+ def _run_validation_passes(self, preprocessed: Sequence[ts.ParsedDirective]) -> None:
"""Run validation passes on the directives."""
for validator in VALIDATORS:
validator(self.input_filepath).validate(preprocessed)
diff --git a/liskov/src/icon4py/liskov/parsing/scan.py b/tools/src/icon4pytools/liskov/parsing/scan.py
similarity index 94%
rename from liskov/src/icon4py/liskov/parsing/scan.py
rename to tools/src/icon4pytools/liskov/parsing/scan.py
index f13c1611aa..0fb9879749 100644
--- a/liskov/src/icon4py/liskov/parsing/scan.py
+++ b/tools/src/icon4pytools/liskov/parsing/scan.py
@@ -14,10 +14,10 @@
from pathlib import Path
from typing import Any
-import icon4py.liskov.parsing.types as ts
-from icon4py.common.logger import setup_logger
-from icon4py.liskov.parsing.exceptions import DirectiveSyntaxError
-from icon4py.liskov.pipeline.definition import Step
+import icon4pytools.liskov.parsing.types as ts
+from icon4pytools.common.logger import setup_logger
+from icon4pytools.liskov.parsing.exceptions import DirectiveSyntaxError
+from icon4pytools.liskov.pipeline.definition import Step
logger = setup_logger(__name__)
diff --git a/liskov/src/icon4py/liskov/parsing/types.py b/tools/src/icon4pytools/liskov/parsing/types.py
similarity index 90%
rename from liskov/src/icon4py/liskov/parsing/types.py
rename to tools/src/icon4pytools/liskov/parsing/types.py
index f24028ec01..0c69f5475c 100644
--- a/liskov/src/icon4py/liskov/parsing/types.py
+++ b/tools/src/icon4pytools/liskov/parsing/types.py
@@ -11,14 +11,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
from dataclasses import dataclass
-from typing import (
- Any,
- Protocol,
- Sequence,
- TypeAlias,
- TypedDict,
- runtime_checkable,
-)
+from typing import Any, Protocol, Sequence, TypeAlias, TypedDict, runtime_checkable
DIRECTIVE_IDENT = "!$DSL"
diff --git a/liskov/src/icon4py/liskov/parsing/utils.py b/tools/src/icon4pytools/liskov/parsing/utils.py
similarity index 97%
rename from liskov/src/icon4py/liskov/parsing/utils.py
rename to tools/src/icon4pytools/liskov/parsing/utils.py
index 35d4a1a4ed..31e74debdd 100644
--- a/liskov/src/icon4py/liskov/parsing/utils.py
+++ b/tools/src/icon4pytools/liskov/parsing/utils.py
@@ -12,7 +12,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from typing import Sequence, Type
-from icon4py.liskov.parsing import types as ts
+from icon4pytools.liskov.parsing import types as ts
def flatten_list_of_dicts(list_of_dicts: list[dict]) -> dict:
diff --git a/liskov/src/icon4py/liskov/parsing/validation.py b/tools/src/icon4pytools/liskov/parsing/validation.py
similarity index 76%
rename from liskov/src/icon4py/liskov/parsing/validation.py
rename to tools/src/icon4pytools/liskov/parsing/validation.py
index 70e4e4cde8..d2496a2344 100644
--- a/liskov/src/icon4py/liskov/parsing/validation.py
+++ b/tools/src/icon4pytools/liskov/parsing/validation.py
@@ -16,19 +16,16 @@
from pathlib import Path
from typing import Match, Optional, Protocol
-import icon4py.liskov.parsing.parse
-import icon4py.liskov.parsing.types as ts
-from icon4py.common.logger import setup_logger
-from icon4py.liskov.parsing.exceptions import (
+import icon4pytools.liskov.parsing.parse
+import icon4pytools.liskov.parsing.types as ts
+from icon4pytools.common.logger import setup_logger
+from icon4pytools.liskov.parsing.exceptions import (
DirectiveSyntaxError,
RepeatedDirectiveError,
RequiredDirectivesError,
UnbalancedStencilDirectiveError,
)
-from icon4py.liskov.parsing.utils import (
- print_parsed_directive,
- remove_directive_types,
-)
+from icon4pytools.liskov.parsing.utils import print_parsed_directive, remove_directive_types
logger = setup_logger(__name__)
@@ -68,16 +65,12 @@ def validate(self, directives: list[ts.ParsedDirective]) -> None:
self._validate_outer(d.string, d.pattern, d)
self._validate_inner(d.string, d.pattern, d)
- def _validate_outer(
- self, to_validate: str, pattern: str, d: ts.ParsedDirective
- ) -> None:
+ def _validate_outer(self, to_validate: str, pattern: str, d: ts.ParsedDirective) -> None:
regex = f"{pattern}\\((.*)\\)"
match = re.fullmatch(regex, to_validate)
self.exception_handler.check_for_matches(d, match, regex, self.filepath)
- def _validate_inner(
- self, to_validate: str, pattern: str, d: ts.ParsedDirective
- ) -> None:
+ def _validate_inner(self, to_validate: str, pattern: str, d: ts.ParsedDirective) -> None:
inner = to_validate.replace(f"{pattern}", "")[1:-1].split(";")
for arg in inner:
match = re.fullmatch(d.regex, arg)
@@ -108,9 +101,7 @@ def validate(self, directives: list[ts.ParsedDirective]) -> None:
self._validate_required_directives(directives)
self._validate_stencil_directives(directives)
- def _validate_directive_uniqueness(
- self, directives: list[ts.ParsedDirective]
- ) -> None:
+ def _validate_directive_uniqueness(self, directives: list[ts.ParsedDirective]) -> None:
"""Check that all used directives are unique.
Note: Allow repeated START STENCIL, END STENCIL and ENDIF directives.
@@ -118,12 +109,12 @@ def _validate_directive_uniqueness(
repeated = remove_directive_types(
[d for d in directives if directives.count(d) > 1],
[
- icon4py.liskov.parsing.parse.StartStencil,
- icon4py.liskov.parsing.parse.EndStencil,
- icon4py.liskov.parsing.parse.EndIf,
- icon4py.liskov.parsing.parse.EndProfile,
- icon4py.liskov.parsing.parse.StartProfile,
- icon4py.liskov.parsing.parse.Insert,
+ icon4pytools.liskov.parsing.parse.StartStencil,
+ icon4pytools.liskov.parsing.parse.EndStencil,
+ icon4pytools.liskov.parsing.parse.EndIf,
+ icon4pytools.liskov.parsing.parse.EndProfile,
+ icon4pytools.liskov.parsing.parse.StartProfile,
+ icon4pytools.liskov.parsing.parse.Insert,
],
)
if repeated:
@@ -132,17 +123,15 @@ def _validate_directive_uniqueness(
f"Error in {self.filepath}.\n Found same directive more than once in the following directives:\n {pretty_printed}"
)
- def _validate_required_directives(
- self, directives: list[ts.ParsedDirective]
- ) -> None:
+ def _validate_required_directives(self, directives: list[ts.ParsedDirective]) -> None:
"""Check that all required directives are used at least once."""
expected = [
- icon4py.liskov.parsing.parse.Declare,
- icon4py.liskov.parsing.parse.Imports,
- icon4py.liskov.parsing.parse.StartCreate,
- icon4py.liskov.parsing.parse.EndCreate,
- icon4py.liskov.parsing.parse.StartStencil,
- icon4py.liskov.parsing.parse.EndStencil,
+ icon4pytools.liskov.parsing.parse.Declare,
+ icon4pytools.liskov.parsing.parse.Imports,
+ icon4pytools.liskov.parsing.parse.StartCreate,
+ icon4pytools.liskov.parsing.parse.EndCreate,
+ icon4pytools.liskov.parsing.parse.StartStencil,
+ icon4pytools.liskov.parsing.parse.EndStencil,
]
for expected_type in expected:
if not any([isinstance(d, expected_type) for d in directives]):
@@ -156,13 +145,9 @@ def extract_arg_from_directive(directive: str, arg: str) -> str:
if match:
return match.group(1)
else:
- raise ValueError(
- f"Invalid directive string, could not find '{arg}' parameter."
- )
+ raise ValueError(f"Invalid directive string, could not find '{arg}' parameter.")
- def _validate_stencil_directives(
- self, directives: list[ts.ParsedDirective]
- ) -> None:
+ def _validate_stencil_directives(self, directives: list[ts.ParsedDirective]) -> None:
"""Validate that the number of start and end stencil directives match in the input `directives`.
Also verifies that each unique stencil has a corresponding start and end directive.
@@ -177,8 +162,8 @@ def _validate_stencil_directives(
if isinstance(
d,
(
- icon4py.liskov.parsing.parse.StartStencil,
- icon4py.liskov.parsing.parse.EndStencil,
+ icon4pytools.liskov.parsing.parse.StartStencil,
+ icon4pytools.liskov.parsing.parse.EndStencil,
),
)
]
@@ -186,14 +171,10 @@ def _validate_stencil_directives(
for directive in stencil_directives:
stencil_name = self.extract_arg_from_directive(directive.string, "name")
stencil_counts[stencil_name] = stencil_counts.get(stencil_name, 0) + (
- 1
- if isinstance(directive, icon4py.liskov.parsing.parse.StartStencil)
- else -1
+ 1 if isinstance(directive, icon4pytools.liskov.parsing.parse.StartStencil) else -1
)
- unbalanced_stencils = [
- stencil for stencil, count in stencil_counts.items() if count != 0
- ]
+ unbalanced_stencils = [stencil for stencil, count in stencil_counts.items() if count != 0]
if unbalanced_stencils:
raise UnbalancedStencilDirectiveError(
f"Error in {self.filepath}. Each unique stencil must have a corresponding START STENCIL and END STENCIL directive."
diff --git a/liskov/src/icon4py/liskov/__init__.py b/tools/src/icon4pytools/liskov/pipeline/__init__.py
similarity index 85%
rename from liskov/src/icon4py/liskov/__init__.py
rename to tools/src/icon4pytools/liskov/pipeline/__init__.py
index 155fd013a9..15dfdb0098 100644
--- a/liskov/src/icon4py/liskov/__init__.py
+++ b/tools/src/icon4pytools/liskov/pipeline/__init__.py
@@ -10,12 +10,3 @@
# distribution for a copy of the license or check .
#
# SPDX-License-Identifier: GPL-3.0-or-later
-
-from typing import Final
-
-
-__all__ = [
- "__version__",
-]
-
-__version__: Final = "0.0.3"
diff --git a/liskov/src/icon4py/liskov/pipeline/collection.py b/tools/src/icon4pytools/liskov/pipeline/collection.py
similarity index 79%
rename from liskov/src/icon4py/liskov/pipeline/collection.py
rename to tools/src/icon4pytools/liskov/pipeline/collection.py
index 5bc730c36c..006fa8a0e9 100644
--- a/liskov/src/icon4py/liskov/pipeline/collection.py
+++ b/tools/src/icon4pytools/liskov/pipeline/collection.py
@@ -12,22 +12,16 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from pathlib import Path
-from icon4py.liskov.codegen.integration.deserialise import (
- IntegrationCodeDeserialiser,
-)
-from icon4py.liskov.codegen.integration.generate import IntegrationCodeGenerator
-from icon4py.liskov.codegen.integration.interface import IntegrationCodeInterface
-from icon4py.liskov.codegen.serialisation.deserialise import (
- SerialisationCodeDeserialiser,
-)
-from icon4py.liskov.codegen.serialisation.generate import (
- SerialisationCodeGenerator,
-)
-from icon4py.liskov.codegen.shared.write import CodegenWriter
-from icon4py.liskov.external.gt4py import UpdateFieldsWithGt4PyStencils
-from icon4py.liskov.parsing.parse import DirectivesParser
-from icon4py.liskov.parsing.scan import DirectivesScanner
-from icon4py.liskov.pipeline.definition import Step, linear_pipeline
+from icon4pytools.liskov.codegen.integration.deserialise import IntegrationCodeDeserialiser
+from icon4pytools.liskov.codegen.integration.generate import IntegrationCodeGenerator
+from icon4pytools.liskov.codegen.integration.interface import IntegrationCodeInterface
+from icon4pytools.liskov.codegen.serialisation.deserialise import SerialisationCodeDeserialiser
+from icon4pytools.liskov.codegen.serialisation.generate import SerialisationCodeGenerator
+from icon4pytools.liskov.codegen.shared.write import CodegenWriter
+from icon4pytools.liskov.external.gt4py import UpdateFieldsWithGt4PyStencils
+from icon4pytools.liskov.parsing.parse import DirectivesParser
+from icon4pytools.liskov.parsing.scan import DirectivesScanner
+from icon4pytools.liskov.pipeline.definition import Step, linear_pipeline
DESERIALISERS = {
diff --git a/liskov/src/icon4py/liskov/pipeline/definition.py b/tools/src/icon4pytools/liskov/pipeline/definition.py
similarity index 100%
rename from liskov/src/icon4py/liskov/pipeline/definition.py
rename to tools/src/icon4pytools/liskov/pipeline/definition.py
diff --git a/pyutils/src/icon4py/icon4pygen/py.typed b/tools/src/icon4pytools/liskov/py.typed
similarity index 100%
rename from pyutils/src/icon4py/icon4pygen/py.typed
rename to tools/src/icon4pytools/liskov/py.typed
diff --git a/testutils/src/icon4py/testutils/py.typed b/tools/src/icon4pytools/py.typed
similarity index 100%
rename from testutils/src/icon4py/testutils/py.typed
rename to tools/src/icon4pytools/py.typed
diff --git a/tools/tests/f2ser/__init__.py b/tools/tests/f2ser/__init__.py
new file mode 100644
index 0000000000..15dfdb0098
--- /dev/null
+++ b/tools/tests/f2ser/__init__.py
@@ -0,0 +1,12 @@
+# ICON4Py - ICON inspired code in Python and GT4Py
+#
+# Copyright (c) 2022, ETH Zurich and MeteoSwiss
+# All rights reserved.
+#
+# This file is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or any later
+# version. See the LICENSE.txt file at the top-level directory of this
+# distribution for a copy of the license or check .
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
diff --git a/pyutils/tests/f2ser/conftest.py b/tools/tests/f2ser/conftest.py
similarity index 91%
rename from pyutils/tests/f2ser/conftest.py
rename to tools/tests/f2ser/conftest.py
index ff73a38d4f..e0a1bcb796 100644
--- a/pyutils/tests/f2ser/conftest.py
+++ b/tools/tests/f2ser/conftest.py
@@ -15,12 +15,10 @@
import pytest
-import icon4py.testutils as testutils
-
@pytest.fixture
def samples_path():
- return Path(testutils.__file__).parent / "fortran"
+ return Path(__file__).parent / "fortran_samples"
@pytest.fixture
diff --git a/testutils/src/icon4py/testutils/fortran/derived_types_example.f90 b/tools/tests/f2ser/fortran_samples/derived_types_example.f90
similarity index 100%
rename from testutils/src/icon4py/testutils/fortran/derived_types_example.f90
rename to tools/tests/f2ser/fortran_samples/derived_types_example.f90
diff --git a/testutils/src/icon4py/testutils/fortran/diffusion_granule.f90 b/tools/tests/f2ser/fortran_samples/diffusion_granule.f90
similarity index 100%
rename from testutils/src/icon4py/testutils/fortran/diffusion_granule.f90
rename to tools/tests/f2ser/fortran_samples/diffusion_granule.f90
diff --git a/testutils/src/icon4py/testutils/fortran/expected_diffusion_granule_savepoint.f90 b/tools/tests/f2ser/fortran_samples/expected_diffusion_granule_savepoint.f90
similarity index 100%
rename from testutils/src/icon4py/testutils/fortran/expected_diffusion_granule_savepoint.f90
rename to tools/tests/f2ser/fortran_samples/expected_diffusion_granule_savepoint.f90
diff --git a/testutils/src/icon4py/testutils/fortran/no_deps_subroutine_example.f90 b/tools/tests/f2ser/fortran_samples/no_deps_subroutine_example.f90
similarity index 100%
rename from testutils/src/icon4py/testutils/fortran/no_deps_subroutine_example.f90
rename to tools/tests/f2ser/fortran_samples/no_deps_subroutine_example.f90
diff --git a/testutils/src/icon4py/testutils/fortran/subroutine_example.f90 b/tools/tests/f2ser/fortran_samples/subroutine_example.f90
similarity index 99%
rename from testutils/src/icon4py/testutils/fortran/subroutine_example.f90
rename to tools/tests/f2ser/fortran_samples/subroutine_example.f90
index bb22e8c041..f9d4c6bdaa 100644
--- a/testutils/src/icon4py/testutils/fortran/subroutine_example.f90
+++ b/tools/tests/f2ser/fortran_samples/subroutine_example.f90
@@ -26,4 +26,3 @@ END MODULE example_subroutines
-
diff --git a/pyutils/tests/f2ser/test_f2ser_cli.py b/tools/tests/f2ser/test_f2ser_cli.py
similarity index 95%
rename from pyutils/tests/f2ser/test_f2ser_cli.py
rename to tools/tests/f2ser/test_f2ser_cli.py
index e4f27dcdbd..83c4ea1691 100644
--- a/pyutils/tests/f2ser/test_f2ser_cli.py
+++ b/tools/tests/f2ser/test_f2ser_cli.py
@@ -14,8 +14,8 @@
import pytest
from click.testing import CliRunner
-from icon4py.f2ser.cli import main
-from icon4py.f2ser.exceptions import MissingDerivedTypeError
+from icon4pytools.f2ser.cli import main
+from icon4pytools.f2ser.exceptions import MissingDerivedTypeError
@pytest.fixture
diff --git a/pyutils/tests/f2ser/test_f2ser_codegen.py b/tools/tests/f2ser/test_f2ser_codegen.py
similarity index 89%
rename from pyutils/tests/f2ser/test_f2ser_codegen.py
rename to tools/tests/f2ser/test_f2ser_codegen.py
index 23604e7d93..5ca607eff9 100644
--- a/pyutils/tests/f2ser/test_f2ser_codegen.py
+++ b/tools/tests/f2ser/test_f2ser_codegen.py
@@ -13,12 +13,10 @@
import pytest
-from icon4py.f2ser.deserialise import ParsedGranuleDeserialiser
-from icon4py.f2ser.parse import GranuleParser
-from icon4py.liskov.codegen.serialisation.generate import (
- SerialisationCodeGenerator,
-)
-from icon4py.liskov.codegen.shared.types import GeneratedCode
+from icon4pytools.f2ser.deserialise import ParsedGranuleDeserialiser
+from icon4pytools.f2ser.parse import GranuleParser
+from icon4pytools.liskov.codegen.serialisation.generate import SerialisationCodeGenerator
+from icon4pytools.liskov.codegen.shared.types import GeneratedCode
def test_deserialiser_diffusion_codegen(diffusion_granule, diffusion_granule_deps):
@@ -104,7 +102,5 @@ def test_deserialiser_directives_diffusion_codegen(
parsed = GranuleParser(diffusion_granule, diffusion_granule_deps)()
interface = ParsedGranuleDeserialiser(parsed)()
generated = SerialisationCodeGenerator(interface)()
- reference_savepoint = (
- samples_path / "expected_diffusion_granule_savepoint.f90"
- ).read_text()
+ reference_savepoint = (samples_path / "expected_diffusion_granule_savepoint.f90").read_text()
assert generated[0].source == reference_savepoint.rstrip()
diff --git a/pyutils/tests/f2ser/test_granule_deserialiser.py b/tools/tests/f2ser/test_granule_deserialiser.py
similarity index 90%
rename from pyutils/tests/f2ser/test_granule_deserialiser.py
rename to tools/tests/f2ser/test_granule_deserialiser.py
index 8c8a60b912..d0f478e7ce 100644
--- a/pyutils/tests/f2ser/test_granule_deserialiser.py
+++ b/tools/tests/f2ser/test_granule_deserialiser.py
@@ -12,9 +12,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later
import pytest
-from icon4py.f2ser.deserialise import ParsedGranuleDeserialiser
-from icon4py.f2ser.parse import CodegenContext, GranuleParser, ParsedGranule
-from icon4py.liskov.codegen.serialisation.interface import (
+from icon4pytools.f2ser.deserialise import ParsedGranuleDeserialiser
+from icon4pytools.f2ser.parse import CodegenContext, GranuleParser, ParsedGranule
+from icon4pytools.liskov.codegen.serialisation.interface import (
FieldSerialisationData,
SavepointData,
SerialisationCodeInterface,
@@ -83,11 +83,7 @@ def test_deserialiser_mock(mock_parsed_granule):
assert len(interface.Savepoint) == 3
assert all([isinstance(s, SavepointData) for s in interface.Savepoint])
assert all(
- [
- isinstance(f, FieldSerialisationData)
- for s in interface.Savepoint
- for f in s.fields
- ]
+ [isinstance(f, FieldSerialisationData) for s in interface.Savepoint for f in s.fields]
)
diff --git a/pyutils/tests/f2ser/test_parsing.py b/tools/tests/f2ser/test_parsing.py
similarity index 89%
rename from pyutils/tests/f2ser/test_parsing.py
rename to tools/tests/f2ser/test_parsing.py
index 2b606262b5..177fc496ee 100644
--- a/pyutils/tests/f2ser/test_parsing.py
+++ b/tools/tests/f2ser/test_parsing.py
@@ -13,8 +13,8 @@
import pytest
-from icon4py.f2ser.exceptions import MissingDerivedTypeError, ParsingError
-from icon4py.f2ser.parse import CodegenContext, GranuleParser
+from icon4pytools.f2ser.exceptions import MissingDerivedTypeError, ParsingError
+from icon4pytools.f2ser.parse import CodegenContext, GranuleParser
def test_granule_parsing(diffusion_granule, diffusion_granule_deps):
@@ -51,9 +51,7 @@ def test_granule_parsing(diffusion_granule, diffusion_granule_deps):
def test_granule_parsing_missing_derived_typedef(diffusion_granule, samples_path):
dependencies = [samples_path / "subroutine_example.f90"]
parser = GranuleParser(diffusion_granule, dependencies)
- with pytest.raises(
- MissingDerivedTypeError, match="Could not find type definition for TYPE"
- ):
+ with pytest.raises(MissingDerivedTypeError, match="Could not find type definition for TYPE"):
parser()
diff --git a/tools/tests/icon4pygen/__init__.py b/tools/tests/icon4pygen/__init__.py
new file mode 100644
index 0000000000..15dfdb0098
--- /dev/null
+++ b/tools/tests/icon4pygen/__init__.py
@@ -0,0 +1,12 @@
+# ICON4Py - ICON inspired code in Python and GT4Py
+#
+# Copyright (c) 2022, ETH Zurich and MeteoSwiss
+# All rights reserved.
+#
+# This file is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or any later
+# version. See the LICENSE.txt file at the top-level directory of this
+# distribution for a copy of the license or check .
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
diff --git a/tools/tests/icon4pygen/helpers.py b/tools/tests/icon4pygen/helpers.py
new file mode 100644
index 0000000000..064e98e060
--- /dev/null
+++ b/tools/tests/icon4pygen/helpers.py
@@ -0,0 +1,16 @@
+# ICON4Py - ICON inspired code in Python and GT4Py
+#
+# Copyright (c) 2022, ETH Zurich and MeteoSwiss
+# All rights reserved.
+#
+# This file is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or any later
+# version. See the LICENSE.txt file at the top-level directory of this
+# distribution for a copy of the license or check .
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+
+def get_stencil_module_path(stencil_module: str, stencil_name: str) -> str:
+ return f"icon4py.{stencil_module}.{stencil_name}:{stencil_name}"
diff --git a/pyutils/tests/icon4pygen/test_backend.py b/tools/tests/icon4pygen/test_backend.py
similarity index 85%
rename from pyutils/tests/icon4pygen/test_backend.py
rename to tools/tests/icon4pygen/test_backend.py
index 8fe1600510..e712d3ffa6 100644
--- a/pyutils/tests/icon4pygen/test_backend.py
+++ b/tools/tests/icon4pygen/test_backend.py
@@ -13,8 +13,8 @@
import pytest
from gt4py.next.iterator import ir as itir
-from icon4py.icon4pygen import backend
-from icon4py.icon4pygen.backend import GTHeader
+from icon4pytools.icon4pygen import backend
+from icon4pytools.icon4pygen.backend import GTHeader
@pytest.mark.parametrize(
@@ -28,8 +28,6 @@
)
def test_missing_domain_args(input_params, expected_complement):
params = [itir.Sym(id=p) for p in input_params]
- domain_boundaries = set(
- map(lambda s: str(s.id), GTHeader._missing_domain_params(params))
- )
+ domain_boundaries = set(map(lambda s: str(s.id), GTHeader._missing_domain_params(params)))
assert len(domain_boundaries) == len(expected_complement)
assert domain_boundaries == set(expected_complement)
diff --git a/pyutils/tests/icon4pygen/test_codegen.py b/tools/tests/icon4pygen/test_codegen.py
similarity index 97%
rename from pyutils/tests/icon4pygen/test_codegen.py
rename to tools/tests/icon4pygen/test_codegen.py
index a63dc2ebf8..0bb9ad5c2c 100644
--- a/pyutils/tests/icon4pygen/test_codegen.py
+++ b/tools/tests/icon4pygen/test_codegen.py
@@ -15,12 +15,13 @@
import pkgutil
import re
+import icon4py.atm_dyn_iconam
import pytest
from click.testing import CliRunner
-import icon4py.atm_dyn_iconam
-from icon4py.icon4pygen.cli import main
-from icon4py.testutils.utils import get_stencil_module_path
+from icon4pytools.icon4pygen.cli import main
+
+from .helpers import get_stencil_module_path
LEVELS_PER_THREAD = "1"
diff --git a/pyutils/tests/icon4pygen/test_exceptions.py b/tools/tests/icon4pygen/test_exceptions.py
similarity index 91%
rename from pyutils/tests/icon4pygen/test_exceptions.py
rename to tools/tests/icon4pygen/test_exceptions.py
index d9dd65824d..69445d5881 100644
--- a/pyutils/tests/icon4pygen/test_exceptions.py
+++ b/tools/tests/icon4pygen/test_exceptions.py
@@ -14,16 +14,16 @@
import pytest
from gt4py.next.ffront.decorator import field_operator, program
from gt4py.next.ffront.fbuiltins import Dimension, Field
-
from icon4py.common.dimension import EdgeDim, KDim
-from icon4py.icon4pygen.bindings.codegen.render.location import LocationRenderer
-from icon4py.icon4pygen.bindings.entities import Offset, chain_from_str
-from icon4py.icon4pygen.bindings.exceptions import (
+
+from icon4pytools.icon4pygen.bindings.codegen.render.location import LocationRenderer
+from icon4pytools.icon4pygen.bindings.entities import Offset, chain_from_str
+from icon4pytools.icon4pygen.bindings.exceptions import (
BindingsRenderingException,
BindingsTypeConsistencyException,
)
-from icon4py.icon4pygen.bindings.workflow import PyBindGen
-from icon4py.icon4pygen.metadata import get_stencil_info
+from icon4pytools.icon4pygen.bindings.workflow import PyBindGen
+from icon4pytools.icon4pygen.metadata import get_stencil_info
def test_invalid_offset():
diff --git a/pyutils/tests/icon4pygen/test_field_rendering.py b/tools/tests/icon4pygen/test_field_rendering.py
similarity index 89%
rename from pyutils/tests/icon4pygen/test_field_rendering.py
rename to tools/tests/icon4pygen/test_field_rendering.py
index c1d6b3e7d3..2ace9a6e24 100644
--- a/pyutils/tests/icon4pygen/test_field_rendering.py
+++ b/tools/tests/icon4pygen/test_field_rendering.py
@@ -13,10 +13,10 @@
from gt4py.next.ffront.decorator import field_operator, program
from gt4py.next.ffront.fbuiltins import Field, neighbor_sum
-
from icon4py.common.dimension import E2CDim, EdgeDim, KDim
-from icon4py.icon4pygen.bindings.workflow import PyBindGen
-from icon4py.icon4pygen.metadata import get_stencil_info
+
+from icon4pytools.icon4pygen.bindings.workflow import PyBindGen
+from icon4pytools.icon4pygen.metadata import get_stencil_info
def test_horizontal_field_sid_rendering():
@@ -61,9 +61,7 @@ def identity(field: Field[[EdgeDim, KDim], float]) -> Field[[EdgeDim, KDim], flo
return field
@program
- def identity_prog(
- field: Field[[EdgeDim, KDim], float], out: Field[[EdgeDim, KDim], float]
- ):
+ def identity_prog(field: Field[[EdgeDim, KDim], float], out: Field[[EdgeDim, KDim], float]):
identity(field, out=out)
stencil_info = get_stencil_info(identity_prog)
@@ -77,9 +75,7 @@ def identity_prog(
def test_vertical_sparse_field_sid_rendering():
@field_operator
- def reduction(
- nb_field: Field[[EdgeDim, E2CDim, KDim], float]
- ) -> Field[[EdgeDim, KDim], float]:
+ def reduction(nb_field: Field[[EdgeDim, E2CDim, KDim], float]) -> Field[[EdgeDim, KDim], float]:
return neighbor_sum(nb_field, axis=E2CDim)
@program
diff --git a/pyutils/tests/icon4pygen/test_icochainsize.py b/tools/tests/icon4pygen/test_icochainsize.py
similarity index 91%
rename from pyutils/tests/icon4pygen/test_icochainsize.py
rename to tools/tests/icon4pygen/test_icochainsize.py
index 0d7f8fb946..f9e73c5296 100644
--- a/pyutils/tests/icon4pygen/test_icochainsize.py
+++ b/tools/tests/icon4pygen/test_icochainsize.py
@@ -13,8 +13,8 @@
import pytest
-from icon4py.icon4pygen.exceptions import InvalidConnectivityException
-from icon4py.icon4pygen.metadata import provide_offset
+from icon4pytools.icon4pygen.exceptions import InvalidConnectivityException
+from icon4pytools.icon4pygen.metadata import provide_offset
@pytest.mark.parametrize(
diff --git a/pyutils/tests/icon4pygen/test_metadata.py b/tools/tests/icon4pygen/test_metadata.py
similarity index 97%
rename from pyutils/tests/icon4pygen/test_metadata.py
rename to tools/tests/icon4pygen/test_metadata.py
index 39359acb14..c0b50f9751 100644
--- a/pyutils/tests/icon4pygen/test_metadata.py
+++ b/tools/tests/icon4pygen/test_metadata.py
@@ -14,9 +14,9 @@
import pytest
from gt4py.next.common import Field
from gt4py.next.ffront.decorator import field_operator, program
-
from icon4py.common.dimension import CellDim, KDim
-from icon4py.icon4pygen.metadata import _get_field_infos, provide_neighbor_table
+
+from icon4pytools.icon4pygen.metadata import _get_field_infos, provide_neighbor_table
chain_false_skipvalues = [
diff --git a/tools/tests/liskov/__init__.py b/tools/tests/liskov/__init__.py
new file mode 100644
index 0000000000..15dfdb0098
--- /dev/null
+++ b/tools/tests/liskov/__init__.py
@@ -0,0 +1,12 @@
+# ICON4Py - ICON inspired code in Python and GT4Py
+#
+# Copyright (c) 2022, ETH Zurich and MeteoSwiss
+# All rights reserved.
+#
+# This file is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or any later
+# version. See the LICENSE.txt file at the top-level directory of this
+# distribution for a copy of the license or check .
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
diff --git a/liskov/tests/conftest.py b/tools/tests/liskov/conftest.py
similarity index 70%
rename from liskov/tests/conftest.py
rename to tools/tests/liskov/conftest.py
index 81a94b4faf..416941b8d7 100644
--- a/liskov/tests/conftest.py
+++ b/tools/tests/liskov/conftest.py
@@ -16,6 +16,9 @@
import pytest
from click.testing import CliRunner
+import icon4pytools.liskov.parsing.parse as ts
+from icon4pytools.liskov.parsing.scan import DirectivesScanner
+
@pytest.fixture
def make_f90_tmpfile(tmp_path) -> Path:
@@ -37,3 +40,15 @@ def _make_f90_tmpfile(content: str):
@pytest.fixture
def cli():
return CliRunner()
+
+
+def scan_for_directives(fpath: Path) -> list[ts.RawDirective]:
+ collector = DirectivesScanner(fpath)
+ return collector()
+
+
+def insert_new_lines(fname: Path, lines: list[str]) -> None:
+ """Append new lines into file."""
+ with open(fname, "a") as f:
+ for ln in lines:
+ f.write(f"{ln}\n")
diff --git a/testutils/src/icon4py/testutils/liskov_fortran_samples.py b/tools/tests/liskov/fortran_samples.py
similarity index 74%
rename from testutils/src/icon4py/testutils/liskov_fortran_samples.py
rename to tools/tests/liskov/fortran_samples.py
index 8231dbe038..858b3a2089 100644
--- a/testutils/src/icon4py/testutils/liskov_fortran_samples.py
+++ b/tools/tests/liskov/fortran_samples.py
@@ -33,11 +33,11 @@
!$DSL DECLARE(vn=nproma,p_patch%nlev,p_patch%nblks_e; suffix=dsl)
- !$DSL DECLARE(vn= nproma,p_patch%nlev,p_patch%nblks_e; a=nproma,p_patch%nlev,p_patch%nblks_e; &
+ !$DSL DECLARE(vn=nproma,p_patch%nlev,p_patch%nblks_e; a=nproma,p_patch%nlev,p_patch%nblks_e; &
!$DSL b=nproma,p_patch%nlev,p_patch%nblks_e; type=REAL(vp))
!$DSL START STENCIL(name=apply_nabla2_to_vn_in_lateral_boundary; &
- !$DSL z_nabla2_e=z_nabla2_e(:, :, 1); area_edge=p_patch%edges%area_edge(:,1); &
+ !$DSL z_nabla2_e=z_nabla2_e(:,:,1); area_edge=p_patch%edges%area_edge(:,1); &
!$DSL fac_bdydiff_v=fac_bdydiff_v; vn=p_nh_prog%vn(:,:,1); &
!$DSL vertical_lower=1; vertical_upper=nlev; &
!$DSL horizontal_lower=i_startidx; horizontal_upper=i_endidx; &
@@ -242,78 +242,3 @@
!$DSL END CREATE()
"""
-
-
-REPEATED_STENCILS = """\
- !$DSL IMPORTS()
-
- !$DSL START CREATE()
-
- !$DSL DECLARE(vn=nproma,p_patch%nlev,p_patch%nblks_e; suffix=dsl)
-
- !$DSL DECLARE(vn= nproma,p_patch%nlev,p_patch%nblks_e; a=nproma,p_patch%nlev,p_patch%nblks_e; &
- !$DSL b=nproma,p_patch%nlev,p_patch%nblks_e; type=REAL(vp))
-
- !$DSL START STENCIL(name=apply_nabla2_to_vn_in_lateral_boundary; &
- !$DSL z_nabla2_e=z_nabla2_e(:, :, 1); area_edge=p_patch%edges%area_edge(:,1); &
- !$DSL fac_bdydiff_v=fac_bdydiff_v; vn=p_nh_prog%vn(:,:,1); &
- !$DSL vertical_lower=1; vertical_upper=nlev; &
- !$DSL horizontal_lower=i_startidx; horizontal_upper=i_endidx; &
- !$DSL accpresent=True)
- !$OMP DO PRIVATE(je,jk,jb,i_startidx,i_endidx) ICON_OMP_DEFAULT_SCHEDULE
- DO jb = i_startblk,i_endblk
-
- CALL get_indices_e(p_patch, jb, i_startblk, i_endblk, &
- i_startidx, i_endidx, start_bdydiff_e, grf_bdywidth_e)
-
- !$ACC PARALLEL IF( i_am_accel_node .AND. acc_on ) DEFAULT(NONE) ASYNC(1)
- vn_before(:,:,:) = p_nh_prog%vn(:,:,:)
- !$ACC END PARALLEL
-
- !$ACC PARALLEL LOOP DEFAULT(NONE) GANG VECTOR COLLAPSE(2) ASYNC(1) IF( i_am_accel_node .AND. acc_on )
- DO jk = 1, nlev
- !DIR$ IVDEP
- DO je = i_startidx, i_endidx
- p_nh_prog%vn(je,jk,jb) = &
- p_nh_prog%vn(je,jk,jb) + &
- z_nabla2_e(je,jk,jb) * &
- p_patch%edges%area_edge(je,jb)*fac_bdydiff_v
- ENDDO
- ENDDO
- !$DSL START PROFILE(name=apply_nabla2_to_vn_in_lateral_boundary)
- !$ACC END PARALLEL LOOP
- !$DSL END PROFILE()
- !$DSL END STENCIL(name=apply_nabla2_to_vn_in_lateral_boundary; noprofile=True)
-
- !$DSL START STENCIL(name=apply_nabla2_to_vn_in_lateral_boundary; &
- !$DSL z_nabla2_e=z_nabla2_e(:, :, 1); area_edge=p_patch%edges%area_edge(:,1); &
- !$DSL fac_bdydiff_v=fac_bdydiff_v; vn=p_nh_prog%vn(:,:,1); &
- !$DSL vertical_lower=1; vertical_upper=nlev; &
- !$DSL horizontal_lower=i_startidx; horizontal_upper=i_endidx; &
- !$DSL accpresent=True)
- !$OMP DO PRIVATE(je,jk,jb,i_startidx,i_endidx) ICON_OMP_DEFAULT_SCHEDULE
- DO jb = i_startblk,i_endblk
-
- CALL get_indices_e(p_patch, jb, i_startblk, i_endblk, &
- i_startidx, i_endidx, start_bdydiff_e, grf_bdywidth_e)
-
- !$ACC PARALLEL IF( i_am_accel_node .AND. acc_on ) DEFAULT(NONE) ASYNC(1)
- vn_before(:,:,:) = p_nh_prog%vn(:,:,:)
- !$ACC END PARALLEL
-
- !$ACC PARALLEL LOOP DEFAULT(NONE) GANG VECTOR COLLAPSE(2) ASYNC(1) IF( i_am_accel_node .AND. acc_on )
- DO jk = 1, nlev
- !DIR$ IVDEP
- DO je = i_startidx, i_endidx
- p_nh_prog%vn(je,jk,jb) = &
- p_nh_prog%vn(je,jk,jb) + &
- z_nabla2_e(je,jk,jb) * &
- p_patch%edges%area_edge(je,jb)*fac_bdydiff_v
- ENDDO
- ENDDO
- !$DSL START PROFILE(name=apply_nabla2_to_vn_in_lateral_boundary)
- !$ACC END PARALLEL LOOP
- !$DSL END PROFILE()
- !$DSL END STENCIL(name=apply_nabla2_to_vn_in_lateral_boundary; noprofile=True)
- !$DSL END CREATE()
- """
diff --git a/liskov/tests/test_cli.py b/tools/tests/liskov/test_cli.py
similarity index 90%
rename from liskov/tests/test_cli.py
rename to tools/tests/liskov/test_cli.py
index 80571c30c9..edd178f62e 100644
--- a/liskov/tests/test_cli.py
+++ b/tools/tests/liskov/test_cli.py
@@ -15,14 +15,14 @@
import pytest
-from icon4py.liskov.cli import main
-from icon4py.liskov.external.exceptions import MissingCommandError
-from icon4py.testutils.liskov_fortran_samples import (
+from icon4pytools.liskov.cli import main
+from icon4pytools.liskov.external.exceptions import MissingCommandError
+
+from .fortran_samples import (
CONSECUTIVE_STENCIL,
FREE_FORM_STENCIL,
MULTIPLE_STENCILS,
NO_DIRECTIVES_STENCIL,
- REPEATED_STENCILS,
SINGLE_STENCIL,
)
@@ -40,7 +40,6 @@ def outfile(tmp_path):
("CONSECUTIVE", CONSECUTIVE_STENCIL),
("FREE_FORM", FREE_FORM_STENCIL),
("MULTIPLE", MULTIPLE_STENCILS),
- ("REPEATED", REPEATED_STENCILS),
]
flags = {"serialise": ["--multinode"], "integrate": ["-p", "-m"]}
diff --git a/liskov/tests/test_code_metadata.py b/tools/tests/liskov/test_code_metadata.py
similarity index 86%
rename from liskov/tests/test_code_metadata.py
rename to tools/tests/liskov/test_code_metadata.py
index 16c5100fcb..77317acd86 100644
--- a/liskov/tests/test_code_metadata.py
+++ b/tools/tests/liskov/test_code_metadata.py
@@ -16,13 +16,13 @@
import pytest
-import icon4py.liskov
-from icon4py.liskov.external.metadata import CodeMetadata
+import icon4pytools
+from icon4pytools.liskov.external.metadata import CodeMetadata
@pytest.fixture
def module_parent():
- import icon4py.liskov.external.metadata as meta
+ import icon4pytools.liskov.external.metadata as meta
return Path(meta.__file__).parent
@@ -36,7 +36,7 @@ def test_generated_on():
def test_version(module_parent):
metadata = CodeMetadata()
- assert metadata.version == icon4py.liskov.__version__
+ assert metadata.version == icon4pytools.__version__
def test_click_context():
diff --git a/liskov/tests/test_directives_deserialiser.py b/tools/tests/liskov/test_directives_deserialiser.py
similarity index 74%
rename from liskov/tests/test_directives_deserialiser.py
rename to tools/tests/liskov/test_directives_deserialiser.py
index bb10c24a1b..771589eb97 100644
--- a/liskov/tests/test_directives_deserialiser.py
+++ b/tools/tests/liskov/test_directives_deserialiser.py
@@ -15,8 +15,8 @@
import pytest
-import icon4py.liskov.parsing.parse
-from icon4py.liskov.codegen.integration.deserialise import (
+import icon4pytools.liskov.parsing.parse as ts
+from icon4pytools.liskov.codegen.integration.deserialise import (
DeclareDataFactory,
EndCreateDataFactory,
EndIfDataFactory,
@@ -28,7 +28,7 @@
StartProfileDataFactory,
StartStencilDataFactory,
)
-from icon4py.liskov.codegen.integration.interface import (
+from icon4pytools.liskov.codegen.integration.interface import (
BoundsData,
DeclareData,
EndCreateData,
@@ -41,7 +41,7 @@
StartCreateData,
StartProfileData,
)
-from icon4py.liskov.parsing.exceptions import (
+from icon4pytools.liskov.parsing.exceptions import (
DirectiveSyntaxError,
MissingBoundsError,
MissingDirectiveArgumentError,
@@ -53,7 +53,7 @@
[
(
EndCreateDataFactory,
- icon4py.liskov.parsing.parse.EndCreate,
+ ts.EndCreate,
"END CREATE",
2,
2,
@@ -61,7 +61,7 @@
),
(
ImportsDataFactory,
- icon4py.liskov.parsing.parse.Imports,
+ ts.Imports,
"IMPORTS",
3,
3,
@@ -69,7 +69,7 @@
),
(
EndIfDataFactory,
- icon4py.liskov.parsing.parse.EndIf,
+ ts.EndIf,
"ENDIF",
4,
4,
@@ -77,7 +77,7 @@
),
(
EndProfileDataFactory,
- icon4py.liskov.parsing.parse.EndProfile,
+ ts.EndProfile,
"END PROFILE",
5,
5,
@@ -85,9 +85,7 @@
),
],
)
-def test_data_factories_no_args(
- factory_class, directive_type, string, startln, endln, expected
-):
+def test_data_factories_no_args(factory_class, directive_type, string, startln, endln, expected):
parsed = {
"directives": [directive_type(string=string, startln=startln, endln=endln)],
"content": {},
@@ -110,12 +108,8 @@ def test_data_factories_no_args(
EndStencilData,
{
"directives": [
- icon4py.liskov.parsing.parse.EndStencil(
- "END STENCIL(name=foo)", 5, 5
- ),
- icon4py.liskov.parsing.parse.EndStencil(
- "END STENCIL(name=bar; noendif=true; noprofile=true)", 20, 20
- ),
+ ts.EndStencil("END STENCIL(name=foo)", 5, 5),
+ ts.EndStencil("END STENCIL(name=bar; noendif=true; noprofile=true)", 20, 20),
],
"content": {
"EndStencil": [
@@ -129,11 +123,7 @@ def test_data_factories_no_args(
EndStencilDataFactory,
EndStencilData,
{
- "directives": [
- icon4py.liskov.parsing.parse.EndStencil(
- "END STENCIL(name=foo; noprofile=true)", 5, 5
- )
- ],
+ "directives": [ts.EndStencil("END STENCIL(name=foo; noprofile=true)", 5, 5)],
"content": {"EndStencil": [{"name": "foo"}]},
},
),
@@ -142,12 +132,8 @@ def test_data_factories_no_args(
StartProfileData,
{
"directives": [
- icon4py.liskov.parsing.parse.StartProfile(
- "START PROFILE(name=foo)", 5, 5
- ),
- icon4py.liskov.parsing.parse.StartProfile(
- "START PROFILE(name=bar)", 20, 20
- ),
+ ts.StartProfile("START PROFILE(name=foo)", 5, 5),
+ ts.StartProfile("START PROFILE(name=bar)", 20, 20),
],
"content": {"StartProfile": [{"name": "foo"}, {"name": "bar"}]},
},
@@ -156,11 +142,7 @@ def test_data_factories_no_args(
StartProfileDataFactory,
StartProfileData,
{
- "directives": [
- icon4py.liskov.parsing.parse.StartProfile(
- "START PROFILE(name=foo)", 5, 5
- )
- ],
+ "directives": [ts.StartProfile("START PROFILE(name=foo)", 5, 5)],
"content": {"StartProfile": [{"name": "foo"}]},
},
),
@@ -169,7 +151,7 @@ def test_data_factories_no_args(
DeclareData,
{
"directives": [
- icon4py.liskov.parsing.parse.Declare(
+ ts.Declare(
"DECLARE(vn=nlev,nblks_c; w=nlevp1,nblks_e; suffix=dsl; type=LOGICAL)",
5,
5,
@@ -191,9 +173,7 @@ def test_data_factories_no_args(
InsertDataFactory,
InsertData,
{
- "directives": [
- icon4py.liskov.parsing.parse.Insert("INSERT(content=foo)", 5, 5)
- ],
+ "directives": [ts.Insert("INSERT(content=foo)", 5, 5)],
"content": {"Insert": ["foo"]},
},
),
@@ -210,31 +190,21 @@ def test_data_factories_with_args(factory, target, mock_data):
[
(
{
- "directives": [
- icon4py.liskov.parsing.parse.StartCreate(
- "START CREATE(extra_fields=foo)", 5, 5
- )
- ],
+ "directives": [ts.StartCreate("START CREATE(extra_fields=foo)", 5, 5)],
"content": {"StartCreate": [{"extra_fields": "foo"}]},
},
["foo"],
),
(
{
- "directives": [
- icon4py.liskov.parsing.parse.StartCreate(
- "START CREATE(extra_fields=foo,xyz)", 5, 5
- )
- ],
+ "directives": [ts.StartCreate("START CREATE(extra_fields=foo,xyz)", 5, 5)],
"content": {"StartCreate": [{"extra_fields": "foo,xyz"}]},
},
["foo", "xyz"],
),
(
{
- "directives": [
- icon4py.liskov.parsing.parse.StartCreate("START CREATE()", 5, 5)
- ],
+ "directives": [ts.StartCreate("START CREATE()", 5, 5)],
"content": {"StartCreate": [None]},
},
None,
@@ -256,16 +226,10 @@ def test_start_create_factory(mock_data, extra_fields):
EndStencilData,
{
"directives": [
- icon4py.liskov.parsing.parse.EndStencil(
- "END STENCIL(name=foo)", 5, 5
- ),
- icon4py.liskov.parsing.parse.EndStencil(
- "END STENCIL(name=bar; noendif=foo)", 20, 20
- ),
+ ts.EndStencil("END STENCIL(name=foo)", 5, 5),
+ ts.EndStencil("END STENCIL(name=bar; noendif=foo)", 20, 20),
],
- "content": {
- "EndStencil": [{"name": "foo"}, {"name": "bar", "noendif": "foo"}]
- },
+ "content": {"EndStencil": [{"name": "foo"}, {"name": "bar", "noendif": "foo"}]},
},
),
],
@@ -348,10 +312,7 @@ def test_update_field_tolerances(self):
FieldAssociationData("x", "i", 3, rel_tol="0.01", abs_tol="0.1"),
FieldAssociationData("y", "i", 3, rel_tol="0.001"),
]
- assert (
- self.factory._update_tolerances(named_args, self.mock_fields)
- == expected_fields
- )
+ assert self.factory._update_tolerances(named_args, self.mock_fields) == expected_fields
def test_update_field_tolerances_not_all_fields(self):
# Test that tolerance is not set for fields that are not provided in the named_args.
@@ -363,15 +324,9 @@ def test_update_field_tolerances_not_all_fields(self):
FieldAssociationData("x", "i", 3, rel_tol="0.01", abs_tol="0.1"),
FieldAssociationData("y", "i", 3),
]
- assert (
- self.factory._update_tolerances(named_args, self.mock_fields)
- == expected_fields
- )
+ assert self.factory._update_tolerances(named_args, self.mock_fields) == expected_fields
def test_update_field_tolerances_no_tolerances(self):
# Test that fields are not updated if named_args does not contain any tolerances.
named_args = {}
- assert (
- self.factory._update_tolerances(named_args, self.mock_fields)
- == self.mock_fields
- )
+ assert self.factory._update_tolerances(named_args, self.mock_fields) == self.mock_fields
diff --git a/liskov/tests/test_external.py b/tools/tests/liskov/test_external.py
similarity index 91%
rename from liskov/tests/test_external.py
rename to tools/tests/liskov/test_external.py
index 84a9acf2f3..1e0de1b5ca 100644
--- a/liskov/tests/test_external.py
+++ b/tools/tests/liskov/test_external.py
@@ -17,16 +17,13 @@
import pytest
from gt4py.next.ffront.decorator import Program
-from icon4py.liskov.codegen.integration.interface import (
+from icon4pytools.liskov.codegen.integration.interface import (
FieldAssociationData,
IntegrationCodeInterface,
StartStencilData,
)
-from icon4py.liskov.external.exceptions import (
- IncompatibleFieldError,
- UnknownStencilError,
-)
-from icon4py.liskov.external.gt4py import UpdateFieldsWithGt4PyStencils
+from icon4pytools.liskov.external.exceptions import IncompatibleFieldError, UnknownStencilError
+from icon4pytools.liskov.external.gt4py import UpdateFieldsWithGt4PyStencils
def test_stencil_collector():
diff --git a/liskov/tests/test_generation.py b/tools/tests/liskov/test_generation.py
similarity index 90%
rename from liskov/tests/test_generation.py
rename to tools/tests/liskov/test_generation.py
index fb61064055..3b65f3666f 100644
--- a/liskov/tests/test_generation.py
+++ b/tools/tests/liskov/test_generation.py
@@ -13,8 +13,8 @@
import pytest
-from icon4py.liskov.codegen.integration.generate import IntegrationCodeGenerator
-from icon4py.liskov.codegen.integration.interface import (
+from icon4pytools.liskov.codegen.integration.generate import IntegrationCodeGenerator
+from icon4pytools.liskov.codegen.integration.interface import (
BoundsData,
DeclareData,
EndCreateData,
@@ -31,10 +31,8 @@
)
# TODO: fix tests to adapt to new custom output fields
-from icon4py.liskov.codegen.serialisation.generate import (
- SerialisationCodeGenerator,
-)
-from icon4py.liskov.codegen.serialisation.interface import (
+from icon4pytools.liskov.codegen.serialisation.generate import SerialisationCodeGenerator
+from icon4pytools.liskov.codegen.serialisation.interface import (
FieldSerialisationData,
ImportData,
InitData,
@@ -51,9 +49,7 @@ def integration_code_interface():
fields=[
FieldAssociationData("scalar1", "scalar1", inp=True, out=False, dims=None),
FieldAssociationData("inp1", "inp1(:,:,1)", inp=True, out=False, dims=2),
- FieldAssociationData(
- "out1", "out1(:,:,1)", inp=False, out=True, dims=2, abs_tol="0.5"
- ),
+ FieldAssociationData("out1", "out1(:,:,1)", inp=False, out=True, dims=2, abs_tol="0.5"),
FieldAssociationData(
"out2",
"p_nh%prog(nnew)%out2(:,:,1)",
@@ -62,12 +58,8 @@ def integration_code_interface():
dims=3,
abs_tol="0.2",
),
- FieldAssociationData(
- "out3", "p_nh%prog(nnew)%w(:,:,jb)", inp=False, out=True, dims=2
- ),
- FieldAssociationData(
- "out4", "p_nh%prog(nnew)%w(:,:,1,2)", inp=False, out=True, dims=3
- ),
+ FieldAssociationData("out3", "p_nh%prog(nnew)%w(:,:,jb)", inp=False, out=True, dims=2),
+ FieldAssociationData("out4", "p_nh%prog(nnew)%w(:,:,1,2)", inp=False, out=True, dims=3),
FieldAssociationData(
"out5", "p_nh%prog(nnew)%w(:,:,:,ntnd)", inp=False, out=True, dims=3
),
@@ -81,9 +73,7 @@ def integration_code_interface():
mergecopy=False,
copies=True,
)
- end_stencil_data = EndStencilData(
- name="stencil1", startln=3, noendif=False, noprofile=False
- )
+ end_stencil_data = EndStencilData(name="stencil1", startln=3, noendif=False, noprofile=False)
declare_data = DeclareData(
startln=5,
declarations={"field2": "(nproma, p_patch%nlev, p_patch%nblks_e)"},
@@ -210,9 +200,7 @@ def expected_insert_source():
@pytest.fixture
def integration_code_generator(integration_code_interface):
- return IntegrationCodeGenerator(
- integration_code_interface, profile=True, metadatagen=False
- )
+ return IntegrationCodeGenerator(integration_code_interface, profile=True, metadatagen=False)
def test_integration_code_generation(
@@ -333,9 +321,7 @@ def expected_savepoints():
def test_serialisation_code_generation(
serialisation_code_interface, expected_savepoints, multinode
):
- generated = SerialisationCodeGenerator(
- serialisation_code_interface, multinode=multinode
- )()
+ generated = SerialisationCodeGenerator(serialisation_code_interface, multinode=multinode)()
if multinode:
assert len(generated) == 3
diff --git a/liskov/tests/test_parser.py b/tools/tests/liskov/test_parser.py
similarity index 83%
rename from liskov/tests/test_parser.py
rename to tools/tests/liskov/test_parser.py
index 6fa5095de9..5bb2518e13 100644
--- a/liskov/tests/test_parser.py
+++ b/tools/tests/liskov/test_parser.py
@@ -17,19 +17,12 @@
import pytest
from pytest import mark
-import icon4py.liskov.parsing.parse
-import icon4py.liskov.parsing.types as ts
-from icon4py.liskov.parsing.exceptions import UnsupportedDirectiveError
-from icon4py.liskov.parsing.parse import DirectivesParser
-from icon4py.testutils.liskov_fortran_samples import (
- MULTIPLE_STENCILS,
- NO_DIRECTIVES_STENCIL,
- SINGLE_STENCIL,
-)
-from icon4py.testutils.liskov_test_utils import (
- insert_new_lines,
- scan_for_directives,
-)
+import icon4pytools.liskov.parsing.parse as ts
+from icon4pytools.liskov.parsing.exceptions import UnsupportedDirectiveError
+from icon4pytools.liskov.parsing.parse import DirectivesParser
+
+from .conftest import insert_new_lines, scan_for_directives
+from .fortran_samples import MULTIPLE_STENCILS, NO_DIRECTIVES_STENCIL, SINGLE_STENCIL
def test_parse_no_input():
@@ -41,23 +34,21 @@ def test_parse_no_input():
"directive, string, startln, endln, expected_content",
[
(
- icon4py.liskov.parsing.parse.Imports("IMPORTS()", 1, 1),
+ ts.Imports("IMPORTS()", 1, 1),
"IMPORTS()",
1,
1,
defaultdict(list, {"Imports": [{}]}),
),
(
- icon4py.liskov.parsing.parse.StartCreate(
- "START CREATE(extra_fields=foo)", 2, 2
- ),
+ ts.StartCreate("START CREATE(extra_fields=foo)", 2, 2),
"START CREATE()",
2,
2,
defaultdict(list, {"StartCreate": [{"extra_fields": "foo"}]}),
),
(
- icon4py.liskov.parsing.parse.StartStencil(
+ ts.StartStencil(
"START STENCIL(name=mo_nh_diffusion_06; vn=p_patch%p%vn; foo=abc)", 3, 4
),
"START STENCIL(name=mo_nh_diffusion_06; vn=p_patch%p%vn; foo=abc)",
diff --git a/liskov/tests/test_scanner.py b/tools/tests/liskov/test_scanner.py
similarity index 90%
rename from liskov/tests/test_scanner.py
rename to tools/tests/liskov/test_scanner.py
index 6e7c5c2252..14d2839f45 100644
--- a/liskov/tests/test_scanner.py
+++ b/tools/tests/liskov/test_scanner.py
@@ -17,13 +17,11 @@
import pytest
from pytest import mark
-from icon4py.liskov.parsing.exceptions import DirectiveSyntaxError
-from icon4py.liskov.parsing.scan import DirectivesScanner
-from icon4py.liskov.parsing.types import RawDirective
-from icon4py.testutils.liskov_fortran_samples import (
- DIRECTIVES_SAMPLE,
- NO_DIRECTIVES_STENCIL,
-)
+from icon4pytools.liskov.parsing.exceptions import DirectiveSyntaxError
+from icon4pytools.liskov.parsing.scan import DirectivesScanner
+from icon4pytools.liskov.parsing.types import RawDirective
+
+from .fortran_samples import DIRECTIVES_SAMPLE, NO_DIRECTIVES_STENCIL
ALLOWED_EOL_CHARS = [")", "&"]
diff --git a/liskov/tests/test_serialisation_deserialiser.py b/tools/tests/liskov/test_serialisation_deserialiser.py
similarity index 93%
rename from liskov/tests/test_serialisation_deserialiser.py
rename to tools/tests/liskov/test_serialisation_deserialiser.py
index 5fe597de65..0431086beb 100644
--- a/liskov/tests/test_serialisation_deserialiser.py
+++ b/tools/tests/liskov/test_serialisation_deserialiser.py
@@ -13,17 +13,17 @@
import pytest
-from icon4py.liskov.codegen.serialisation.deserialise import (
+from icon4pytools.liskov.codegen.serialisation.deserialise import (
InitDataFactory,
SavepointDataFactory,
)
-from icon4py.liskov.codegen.serialisation.interface import (
+from icon4pytools.liskov.codegen.serialisation.interface import (
FieldSerialisationData,
InitData,
Metadata,
SavepointData,
)
-from icon4py.liskov.parsing.parse import (
+from icon4pytools.liskov.parsing.parse import (
Declare,
EndCreate,
EndProfile,
@@ -109,9 +109,7 @@ def parsed_dict():
],
"StartProfile": [{"name": "apply_nabla2_to_vn_in_lateral_boundary"}],
"EndProfile": [{}],
- "EndStencil": [
- {"name": "apply_nabla2_to_vn_in_lateral_boundary", "noprofile": "True"}
- ],
+ "EndStencil": [{"name": "apply_nabla2_to_vn_in_lateral_boundary", "noprofile": "True"}],
"EndCreate": [{}],
},
}
diff --git a/liskov/tests/test_utils.py b/tools/tests/liskov/test_utils.py
similarity index 72%
rename from liskov/tests/test_utils.py
rename to tools/tests/liskov/test_utils.py
index bd3d3313ae..82d5a742e4 100644
--- a/liskov/tests/test_utils.py
+++ b/tools/tests/liskov/test_utils.py
@@ -14,9 +14,8 @@
import pytest
-import icon4py.liskov.parsing.parse
-from icon4py.liskov.parsing.parse import Imports, StartCreate
-from icon4py.liskov.parsing.utils import (
+import icon4pytools.liskov.parsing.parse as ts
+from icon4pytools.liskov.parsing.utils import (
extract_directive,
print_parsed_directive,
remove_directive_types,
@@ -26,22 +25,22 @@
def test_extract_directive():
directives = [
- Imports("IMPORTS()", 1, 1),
- StartCreate("START CREATE()", 3, 4),
+ ts.Imports("IMPORTS()", 1, 1),
+ ts.StartCreate("START CREATE()", 3, 4),
]
# Test that only the expected directive is extracted.
- assert extract_directive(directives, Imports) == [directives[0]]
- assert extract_directive(directives, StartCreate) == [directives[1]]
+ assert extract_directive(directives, ts.Imports) == [directives[0]]
+ assert extract_directive(directives, ts.StartCreate) == [directives[1]]
def test_remove_directive():
directives = [
- Imports("IMPORTS()", 1, 1),
- StartCreate("START CREATE()", 3, 4),
+ ts.Imports("IMPORTS()", 1, 1),
+ ts.StartCreate("START CREATE()", 3, 4),
]
new_directives = deepcopy(directives)
- assert remove_directive_types(new_directives, [Imports]) == [directives[1]]
+ assert remove_directive_types(new_directives, [ts.Imports]) == [directives[1]]
@pytest.mark.parametrize(
@@ -64,6 +63,6 @@ def test_string_to_bool(string, expected):
def test_print_parsed_directive():
- directive = icon4py.liskov.parsing.parse.Imports("IMPORTS()", 1, 1)
+ directive = ts.Imports("IMPORTS()", 1, 1)
expected_output = "Directive: IMPORTS(), start line: 1, end line: 1\n"
assert print_parsed_directive(directive) == expected_output
diff --git a/liskov/tests/test_validation.py b/tools/tests/liskov/test_validation.py
similarity index 86%
rename from liskov/tests/test_validation.py
rename to tools/tests/liskov/test_validation.py
index ba6488cfa4..ca0b880bc5 100644
--- a/liskov/tests/test_validation.py
+++ b/tools/tests/liskov/test_validation.py
@@ -14,28 +14,23 @@
import pytest
from pytest import mark
-from icon4py.liskov.parsing.exceptions import (
+from icon4pytools.liskov.parsing.exceptions import (
DirectiveSyntaxError,
RepeatedDirectiveError,
RequiredDirectivesError,
UnbalancedStencilDirectiveError,
)
-from icon4py.liskov.parsing.parse import (
+from icon4pytools.liskov.parsing.parse import (
Declare,
DirectivesParser,
Imports,
StartCreate,
StartStencil,
)
-from icon4py.liskov.parsing.validation import DirectiveSyntaxValidator
-from icon4py.testutils.liskov_fortran_samples import (
- MULTIPLE_STENCILS,
- SINGLE_STENCIL,
-)
-from icon4py.testutils.liskov_test_utils import (
- insert_new_lines,
- scan_for_directives,
-)
+from icon4pytools.liskov.parsing.validation import DirectiveSyntaxValidator
+
+from .conftest import insert_new_lines, scan_for_directives
+from .fortran_samples import MULTIPLE_STENCILS, SINGLE_STENCIL
@mark.parametrize(
@@ -85,9 +80,7 @@ def test_directive_syntax_validator(directive):
"!$DSL START CREATE()",
],
)
-def test_directive_semantics_validation_repeated_directives(
- make_f90_tmpfile, directive
-):
+def test_directive_semantics_validation_repeated_directives(make_f90_tmpfile, directive):
fpath = make_f90_tmpfile(content=SINGLE_STENCIL)
opath = fpath.with_suffix(".gen")
insert_new_lines(fpath, [directive])
@@ -124,9 +117,7 @@ def test_directive_semantics_validation_repeated_stencil(make_f90_tmpfile, direc
"""!$DSL END STENCIL(name=apply_nabla2_to_vn_in_lateral_boundary; noprofile=True)""",
],
)
-def test_directive_semantics_validation_required_directives(
- make_f90_tmpfile, directive
-):
+def test_directive_semantics_validation_required_directives(make_f90_tmpfile, directive):
new = SINGLE_STENCIL.replace(directive, "")
fpath = make_f90_tmpfile(content=new)
opath = fpath.with_suffix(".gen")
diff --git a/liskov/tests/test_writer.py b/tools/tests/liskov/test_writer.py
similarity index 91%
rename from liskov/tests/test_writer.py
rename to tools/tests/liskov/test_writer.py
index 41db096973..e24410120e 100644
--- a/liskov/tests/test_writer.py
+++ b/tools/tests/liskov/test_writer.py
@@ -14,8 +14,8 @@
from pathlib import Path
from tempfile import TemporaryDirectory
-from icon4py.liskov.codegen.shared.types import GeneratedCode
-from icon4py.liskov.codegen.shared.write import DIRECTIVE_IDENT, CodegenWriter
+from icon4pytools.liskov.codegen.shared.types import GeneratedCode
+from icon4pytools.liskov.codegen.shared.write import DIRECTIVE_IDENT, CodegenWriter
def test_write_from():
@@ -64,9 +64,7 @@ def test_insert_generated_code():
"another line",
"generated code2\n",
]
- assert (
- CodegenWriter._insert_generated_code(current_file, generated) == expected_output
- )
+ assert CodegenWriter._insert_generated_code(current_file, generated) == expected_output
def test_write_file():
diff --git a/tools/tox.ini b/tools/tox.ini
new file mode 100644
index 0000000000..f645390a9b
--- /dev/null
+++ b/tools/tox.ini
@@ -0,0 +1,31 @@
+# Tox configuration file
+# Reference documentation: https://tox.readthedocs.org/
+
+[tox]
+envlist =
+ py{310}
+ dev
+skipsdist = true
+
+[testenv]
+passenv =
+ PIP_USER
+ PYTHONUSERBASE
+deps =
+ -r {toxinidir}/requirements-dev.txt
+commands =
+ -pytest -v -s -n auto -cache-clear --cov --cov-config=pyproject.toml --cov-reset --doctest-modules src/icon4pytools/
+ pytest -v -s -n auto --cov-config=pyproject.toml
+commands_post =
+ rm -rf tests/_reports/coverage_html
+ -coverage html
+ -coverage report
+allowlist_externals =
+ /bin/bash
+ rm
+
+[testenv:dev]
+basepython = python3.10
+skip_install = true
+commands =
+commands_post =
diff --git a/tox.ini b/tox.ini
index be707dcbb0..5c9ee6fd9d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -17,7 +17,7 @@ deps =
-r {toxinidir}/requirements-dev.txt
commands =
-pytest -v -s -n auto -cache-clear --cov --cov-reset --doctest-modules atm_dyn_iconam/src common/src pyutils/src testutils/src
- pytest -v -s -n auto --cov --cov-append
+ pytest -v -s -n auto --cov --cov-append --ignore=tools/
commands_post =
rm -Rf _reports/coverage_html
coverage html