Skip to content

Bump minimum supported python to 3.12#1248

Open
msimberg wants to merge 58 commits into
C2SM:mainfrom
msimberg:bump-python-3-12
Open

Bump minimum supported python to 3.12#1248
msimberg wants to merge 58 commits into
C2SM:mainfrom
msimberg:bump-python-3-12

Conversation

@msimberg

@msimberg msimberg commented May 6, 2026

Copy link
Copy Markdown
Contributor

As a follow-up to #1197 which adds support for python 3.14, this bumps the minimum version to 3.12 and applies some modernizations along the way.

Copilot AI and others added 30 commits April 15, 2026 09:31
Agent-Logs-Url: https://github.com/C2SM/icon4py/sessions/1404233a-0a05-4f64-b64b-2f77e3871544

Co-authored-by: msimberg <42977+msimberg@users.noreply.github.com>
…-packages

# Conflicts:
#	model/common/src/icon4py/model/common/decomposition/halo.py
#	model/common/tests/common/decomposition/unit_tests/test_halo.py
#	model/common/tests/common/grid/mpi_tests/test_parallel_grid_manager.py
#	model/common/tests/common/grid/mpi_tests/test_parallel_grid_refinement.py
#	model/common/tests/common/grid/unit_tests/test_grid_manager.py
Instead of raising TypeError, an empty dict is returned with python 3.14.
@msimberg

Copy link
Copy Markdown
Contributor Author

cscs-ci run default

@github-actions

Copy link
Copy Markdown

Mandatory Tests

Please make sure you run these tests via comment before you merge!

  • cscs-ci run default
  • cscs-ci run distributed

Optional Tests

To run benchmarks you can use:

  • cscs-ci run benchmark-bencher

To run tests and benchmarks with the DaCe backend you can use:

  • cscs-ci run dace

To run test levels ignored by the default test suite (mostly simple datatest for static fields computations) you can use:

  • cscs-ci run extra

For more detailed information please look at CI in the EXCLAIM universe.

@msimberg

Copy link
Copy Markdown
Contributor Author

cscs-ci run default

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR raises the project’s minimum supported Python version to 3.12 and modernizes the codebase to take advantage of Python 3.12+ typing and stdlib features, while updating CI/test configuration to match.

Changes:

  • Bump requires-python across workspace packages to >=3.12, update .python-version, and adjust GitHub Actions matrices accordingly.
  • Modernize typing/code style (PEP 695 generics, type aliases, enum.StrEnum, stdlib Buffer/Required) and align Ruff’s target version to py312.
  • Minor formatting/cleanup adjustments in scripts and CI YAML.

Reviewed changes

