Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add icon4pygen namespace package #177

Merged
merged 1 commit into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ rst-roles =
py:obj, obj,

per-file-ignores =
pyutils/src/icon4py/pyutils/icochainsize.py:E800
pyutils/src/icon4py/icon4pygen/icochainsize.py:E800
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ repos:
- id: mypy
name: mypy static type checker
entry: |
mypy --install-types --non-interactive -p icon4py.common -p icon4py.pyutils -p icon4py.testutils
mypy --install-types --non-interactive -p icon4py.common -p icon4py.icon4pygen -p icon4py.testutils
language: system
types_or: [python, pyi]
always_run: true
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ 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 | pyutils | testutils | ...
cd _SUBPACKAGE_ # where _SUBPACKAGE_ in atm_dyn_iconam | common | icon4pygen | testutils | ...
pip install -r requirements-dev.txt
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from gt4py.next.type_system import type_specifications as ts

from icon4py.common.dimension import C2E2C, C2E2CDim, CellDim, KDim, Koff
from icon4py.pyutils.metadata import FieldInfo
from icon4py.icon4pygen.metadata import FieldInfo


@fundef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from gt4py.next.type_system import type_specifications as ts

from icon4py.common.dimension import E2C, CellDim, E2CDim, EdgeDim, KDim, Koff
from icon4py.pyutils.metadata import FieldInfo
from icon4py.icon4pygen.metadata import FieldInfo


@fundef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from gt4py.next.type_system import type_specifications as ts

from icon4py.common.dimension import E2C, CellDim, E2CDim, EdgeDim, KDim, Koff
from icon4py.pyutils.metadata import FieldInfo
from icon4py.icon4pygen.metadata import FieldInfo


@fundef
Expand Down
2 changes: 1 addition & 1 deletion liskov/src/icon4py/liskov/codegen/f90.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from gt4py.eve.codegen import JinjaTemplate as as_jinja
from gt4py.eve.codegen import TemplatedGenerator

