Skip to content

Add Python 3.14 support, upgrade uv.lock#1197

Open
Copilot wants to merge 46 commits intomainfrom
copilot/update-locked-packages
Open

Add Python 3.14 support, upgrade uv.lock#1197
Copilot wants to merge 46 commits intomainfrom
copilot/update-locked-packages

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 15, 2026

Add compatibility for python 3.14. GitHub workflows test 3.10 and 3.13. The CSCS CI workflows test with 3.13.

Also updates the uv lock file, which updates a lot of packages. Among others, the new ruff version has more checks and changes formatting in a few places.

@jenkins-apn
Copy link
Copy Markdown

Hi there, this is jenkins continuous integration...
Do you want me to verify this patch?

1 similar comment
@jenkins-apn
Copy link
Copy Markdown

Hi there, this is jenkins continuous integration...
Do you want me to verify this patch?

Copilot AI linked an issue Apr 15, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Update locked packages and add Python 3.14 testing Add Python 3.14 POC coverage across GitHub and CSCS CI pipelines Apr 15, 2026
Copilot AI requested a review from msimberg April 15, 2026 09:43
@msimberg msimberg force-pushed the copilot/update-locked-packages branch from f524288 to 3056b8f Compare April 15, 2026 10:32
Agent-Logs-Url: https://github.com/C2SM/icon4py/sessions/1404233a-0a05-4f64-b64b-2f77e3871544

Co-authored-by: msimberg <42977+msimberg@users.noreply.github.com>
@msimberg
Copy link
Copy Markdown
Contributor

cscs-ci run default

@msimberg
Copy link
Copy Markdown
Contributor

cscs-ci run distributed

@msimberg msimberg requested a review from egparedes April 29, 2026 14:15
@msimberg msimberg marked this pull request as ready for review April 29, 2026 14:15
@msimberg
Copy link
Copy Markdown
Contributor

Exactly which versions to test and where is still an open question, but I think this might be ready for at least an initial review. @egparedes I requested one from you if you have time since I'm guessing you might be more familiar with different python versions. The biggest change comes from trying to use the new type keyword, which is not a must in this PR, but I've applied it where possible.

@msimberg
Copy link
Copy Markdown
Contributor

msimberg commented May 6, 2026

I got a bit overly excited with this PR. I'll make this PR focus on adding python 3.14 support and move the bump to 3.12 as minimum to a follow-up PR.

@msimberg msimberg changed the title Add Python 3.14 support and bump minimum version to 3.12 Add Python 3.14 support, upgrade uv.lock May 6, 2026
Comment thread tools/src/icon4py/tools/py2fgen/runtime_config.py Outdated
Comment thread tools/src/icon4py/tools/py2fgen/runtime_config.py
Comment thread tools/src/icon4py/tools/py2fgen/runtime_config.py
Co-authored-by: Mikael Simberg <mikael.simberg@iki.fi>
@msimberg
Copy link
Copy Markdown
Contributor

msimberg commented May 6, 2026

cscs-ci run default

@msimberg
Copy link
Copy Markdown
Contributor

msimberg commented May 7, 2026

cscs-ci run default

@msimberg
Copy link
Copy Markdown
Contributor

msimberg commented May 7, 2026

cscs-ci run distributed

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

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

msimberg commented May 7, 2026

cscs-ci run default

@msimberg
Copy link
Copy Markdown
Contributor

msimberg commented May 7, 2026

cscs-ci run distributed

Copy link
Copy Markdown
Contributor

@egparedes egparedes left a comment

Choose a reason for hiding this comment

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

Mostly nitpcking. LGTM

"""

import pymetis # type: ignore [import-untyped]
import pymetis # noqa: PLC0415
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.

Due to our coding conventions: https://github.com/C2SM/icon4py/blob/main/CODING_GUIDELINES.md#ignoring-qa-errors

Suggested change
import pymetis # noqa: PLC0415
import pymetis # noqa: PLC0415 [import-outside-top-level]


def init_mpi() -> None:
from mpi4py import MPI
from mpi4py import MPI # noqa: PLC0415
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.

Suggested change
from mpi4py import MPI # noqa: PLC0415
from mpi4py import MPI # noqa: PLC0415 [import-outside-top-level]


def finalize_mpi() -> None:
from mpi4py import MPI
from mpi4py import MPI # noqa: PLC0415
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.

Suggested change
from mpi4py import MPI # noqa: PLC0415
from mpi4py import MPI # noqa: PLC0415 [import-outside-top-level]

attrs = {}
dims = tuple(dimension_mapping(d, is_on_interface) for d in field.domain.dims)
horizontal_dim = next(filter(lambda d: _is_horizontal(d), field.domain.dims))
horizontal_dim = next(filter(_is_horizontal, field.domain.dims))
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.

Nitpicking, but list comprehensions are more idiomatic in python than map and filter

Suggested change
horizontal_dim = next(filter(_is_horizontal, field.domain.dims))
horizontal_dim = next(d for d in field.domain.dims if _is_horizontal(d))

Comment on lines +725 to +727
obj = self._func
while hasattr(obj, "__wrapped__") or isinstance(obj, functools.partial):
obj = getattr(obj, "__wrapped__", None) or obj.func
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.

Optional nitpicking, feel free to ignore

Suggested change
obj = self._func
while hasattr(obj, "__wrapped__") or isinstance(obj, functools.partial):
obj = getattr(obj, "__wrapped__", None) or obj.func
obj = inspect.unwrap(self._func)
while isinstance(obj, functools.partial):
obj = inspect.unwrap(obj.func)

)

from icon4py.model.common.decomposition.mpi_decomposition import init_mpi
from icon4py.model.common.decomposition.mpi_decomposition import init_mpi # noqa: PLC0415
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.

Suggested change
from icon4py.model.common.decomposition.mpi_decomposition import init_mpi # noqa: PLC0415
from icon4py.model.common.decomposition.mpi_decomposition import init_mpi # noqa: PLC0415 [import-outside-top-level]


def load_gt4py_timers(filename: pathlib.Path, metric: str) -> tuple[dict, dict]:
import numpy as np
import numpy as np # noqa: PLC0415
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.

Missing error codes in noqas

# if needed in the future.

from icon4py.model.testing import (
from icon4py.model.testing import ( # noqa: PLC0415
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.

Suggested change
from icon4py.model.testing import ( # noqa: PLC0415
from icon4py.model.testing import ( # noqa: PLC0415 [import-outside-top-level]

def get_validation_grids() -> list[definitions.GridDescription]:
from icon4py.model.testing import definitions # Import here to reduce startup time of the CLI
# Import here to reduce startup time of the CLI
from icon4py.model.testing import definitions # noqa: PLC0415
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.

Missing error codes in noqas

@pytest.fixture
def ffi():
import cffi
import cffi # noqa: PLC0415
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.

Missing error codes in noqas

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.

Update locked packages

5 participants