build: update uv lock file - #2746
Conversation
Refresh all locked dependencies via `uv lock --upgrade`. 110 packages updated, 4 added, 6 removed. Notable: mypy 1.19.1 -> 2.3.0, ruff 0.15.7 -> 0.16.1, numpy 2.4.3 -> 2.5.1, jax 0.9.2 -> 0.11.0, setuptools 82 -> 83, scipy 1.17.1 -> 1.18.0, cupy 14.0.1 -> 14.1.1. dace and pybind11 unchanged.
Fallout from the lock update; `pre-commit run -a` was red without it. ruff 0.16: - reorder `Union[None, X]` to put `None` last - parenthesize implicit string concatenations inside collection literals - drop the duplicate `FieldOffset` entry in `gt4py.next.__all__` - drop the duplicate `TYPE_CHECKING` import of `gtir_to_sdfg` in `gtir_to_sdfg_primitives` - drop a trailing comma that made an assert message a 1-tuple in `iterator/type_system/inference` - reformat code blocks in six ADRs (ruff 0.16 formats markdown code blocks) mypy 2.3: - remove `type: ignore`s that are now unused, including the ones waiting on python/mypy#20573 - remove casts that are redundant after the preceding `isinstance` - `Metric.mean`/`std` return `float`, matching the numpy 2.5 stubs - `compiler_cxx` is not declared on the `CCompiler` base class
There was a problem hiding this comment.
🟡 Not ready to approve
Metric.mean/Metric.std are now annotated as float but still return NumPy scalar values at runtime, so the implementation should be aligned with the updated public type contract.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR refreshes the project’s locked dependency set via uv lock --upgrade and applies the necessary mechanical source updates to keep the codebase green under the bumped QA toolchain (notably ruff 0.16 and mypy 2.3) across gt4py.next, gt4py.eve, and cartesian components.
Changes:
- Updated typing to satisfy new mypy/ruff expectations (e.g.,
Union[..., None]ordering, removed now-redundantcast()/type: ignoreusages, and minor control-flow restructuring for narrowing). - Fixed a correctness bug in an
assertmessage that was accidentally a 1-tuple due to a trailing comma. - Applied ruff-driven formatting updates across code and several ADR Markdown files.
File summaries
| File | Description |
|---|---|
| src/gt4py/next/utils.py | Restructures tree_map internals to preserve type-narrowing with variable collection_type. |
| src/gt4py/next/type_system/type_info.py | Removes redundant cast() after isinstance() narrowing. |
| src/gt4py/next/program_processors/runners/dace/transformations/splitting_tools.py | Reorders Union return type annotation for ruff typing rule compliance. |
| src/gt4py/next/program_processors/runners/dace/transformations/single_state_global_self_copy_elimination.py | Reorders several Union return type annotations for ruff typing rule compliance. |
| src/gt4py/next/program_processors/runners/dace/transformations/multi_state_global_self_copy_elimination.py | Reorders Union annotations (including local var) for ruff typing rule compliance. |
| src/gt4py/next/program_processors/runners/dace/transformations/local_double_buffering.py | Normalizes optional return type annotation ordering (`T |
| src/gt4py/next/program_processors/runners/dace/transformations/gpu_utils.py | Normalizes optional local variable type annotation ordering. |
| src/gt4py/next/program_processors/runners/dace/transformations/concat_where_mapper.py | Normalizes optional local variable type annotation ordering. |
| src/gt4py/next/program_processors/runners/dace/lowering/gtir_to_sdfg_primitives.py | Removes redundant TYPE_CHECKING import now that runtime import is used. |
| src/gt4py/next/otf/compiled_program.py | Normalizes TypeAlias optional ordering (`str |
| src/gt4py/next/otf/arguments.py | Removes redundant cast() on a branch already narrowed by isinstance(). |
| src/gt4py/next/iterator/type_system/inference.py | Fixes assert message accidentally becoming a tuple (trailing comma removal). |
| src/gt4py/next/iterator/transforms/inline_dynamic_shifts.py | Normalizes optional return type annotation ordering (`T |
| src/gt4py/next/iterator/transforms/global_tmps.py | Removes now-unused type: ignore in a set operation per updated mypy behavior. |
| src/gt4py/next/iterator/ir_utils/domain_utils.py | Removes now-unnecessary type: ignore after mypy improvements. |
| src/gt4py/next/instrumentation/metrics.py | Updates Metric.mean/std return annotations and removes now-unneeded mypy ignores on dataclasses. |
| src/gt4py/next/ffront/type_info.py | Removes redundant type: ignore after prior conditional checks. |
| src/gt4py/next/ffront/func_to_foast.py | Parenthesizes implicit string concatenation inside list literal for ruff rule compliance. |
| src/gt4py/next/ffront/foast_to_gtir.py | Removes redundant cast() usage and the now-unused import. |
| src/gt4py/next/ffront/foast_passes/type_deduction.py | Parenthesizes implicit string concatenation and adjusts narrowing assignment for mypy. |
| src/gt4py/next/ffront/fbuiltins.py | Removes redundant cast() in scalar-preserving fallback _gamma. |
| src/gt4py/next/ffront/dialect_parser.py | Parenthesizes implicit string concatenation inside tuple literal for ruff compliance. |
| src/gt4py/next/ffront/decorator.py | Normalizes optional union ordering in a public API signature. |
| src/gt4py/next/common.py | Removes redundant cast() after isinstance() narrowing in Dimension.__eq__. |
| src/gt4py/next/init.py | Removes duplicate FieldOffset entry from __all__. |
| src/gt4py/eve/pattern_matching.py | Parenthesizes implicit string concatenation in yielded error messages. |
| src/gt4py/eve/datamodels/core.py | Normalizes optional union ordering in attribute annotations and __init_subclass__ signature. |
| src/gt4py/cartesian/utils/compiler.py | Adds a targeted type: ignore[attr-defined] for a runtime attribute that is not on the base type. |
| src/gt4py/cartesian/frontend/gtscript_frontend.py | Normalizes optional union ordering in a helper signature. |
| scripts/python/dace_determinism.py | Parenthesizes implicit string concatenation in a list literal for ruff compliance. |
| docs/development/ADRs/next/0013-Scalar_vs_0d_Fields.md | Ruff markdown formatting adjustments (blank lines). |
| docs/development/ADRs/cartesian/frontend/round-functions.md | Ruff markdown formatting adjustments (code formatting and wrapped ValueError). |
| docs/development/ADRs/cartesian/frontend/lazy-functions.md | Ruff markdown formatting adjustments (blank line). |
| docs/development/ADRs/cartesian/experimental/runtime-intervals.md | Ruff markdown formatting adjustments (code formatting). |
| docs/development/ADRs/cartesian/experimental/iteration-index-k.md | Ruff markdown formatting adjustments (blank lines). |
| docs/development/ADRs/cartesian/experimental/indexing-absolute-k.md | Ruff markdown formatting adjustments (wrapped function signature). |
Review details
Suppressed comments (1)
src/gt4py/next/instrumentation/metrics.py:101
Metric.stdis annotated asfloatbut returnsnp.std(...), which usually produces anumpyscalar (np.float64) at runtime. If the intent is afloatAPI (per the new type), cast the result tofloatto keep the runtime value consistent with the annotation.
def std(self) -> float:
if len(self.samples) == 0:
raise ValueError("Cannot compute std of empty sample list.")
return np.std(self.samples, ddof=1)
- Files reviewed: 35/37 changed files
- Comments generated: 1
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
| def mean(self) -> float: | ||
| if len(self.samples) == 0: | ||
| raise ValueError("Cannot compute mean of empty sample list.") | ||
| return np.mean(self.samples) | ||
|
|
There was a problem hiding this comment.
Not taking this one — the premise doesn't hold. np.float64 is a subclass of Python float:
>>> issubclass(np.float64, float)
True
>>> type(np.mean([1.0, 2.0]))
<class 'numpy.float64'>So the value returned at runtime already satisfies the float annotation; there is no divergence between the contract and the implementation. -> float is also exactly what the numpy 2.5 stubs declare for np.mean over a list[float], which is why mypy 2.3 rejected the previous np.floating annotation in the first place.
The float(metric.mean) calls in the tests are defensive, not a workaround for a mismatch.
The one case that would break the annotation is a np.float32 sample, since that is not a float subclass. But no such path exists: every producer passes a Python float — runners/gtfn.py passes exec_info["run_cpp_duration"], dace's workflow/decoration.py passes collect_time_arg[0].item(), and compute_metric has no implementations beyond the timing collectors. Adding a conversion here would be dead weight in a dependency-bump PR.
mypy 2.3 reports every per-module override the current invocation did not reach, so the note fires on any partial run: `mypy src/` never reaches the `typing_tests.*` section and the `typing_tests` suite never reaches the cartesian ones. It lands in mypy's output and breaks the exact-output assertions of all 16 cases in `typing_tests/`.
| # `warn_unused_configs` reports every override that the current invocation did not | ||
| # reach, so it fires on any partial run: `mypy src/` never reaches the | ||
| # `typing_tests.*` sections, and the `typing_tests` suite never reaches the | ||
| # cartesian ones. The note is part of mypy's output, which breaks the exact-output | ||
| # assertions in `typing_tests/`. | ||
| warn_unused_configs = false |
There was a problem hiding this comment.
Can you double-check this @egparedes (it's responsible for the failure in the typing tests before this was added). All the other changes look good to me.
|
Mainly did this version bump because we lock a package with security issue (according to dependabot), so I bumped everything. |
There was a problem hiding this comment.
🟡 Human review recommended
It performs a broad dependency lock refresh (including major scientific/QA tool bumps) whose downstream behavioral impact can’t be fully validated from the localized fix-up diffs alone.
Review details
- Files reviewed: 36/38 changed files
- Comments generated: 0 new
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
Refresh all locked dependencies via
uv lock --upgrade: 110 packages updated, 4 added, 6 removed.Notable moves:
mypy 1.19.1 -> 2.3.0,ruff 0.15.7 -> 0.16.1,numpy 2.4.3 -> 2.5.1,jax 0.9.2 -> 0.11.0,setuptools 82 -> 83,scipy 1.17.1 -> 1.18.0,cupy 14.0.1 -> 14.1.1,xarray 2026.2.0 -> 2026.7.0.daceandpybind11are unchanged.The two QA tools are major bumps and turned
pre-commit run -ared, so the second commit adapts the sources.ruff 0.16
New/expanded rules produced 31 errors on a previously clean tree:
Union[None, X]reordered to putNonelastFieldOffsetwas listed twice ingt4py.next.__all__gtir_to_sdfgwas imported both at module level and underTYPE_CHECKINGingtir_to_sdfg_primitivesiterator/type_system/inferencemade an assert message a 1-tuple instead of a stringruff 0.16 also formats code blocks inside markdown, which reformats six ADRs. CI runs
pre-commit --all-files, so this is required rather than optional.mypy 2.3
18 errors:
type: ignores are now unused, including four ininstrumentation/metrics.pythat explicitly waited on Fix slots issue with deferred base python/mypy#20573, which 2.3 shipsisinstance(three of them already carried a comment saying the cast shouldn't be needed)Metric.mean/Metric.stdreturnfloatto match the numpy 2.5 stubs; at runtime these were and remainnp.float64, and the only callers format them or wrap them infloat()foast_passes/type_deduction: the narrowing assert is split off the declared-type assignmentnext/utils.tree_map:isinstance(x, collection_type)with a variable class object now narrowsAnytoobject, so the length checks needed restructuringcartesian/utils/compiler:compiler_cxxexists at runtime but is not declared on theCCompilerbase class, so it gets a targeted ignore — the surroundingexcept AttributeErroralready handles the non-Unix case