Copilot reviewed 53 out of 54 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/src/icon4py/tools/py2fgen/runtime_config.py Switch to PEP 695 generic syntax for enum env parsing helper.
tools/src/icon4py/tools/py2fgen/_export.py Handle TypeAliasType and migrate TypeAlias declarations to type statements.
tools/src/icon4py/tools/py2fgen/_definitions.py Update type alias style (type statements) and add UP040 suppressions where needed.
tools/src/icon4py/tools/py2fgen/_conversion.py Remove a previous overload type-ignore around np.frombuffer(...).reshape(...).
tools/pyproject.toml Bump minimum Python to 3.12 and update classifiers.
scripts/python/test_conventions.py Convert TypeAlias to type statement for fixture location.
scripts/python/helpers/pyproject.py Minor formatting cleanup.
scripts/python/compare_icon4py_openacc.py Convert TypeAlias to type statement for variant descriptor.
pyproject.toml Bump minimum Python to 3.12 and set Ruff target-version = py312.
noxfile.py Update parameter-set typing to type aliases and adjust how args are extracted; drop 3.10/3.11 from supported versions list.
model/testing/src/icon4py/model/testing/test_utils.py Use stdlib Buffer and remove a type ignore in fingerprint_buffer.
model/testing/src/icon4py/model/testing/serialbox.py Convert TypeAlias to type statements for Literal index aliases.
model/testing/src/icon4py/model/testing/filters.py Convert predicate alias to PEP 695 generic type.
model/testing/pyproject.toml Bump minimum Python to 3.12 and drop typing-extensions dependency.
model/standalone_driver/tests/standalone_driver/integration_tests/test_standalone_driver.py Use datetime.UTC for tzinfo.
model/standalone_driver/src/icon4py/model/standalone_driver/config.py Add UP040 suppressions to keep TypeAlias where desired.
model/standalone_driver/pyproject.toml Bump minimum Python to 3.12.
model/driver/src/icon4py/model/driver/initialization_utils.py Switch enums to enum.StrEnum.
model/driver/pyproject.toml Bump minimum Python to 3.12.
model/common/tests/common/grid/unit_tests/test_simple.py Adjust exception handling line (removes a PERF203 suppression).
model/common/src/icon4py/model/common/utils/fortran_config.py Convert TypeVar-based generics to PEP 695 generic functions.
model/common/src/icon4py/model/common/utils/device_utils.py Convert synchronized_function typing to PEP 695 generics.
model/common/src/icon4py/model/common/utils/data_allocation.py Convert some aliases to type statements and use PEP 695 generic function syntax.
model/common/src/icon4py/model/common/utils/_common.py Simplify typing imports and convert some generics to PEP 695 syntax.
model/common/src/icon4py/model/common/type_alias.py Convert anyfloat alias to type statement and add UP040 suppression where needed.
model/common/src/icon4py/model/common/states/utils.py Add UP040 suppressions for TypeAlias uses.
model/common/src/icon4py/model/common/states/model.py Convert multiple TypeAlias declarations to type statements.
model/common/src/icon4py/model/common/model_backends.py Convert backend aliases to type statements; retain runtime TypeAlias where used with isinstance().
model/common/src/icon4py/model/common/io/writers.py Use stdlib typing.Required instead of typing_extensions.
model/common/src/icon4py/model/common/io/io.py Switch enum to enum.StrEnum.
model/common/src/icon4py/model/common/grid/gridfile.py Switch enum to enum.StrEnum.
model/common/src/icon4py/model/common/grid/grid_manager.py Convert TypeAlias declarations to type statements.
model/common/src/icon4py/model/common/field_type_aliases.py Add UP040 suppressions for TypeAlias uses.
model/common/src/icon4py/model/common/decomposition/definitions.py Convert stream-like alias to type statement.
model/common/pyproject.toml Bump minimum Python to 3.12 and drop typing-extensions dependency.
model/atmosphere/subgrid_scale_physics/muphys/pyproject.toml Bump minimum Python to 3.12.
model/atmosphere/subgrid_scale_physics/microphysics/pyproject.toml Bump minimum Python to 3.12.
model/atmosphere/dycore/pyproject.toml Bump minimum Python to 3.12.
model/atmosphere/diffusion/pyproject.toml Bump minimum Python to 3.12.
model/atmosphere/advection/pyproject.toml Bump minimum Python to 3.12.
ci/benchmark_bencher_baseline.yml Minor formatting (blank line).
ci/base.yml Minor formatting (blank line).
bindings/src/icon4py/bindings/muphys_wrapper.py Add a targeted type: ignore[arg-type] for graupel.Q(...).
bindings/src/icon4py/bindings/grid_wrapper.py Convert annotated array aliases to type statements.
bindings/src/icon4py/bindings/dycore_wrapper.py Convert annotated array aliases to type statements.
bindings/src/icon4py/bindings/common.py Convert many annotated array aliases to type statements.
bindings/pyproject.toml Bump minimum Python to 3.12.
.python-version Set default dev Python version to 3.12.
.github/workflows/icon4py-test-tools-and-bindings.yml Update CI Python matrix to 3.12/3.13/3.14.
.github/workflows/icon4py-test-model.yml Update CI Python matrix to 3.12/3.13/3.14.
.github/workflows/deploy-docs.yml Use Python 3.12 for docs build job.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 47 to +51
_P = ParamSpec("_P")
_R = TypeVar("_R")


def synchronized_function(
func: Callable[_P, _R], *, allocator: gtx_typing.Allocator | None
) -> Callable[_P, _R]:
def synchronized_function[**P, R](
Comment on lines +120 to 122
type OptionalFloat64Array2D = Annotated[
data_alloc.NDArray,
py2fgen.ArrayParamDescriptor(
domain = h_grid.domain(dim)(z)
yield domain
except AssertionError: # noqa: PERF203
except AssertionError:
@msimberg msimberg requested a review from egparedes June 24, 2026 09:59
@msimberg msimberg marked this pull request as ready for review June 24, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants