diff --git a/.basedpyright/baseline.json b/.basedpyright/baseline.json index 49ee20bb9..cf31cdf61 100644 --- a/.basedpyright/baseline.json +++ b/.basedpyright/baseline.json @@ -135121,14 +135121,6 @@ "lineCount": 1 } }, - { - "code": "reportMissingTypeStubs", - "range": { - "startColumn": 9, - "endColumn": 22, - "lineCount": 1 - } - }, { "code": "reportUnknownMemberType", "range": { @@ -135188,16 +135180,16 @@ { "code": "reportAny", "range": { - "startColumn": 31, - "endColumn": 42, + "startColumn": 37, + "endColumn": 41, "lineCount": 1 } }, { "code": "reportAny", "range": { - "startColumn": 31, - "endColumn": 42, + "startColumn": 37, + "endColumn": 41, "lineCount": 1 } }, diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 202b60538..77ae164b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: - uses: actions/checkout@v4 - name: "Main Script" run: | - EXTRA_INSTALL="pytest types-colorama types-Pygments" + EXTRA_INSTALL="pytest types-colorama types-Pygments scipy-stubs" curl -L -O https://tiker.net/ci-support-v0 . ./ci-support-v0 diff --git a/loopy/check.py b/loopy/check.py index c9deb6326..da4a5618f 100644 --- a/loopy/check.py +++ b/loopy/check.py @@ -35,7 +35,7 @@ import islpy as isl from islpy import dim_type from pymbolic.primitives import AlgebraicLeaf, Variable, is_arithmetic_expression -from pytools import memoize_method +from pytools import memoize_method, set_union from loopy.diagnostic import ( LoopyError, @@ -72,7 +72,7 @@ check_each_kernel, ) from loopy.type_inference import TypeReader -from loopy.typing import auto, not_none, set_union +from loopy.typing import auto, not_none if TYPE_CHECKING: diff --git a/loopy/kernel/__init__.py b/loopy/kernel/__init__.py index 4c8168df0..d19f654fc 100644 --- a/loopy/kernel/__init__.py +++ b/loopy/kernel/__init__.py @@ -53,6 +53,7 @@ from islpy import dim_type from pytools import ( UniqueNameGenerator, + fset_union, generate_unique_names, memoize_method, natsorted, @@ -72,7 +73,7 @@ ) from loopy.tools import update_persistent_hash from loopy.types import LoopyType, NumpyType -from loopy.typing import InsnId, PreambleGenerator, SymbolMangler, fset_union, not_none +from loopy.typing import InsnId, PreambleGenerator, SymbolMangler, not_none if TYPE_CHECKING: diff --git a/loopy/kernel/tools.py b/loopy/kernel/tools.py index 484071f92..bd5f0249e 100644 --- a/loopy/kernel/tools.py +++ b/loopy/kernel/tools.py @@ -47,7 +47,7 @@ import pymbolic.primitives as p from islpy import dim_type from pymbolic import Expression -from pytools import memoize_on_first_arg, natsorted +from pytools import fset_union, memoize_on_first_arg, natsorted, set_union from loopy.diagnostic import LoopyError, warn_with_kernel from loopy.kernel import LoopKernel @@ -66,7 +66,6 @@ TUnitOrKernelT, for_each_kernel, ) -from loopy.typing import fset_union, set_union if TYPE_CHECKING: diff --git a/loopy/schedule/tools.py b/loopy/schedule/tools.py index 02c5c892f..948dbf0f0 100644 --- a/loopy/schedule/tools.py +++ b/loopy/schedule/tools.py @@ -70,12 +70,12 @@ from constantdict import constantdict import islpy as isl -from pytools import memoize_method, memoize_on_first_arg +from pytools import fset_union, memoize_method, memoize_on_first_arg from loopy.diagnostic import LoopyError from loopy.kernel.data import AddressSpace, ArrayArg, TemporaryVariable from loopy.schedule.tree import Tree -from loopy.typing import InameStr, InameStrSet, fset_union, not_none +from loopy.typing import InameStr, InameStrSet, not_none if TYPE_CHECKING: diff --git a/loopy/transform/loop_fusion.py b/loopy/transform/loop_fusion.py index 2a9927fe3..086c5c5d0 100644 --- a/loopy/transform/loop_fusion.py +++ b/loopy/transform/loop_fusion.py @@ -32,7 +32,7 @@ from constantdict import constantdict from typing_extensions import override -from pytools import memoize_on_first_arg +from pytools import fset_union, memoize_on_first_arg from loopy.diagnostic import LoopyError from loopy.kernel import LoopKernel @@ -42,7 +42,6 @@ RuleAwareIdentityMapper, SubstitutionRuleMappingContext, ) -from loopy.typing import InsnId, fset_union if TYPE_CHECKING: @@ -51,7 +50,7 @@ from loopy.kernel.instruction import InstructionBase from loopy.match import RuleStack from loopy.schedule.tools import LoopNestTree - from loopy.typing import InameStr, InameStrSet + from loopy.typing import InameStr, InameStrSet, InsnId __doc__ = """ diff --git a/loopy/typing.py b/loopy/typing.py index 447794da5..c227688ce 100644 --- a/loopy/typing.py +++ b/loopy/typing.py @@ -50,7 +50,7 @@ """ -from typing import TYPE_CHECKING, TypeAlias, TypeVar, cast +from typing import TYPE_CHECKING, TypeAlias, TypeVar import numpy as np from typing_extensions import TypeIs @@ -60,7 +60,7 @@ if TYPE_CHECKING: - from collections.abc import Callable, Iterable, Iterator + from collections.abc import Callable, Iterator from loopy.codegen import PreambleInfo from loopy.kernel import LoopKernel @@ -124,11 +124,3 @@ def integer_expr_or_err(expr: Expression) -> Integer | ExpressionNode: def assert_tuple(obj: tuple[ElT, ...] | object) -> tuple[ElT, ...]: assert isinstance(obj, tuple) return obj - - -def set_union(iterable: Iterable[Iterable[T]]): - return cast("set[T]", set()).union(*iterable) - - -def fset_union(iterable: Iterable[Iterable[T]]): - return cast("frozenset[T]", frozenset()).union(*iterable) diff --git a/pyproject.toml b/pyproject.toml index 07ec2b5cf..ace396f68 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ classifiers = [ "Topic :: Utilities", ] dependencies = [ - "pytools>=2025.1.6", + "pytools>=2025.2.2", "pymbolic>=2024.2.2", "genpy>=2016.1.2",