from icon4py.bindings.utils import format_fortran_code
from icon4py.icon4pygen.bindings.utils import format_fortran_code
from icon4py.liskov.codegen.exceptions import UndeclaredFieldError
from icon4py.liskov.codegen.interface import (
CodeGenInput,
Expand Down
2 changes: 1 addition & 1 deletion liskov/src/icon4py/liskov/external/gt4py.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
from gt4py.next.ffront.decorator import Program
from typing_extensions import Any

from icon4py.icon4pygen.metadata import get_stencil_info
from icon4py.liskov.codegen.interface import DeserialisedDirectives
from icon4py.liskov.common import Step
from icon4py.liskov.external.exceptions import (
IncompatibleFieldError,
UnknownStencilError,
)
from icon4py.liskov.logger import setup_logger
from icon4py.pyutils.metadata import get_stencil_info


logger = setup_logger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion pyutils/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ exclude =

[options.entry_points]
console_scripts =
icon4pygen = icon4py.pyutils.icon4pygen:main
icon4pygen = icon4py.icon4pygen.cli:main
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
from gt4py.next.iterator import ir as itir
from gt4py.next.program_processors.codegens.gtfn.gtfn_backend import generate

from icon4py.bindings.utils import write_string
from icon4py.common.dimension import Koff
from icon4py.pyutils.exceptions import MultipleFieldOperatorException
from icon4py.pyutils.metadata import StencilInfo
from icon4py.icon4pygen.bindings.utils import write_string
from icon4py.icon4pygen.exceptions import MultipleFieldOperatorException
from icon4py.icon4pygen.metadata import StencilInfo


H_START = "horizontal_start"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from gt4py.eve.codegen import JinjaTemplate as as_jinja
from gt4py.eve.codegen import Node, TemplatedGenerator, format_source

from icon4py.bindings.codegen.header import (
from icon4py.icon4pygen.bindings.codegen.header import (
CppFreeFunc,
CppRunAndVerifyFuncDeclaration,
CppRunFuncDeclaration,
Expand All @@ -27,9 +27,11 @@
run_func_declaration,
run_verify_func_declaration,
)
from icon4py.bindings.codegen.render.offset import GpuTriMeshOffsetRenderer
from icon4py.bindings.entities import Field, Offset
from icon4py.bindings.utils import write_string
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


class CppDefGenerator(TemplatedGenerator):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
from gt4py.eve.codegen import JinjaTemplate as as_jinja
from gt4py.eve.codegen import TemplatedGenerator

from icon4py.bindings.entities import Field, Offset
from icon4py.bindings.utils import format_fortran_code, write_string
from icon4py.icon4pygen.bindings.entities import Field, Offset
from icon4py.icon4pygen.bindings.utils import format_fortran_code, write_string


_DOMAIN_ARGS = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
from gt4py.eve.codegen import JinjaTemplate as as_jinja
from gt4py.eve.codegen import TemplatedGenerator, format_source

from icon4py.bindings.entities import Field
from icon4py.bindings.utils import write_string
from icon4py.icon4pygen.bindings.entities import Field
from icon4py.icon4pygen.bindings.utils import write_string


run_func_declaration = as_jinja(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@

from dataclasses import dataclass

from icon4py.bindings.codegen.type_conversion import (
from icon4py.icon4pygen.bindings.codegen.type_conversion import (
BUILTIN_TO_CPP_TYPE,
BUILTIN_TO_ISO_C_TYPE,
)
from icon4py.bindings.codegen.types import FieldEntity
from icon4py.bindings.exceptions import BindingsRenderingException
from icon4py.icon4pygen.bindings.codegen.types import FieldEntity
from icon4py.icon4pygen.bindings.exceptions import BindingsRenderingException


@dataclass(frozen=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later

from icon4py.bindings.exceptions import BindingsRenderingException
from icon4py.icon4pygen.bindings.exceptions import BindingsRenderingException


class LocationRenderer:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
from dataclasses import dataclass
from typing import Sequence

from icon4py.bindings.codegen.types import OffsetEntity
from icon4py.bindings.locations import BasicLocation, ChainedLocation
from icon4py.icon4pygen.bindings.codegen.types import OffsetEntity
from icon4py.icon4pygen.bindings.locations import BasicLocation, ChainedLocation


@dataclass(frozen=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from gt4py.next.type_system import type_specifications as ts

from icon4py.bindings.locations import (
from icon4py.icon4pygen.bindings.locations import (
BasicLocation,
ChainedLocation,
CompoundLocation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@
from gt4py.next.ffront import program_ast as past
from gt4py.next.type_system import type_specifications as ts

from icon4py.bindings.codegen.render.field import FieldRenderer
from icon4py.bindings.codegen.render.offset import OffsetRenderer
from icon4py.bindings.codegen.types import FieldEntity, FieldIntent, OffsetEntity
from icon4py.bindings.exceptions import BindingsTypeConsistencyException
from icon4py.bindings.locations import (
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 (
BASIC_LOCATIONS,
BasicLocation,
Cell,
Expand All @@ -30,8 +36,8 @@
Edge,
Vertex,
)
from icon4py.bindings.utils import calc_num_neighbors
from icon4py.pyutils.metadata import FieldInfo
from icon4py.icon4pygen.bindings.utils import calc_num_neighbors
from icon4py.icon4pygen.metadata import FieldInfo


def chain_from_str(chain: list[str] | str) -> list[BasicLocation]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

from gt4py.next.ffront.fbuiltins import Dimension

from icon4py.bindings.codegen.render.location import LocationRenderer
from icon4py.common.dimension import CellDim, EdgeDim, VertexDim
from icon4py.icon4pygen.bindings.codegen.render.location import LocationRenderer


class BasicLocation:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from gt4py.next.common import Dimension

from icon4py.pyutils.icochainsize import IcoChainSize
from icon4py.icon4pygen.icochainsize import IcoChainSize


PYTHON_PATH = sys.executable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@

from pathlib import Path

from icon4py.bindings.codegen.cpp import generate_cpp_definition
from icon4py.bindings.codegen.f90 import generate_f90_file
from icon4py.bindings.codegen.header import generate_cpp_header
from icon4py.bindings.entities import Field, Offset
from icon4py.bindings.utils import check_dir_exists
from icon4py.pyutils.metadata import StencilInfo
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


class PyBindGen:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ def main(

outpath: represents a path to the folder in which to write all generated code.
"""
from icon4py.bindings.workflow import PyBindGen
from icon4py.pyutils.backend import GTHeader
from icon4py.pyutils.metadata import get_stencil_info, import_definition
from icon4py.icon4pygen.backend import GTHeader
from icon4py.icon4pygen.bindings.workflow import PyBindGen
from icon4py.icon4pygen.metadata import get_stencil_info, import_definition

fencil_def = import_definition(fencil)
stencil_info = get_stencil_info(fencil_def, is_global)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
from gt4py.next.type_system import type_specifications as ts

from icon4py.common.dimension import CellDim, EdgeDim, Koff, VertexDim
from icon4py.pyutils.exceptions import (
from icon4py.icon4pygen.exceptions import (
InvalidConnectivityException,
MultipleFieldOperatorException,
)
from icon4py.pyutils.icochainsize import IcoChainSize
from icon4py.icon4pygen.icochainsize import IcoChainSize


@dataclass(frozen=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import pytest
from gt4py.next.iterator import ir as itir

from icon4py.pyutils import backend
from icon4py.pyutils.backend import GTHeader
from icon4py.icon4pygen import backend
from icon4py.icon4pygen.backend import GTHeader


@pytest.mark.parametrize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from click.testing import CliRunner

import icon4py.atm_dyn_iconam
from icon4py.pyutils.icon4pygen import main
from icon4py.icon4pygen.cli import main
from icon4py.testutils.utils import get_stencil_module_path


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
from gt4py.next.ffront.decorator import field_operator, program
from gt4py.next.ffront.fbuiltins import Dimension, Field

from icon4py.bindings.codegen.render.location import LocationRenderer
from icon4py.bindings.entities import Offset, chain_from_str
from icon4py.bindings.exceptions import (
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 (
BindingsRenderingException,
BindingsTypeConsistencyException,
)
from icon4py.bindings.workflow import PyBindGen
from icon4py.common.dimension import EdgeDim, KDim
from icon4py.pyutils.metadata import get_stencil_info
from icon4py.icon4pygen.bindings.workflow import PyBindGen
from icon4py.icon4pygen.metadata import get_stencil_info


def test_invalid_offset():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
from gt4py.next.ffront.decorator import field_operator, program
from gt4py.next.ffront.fbuiltins import Field, neighbor_sum

from icon4py.bindings.workflow import PyBindGen
from icon4py.common.dimension import E2CDim, EdgeDim, KDim
from icon4py.pyutils.metadata import get_stencil_info
from icon4py.icon4pygen.bindings.workflow import PyBindGen
from icon4py.icon4pygen.metadata import get_stencil_info


def test_horizontal_field_sid_rendering():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

import pytest

from icon4py.pyutils.exceptions import InvalidConnectivityException
from icon4py.pyutils.metadata import provide_offset
from icon4py.icon4pygen.exceptions import InvalidConnectivityException
from icon4py.icon4pygen.metadata import provide_offset


@pytest.mark.parametrize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from gt4py.next.ffront.decorator import field_operator, program

from icon4py.common.dimension import CellDim, KDim
from icon4py.pyutils.metadata import _get_field_infos, provide_neighbor_table
from icon4py.icon4pygen.metadata import _get_field_infos, provide_neighbor_table


chain_false_skipvalues = [
Expand Down