Name | gt4py JSON |
Version |
1.0.9
JSON |
| download |
home_page | None |
Summary | Python library for generating high-performance implementations of stencil kernels for weather and climate modeling from a domain-specific language (DSL) |
upload_time | 2025-09-12 12:30:50 |
maintainer | None |
docs_url | None |
author | None |
requires_python | <3.14,>=3.10 |
license | None |
keywords |
gridtools
stencil
weather
climate
performance
portable
hpc
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
[](https://GridTools.github.io/gt4py)

[](https://join.slack.com/t/gridtools/shared_invite/zt-1mceuj747-59swuowC3MKAuCFyNAnc1g)
[](https://github.com/GridTools/gt4py/actions/workflows/daily-ci.yml)


[](https://github.com/astral-sh/uv)
[](https://github.com/wntrblm/nox)
# GT4Py: GridTools for Python
GT4Py is a Python library for generating high performance implementations of stencil kernels from a high-level definition using regular Python functions. GT4Py is part of the GridTools framework, a set of libraries and utilities to develop performance portable applications in the area of weather and climate modeling.
**NOTE:** The `gt4py.next` subpackage contains a new version of GT4Py which is not compatible with the current _stable_ version defined in `gt4py.cartesian`. The new version is still experimental.
## 📃 Description
GT4Py is a Python library for expressing computational motifs as found in weather and climate applications. These computations are expressed in a domain specific language (GTScript) which is translated to high-performance implementations for CPUs and GPUs.
The DSL expresses computations on a 3-dimensional Cartesian grid. The horizontal axes (`I`, `J`) are always computed in parallel, while the vertical (`K`) can be iterated in sequential, forward or backward, order. Cartesian offsets are expressed relative to a center index.
In addition, GT4Py provides functions to allocate arrays with memory layout suited for a particular backend.
The following backends are supported:
- `numpy`: Pure-Python backend
- `gt:cpu_ifirst`: GridTools C++ CPU backend using `I`-first data ordering
- `gt:cpu_kfirst`: GridTools C++ CPU backend using `K`-first data ordering
- `gt:gpu`: GridTools backend for CUDA
- `cuda`: CUDA backend minimally using utilities from GridTools
- `dace:cpu`: Dace code-generated CPU backend
- `dace:gpu`: Dace code-generated GPU backend
## 🚜 Installation
GT4Py can be installed as a regular Python package using [uv](https://docs.astral.sh/uv/), [pip](https://pip.pypa.io/en/stable/) or any other PEP-517 compatible frontend. We strongly recommended to use`uv` to create and manage virtual environments for your own projects.
## ⚙ Configuration
Other useful available environment variables are:
- `CUDA_ARCH`: Set the compute capability of the NVIDIA GPU if it is not detected automatically by `cupy`.
- `CXX`: Set the C++ compiler.
- `GT_CACHE_DIR_NAME`: Name of the compiler's cache directory (defaults to `.gt_cache`)
- `GT_CACHE_ROOT`: Path to the compiler cache (defaults to `./`)
More options and details are available in [`config.py`](https://github.com/GridTools/gt4py/blob/main/src/gt4py/cartesian/config.py).
## 🛠 Development Instructions
Follow the installation instructions below to initialize a development virtual environment containing an _editable_ installation of the GT4Py package. Make sure you read the [CONTRIBUTING.md](CONTRIBUTING.md) and [CODING_GUIDELINES.md](CODING_GUIDELINES.md) documents before you start working on the project.
### Development Environment Installation using `uv`
GT4Py uses the [`uv`](https://docs.astral.sh/uv/) project manager for the development workflow. `uv` is a versatile tool that consolidates functionality usually distributed across different applications into subcommands.
- The `uv pip` subcommand provides a _fast_ Python package manager, emulating [`pip`](https://pip.pypa.io/en/stable/).
- The `uv export | lock | sync` subcommands manage dependency versions in a manner similar to the [`pip-tools`](https://pip-tools.readthedocs.io/en/stable/) command suite.
- The `uv init | add | remove | build | publish | ...` subcommands facilitate project development workflows, akin to [`hatch`](https://hatch.pypa.io/latest/).
- The `uv tool` subcommand serves as a runner for Python applications in isolation, similar to [`pipx`](https://pipx.pypa.io/stable/).
- The `uv python` subcommands manage different Python installations and versions, much like [`pyenv`](https://github.com/pyenv/pyenv).
We require a reasonably recent version of `uv`, which can be installed in various ways (see its [installation instructions](https://docs.astral.sh/uv/getting-started/installation/)), with the recommended method being the standalone installer:
```bash
$ curl -LsSf https://astral.sh/uv/install.sh | sh
```
Once `uv` is installed in your system, it is enough to clone this repository and let `uv` handling the installation of the development environment.
```bash
# Clone the repository
git clone https://github.com/gridtools/gt4py.git
cd gt4py
# Let uv create the development environment at `.venv`.
uv sync --extra cartesian # for gt4py.cartesian. Include DaCe with: --group dace-cartesian
uv sync --extra next # for gt4py.next. Include DaCe with: --group dace-next
# The `--extra cartesian` (or `--extra next`) option tells uv to install
# the optional run-time dependencies of gt4py.cartesian (or gt4py.next),
# and thus it is not strictly necessary.
# The 'dev' group with the core development dependencies is installed by default.
# DaCe-related dependencies are different for gt4py.cartesian and gt4py.next,
# so they won't be installed unless the specific dace group option is added.
# Finally, activate the virtual environment and start writing code!
source .venv/bin/activate
```
The newly created _venv_ is a standard Python virtual environment preconfigured with all necessary runtime and development dependencies. Additionally, the `gt4py` package is installed in editable mode, allowing for seamless development and testing. To install new packages in this environment, use the `uv pip` subcommand which emulates the `pip` interface and is generally much faster than the original `pip` tool (which is also available within the venv although its use is discouraged).
The `pyproject.toml` file contains both the definition of the `gt4py` Python distribution package and the settings of the development tools used in this project, most notably `uv`, `ruff`, and `mypy`. It also contains _dependency groups_ (see [PEP 735](https://peps.python.org/pep-0735/) for further reference) with the development requirements listed in different groups (`build`, `docs`, `lint`, `test`, `typing`, ...) and collected together in the general `dev` group, which gets installed by default by `uv` as mentioned above.
### Development Tasks (`/scripts`)
Recurrent development tasks like bumping versions of used development tools or required third party dependencies have been collected as separate modules in the `/scripts` folder, and collected as subcommands of the [`scripts-cli.py`](./scripts-cli.py) tool. Read the tool help for a brief description of every task and always use this tool to update the versions and sync the version configuration across different files (e.g. `pyproject.toml` and `.pre-commit-config.yaml`).
## 📖 Documentation
GT4Py uses the Sphinx tool for the documentation. To build browseable HTML documentation, install the required tools provided in the `docs` dependency group:
```bash
uv sync --group docs --extra standard # or --group dev
```
(Note that most likely these tools are already installed in your development environment, since the `docs` group is included in the `dev` group, which installed by default by `uv sync` if no dependency groups are specified.)
Once the requirements are already installed, then build the docs using:
```bash
cd gt4py/docs/user/cartesian
make html # run 'make help' for a list of targets
```
## ⚖️ License
GT4Py is licensed under the terms of the [BSD-3-Clause](https://github.com/GridTools/gt4py/blob/main/LICENSE.txt).
Raw data
{
"_id": null,
"home_page": null,
"name": "gt4py",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.14,>=3.10",
"maintainer_email": null,
"keywords": "gridtools, stencil, weather, climate, performance, portable, hpc",
"author": null,
"author_email": "ETH Zurich <gridtools@cscs.ch>",
"download_url": "https://files.pythonhosted.org/packages/a9/1c/2577d3b2380dc3e5451432a96de730ce4fdf4b602f63b9b989d0373f9ed4/gt4py-1.0.9.tar.gz",
"platform": "Linux",
"description": "[](https://GridTools.github.io/gt4py)\n\n\n[](https://join.slack.com/t/gridtools/shared_invite/zt-1mceuj747-59swuowC3MKAuCFyNAnc1g)\n\n[](https://github.com/GridTools/gt4py/actions/workflows/daily-ci.yml)\n\n\n\n[](https://github.com/astral-sh/uv)\n[](https://github.com/wntrblm/nox)\n\n# GT4Py: GridTools for Python\n\nGT4Py is a Python library for generating high performance implementations of stencil kernels from a high-level definition using regular Python functions. GT4Py is part of the GridTools framework, a set of libraries and utilities to develop performance portable applications in the area of weather and climate modeling.\n\n**NOTE:** The `gt4py.next` subpackage contains a new version of GT4Py which is not compatible with the current _stable_ version defined in `gt4py.cartesian`. The new version is still experimental.\n\n## \ud83d\udcc3 Description\n\nGT4Py is a Python library for expressing computational motifs as found in weather and climate applications. These computations are expressed in a domain specific language (GTScript) which is translated to high-performance implementations for CPUs and GPUs.\n\nThe DSL expresses computations on a 3-dimensional Cartesian grid. The horizontal axes (`I`, `J`) are always computed in parallel, while the vertical (`K`) can be iterated in sequential, forward or backward, order. Cartesian offsets are expressed relative to a center index.\n\nIn addition, GT4Py provides functions to allocate arrays with memory layout suited for a particular backend.\n\nThe following backends are supported:\n\n- `numpy`: Pure-Python backend\n- `gt:cpu_ifirst`: GridTools C++ CPU backend using `I`-first data ordering\n- `gt:cpu_kfirst`: GridTools C++ CPU backend using `K`-first data ordering\n- `gt:gpu`: GridTools backend for CUDA\n- `cuda`: CUDA backend minimally using utilities from GridTools\n- `dace:cpu`: Dace code-generated CPU backend\n- `dace:gpu`: Dace code-generated GPU backend\n\n## \ud83d\ude9c Installation\n\nGT4Py can be installed as a regular Python package using [uv](https://docs.astral.sh/uv/), [pip](https://pip.pypa.io/en/stable/) or any other PEP-517 compatible frontend. We strongly recommended to use`uv` to create and manage virtual environments for your own projects.\n\n## \u2699 Configuration\n\nOther useful available environment variables are:\n\n- `CUDA_ARCH`: Set the compute capability of the NVIDIA GPU if it is not detected automatically by `cupy`.\n- `CXX`: Set the C++ compiler.\n- `GT_CACHE_DIR_NAME`: Name of the compiler's cache directory (defaults to `.gt_cache`)\n- `GT_CACHE_ROOT`: Path to the compiler cache (defaults to `./`)\n\nMore options and details are available in [`config.py`](https://github.com/GridTools/gt4py/blob/main/src/gt4py/cartesian/config.py).\n\n## \ud83d\udee0 Development Instructions\n\nFollow the installation instructions below to initialize a development virtual environment containing an _editable_ installation of the GT4Py package. Make sure you read the [CONTRIBUTING.md](CONTRIBUTING.md) and [CODING_GUIDELINES.md](CODING_GUIDELINES.md) documents before you start working on the project.\n\n### Development Environment Installation using `uv`\n\nGT4Py uses the [`uv`](https://docs.astral.sh/uv/) project manager for the development workflow. `uv` is a versatile tool that consolidates functionality usually distributed across different applications into subcommands.\n\n- The `uv pip` subcommand provides a _fast_ Python package manager, emulating [`pip`](https://pip.pypa.io/en/stable/).\n- The `uv export | lock | sync` subcommands manage dependency versions in a manner similar to the [`pip-tools`](https://pip-tools.readthedocs.io/en/stable/) command suite.\n- The `uv init | add | remove | build | publish | ...` subcommands facilitate project development workflows, akin to [`hatch`](https://hatch.pypa.io/latest/).\n- The `uv tool` subcommand serves as a runner for Python applications in isolation, similar to [`pipx`](https://pipx.pypa.io/stable/).\n- The `uv python` subcommands manage different Python installations and versions, much like [`pyenv`](https://github.com/pyenv/pyenv).\n\nWe require a reasonably recent version of `uv`, which can be installed in various ways (see its [installation instructions](https://docs.astral.sh/uv/getting-started/installation/)), with the recommended method being the standalone installer:\n\n```bash\n$ curl -LsSf https://astral.sh/uv/install.sh | sh\n```\n\nOnce `uv` is installed in your system, it is enough to clone this repository and let `uv` handling the installation of the development environment.\n\n```bash\n# Clone the repository\ngit clone https://github.com/gridtools/gt4py.git\ncd gt4py\n\n# Let uv create the development environment at `.venv`.\nuv sync --extra cartesian # for gt4py.cartesian. Include DaCe with: --group dace-cartesian\nuv sync --extra next # for gt4py.next. Include DaCe with: --group dace-next\n\n# The `--extra cartesian` (or `--extra next`) option tells uv to install\n# the optional run-time dependencies of gt4py.cartesian (or gt4py.next),\n# and thus it is not strictly necessary.\n# The 'dev' group with the core development dependencies is installed by default.\n# DaCe-related dependencies are different for gt4py.cartesian and gt4py.next,\n# so they won't be installed unless the specific dace group option is added.\n\n# Finally, activate the virtual environment and start writing code!\nsource .venv/bin/activate\n```\n\nThe newly created _venv_ is a standard Python virtual environment preconfigured with all necessary runtime and development dependencies. Additionally, the `gt4py` package is installed in editable mode, allowing for seamless development and testing. To install new packages in this environment, use the `uv pip` subcommand which emulates the `pip` interface and is generally much faster than the original `pip` tool (which is also available within the venv although its use is discouraged).\n\nThe `pyproject.toml` file contains both the definition of the `gt4py` Python distribution package and the settings of the development tools used in this project, most notably `uv`, `ruff`, and `mypy`. It also contains _dependency groups_ (see [PEP 735](https://peps.python.org/pep-0735/) for further reference) with the development requirements listed in different groups (`build`, `docs`, `lint`, `test`, `typing`, ...) and collected together in the general `dev` group, which gets installed by default by `uv` as mentioned above.\n\n### Development Tasks (`/scripts`)\n\nRecurrent development tasks like bumping versions of used development tools or required third party dependencies have been collected as separate modules in the `/scripts` folder, and collected as subcommands of the [`scripts-cli.py`](./scripts-cli.py) tool. Read the tool help for a brief description of every task and always use this tool to update the versions and sync the version configuration across different files (e.g. `pyproject.toml` and `.pre-commit-config.yaml`).\n\n## \ud83d\udcd6 Documentation\n\nGT4Py uses the Sphinx tool for the documentation. To build browseable HTML documentation, install the required tools provided in the `docs` dependency group:\n\n```bash\nuv sync --group docs --extra standard # or --group dev\n```\n\n(Note that most likely these tools are already installed in your development environment, since the `docs` group is included in the `dev` group, which installed by default by `uv sync` if no dependency groups are specified.)\n\nOnce the requirements are already installed, then build the docs using:\n\n```bash\ncd gt4py/docs/user/cartesian\nmake html # run 'make help' for a list of targets\n```\n\n## \u2696\ufe0f License\n\nGT4Py is licensed under the terms of the [BSD-3-Clause](https://github.com/GridTools/gt4py/blob/main/LICENSE.txt).\n",
"bugtrack_url": null,
"license": null,
"summary": "Python library for generating high-performance implementations of stencil kernels for weather and climate modeling from a domain-specific language (DSL)",
"version": "1.0.9",
"project_urls": {
"Documentation": "https://gridtools.github.io/gt4py",
"Homepage": "https://gridtools.github.io/",
"Repository": "https://github.com/GridTools/gt4py"
},
"split_keywords": [
"gridtools",
" stencil",
" weather",
" climate",
" performance",
" portable",
" hpc"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "52bce49d6dfc6169ea10dc10ed723b281aa841d7c644297c95a427455317638a",
"md5": "ea5f7198cc8660da999812a2d67baf64",
"sha256": "1ef45657dd470e77bbe0f5cc9bf3c17493efc0df498ee74897069b2cbf6ac9cb"
},
"downloads": -1,
"filename": "gt4py-1.0.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ea5f7198cc8660da999812a2d67baf64",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.14,>=3.10",
"size": 925459,
"upload_time": "2025-09-12T12:30:48",
"upload_time_iso_8601": "2025-09-12T12:30:48.731340Z",
"url": "https://files.pythonhosted.org/packages/52/bc/e49d6dfc6169ea10dc10ed723b281aa841d7c644297c95a427455317638a/gt4py-1.0.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a91c2577d3b2380dc3e5451432a96de730ce4fdf4b602f63b9b989d0373f9ed4",
"md5": "c5f0e469160c18b94ab489c7ae922427",
"sha256": "8b7d1eab14b1d093d1db943de8d8a759e9b979464892533d31c9ff9d6abc53ca"
},
"downloads": -1,
"filename": "gt4py-1.0.9.tar.gz",
"has_sig": false,
"md5_digest": "c5f0e469160c18b94ab489c7ae922427",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.14,>=3.10",
"size": 724634,
"upload_time": "2025-09-12T12:30:50",
"upload_time_iso_8601": "2025-09-12T12:30:50.244212Z",
"url": "https://files.pythonhosted.org/packages/a9/1c/2577d3b2380dc3e5451432a96de730ce4fdf4b602f63b9b989d0373f9ed4/gt4py-1.0.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-12 12:30:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "GridTools",
"github_project": "gt4py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "gt4py"
}