diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e5cd70..27f0008 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,8 +60,7 @@ jobs: build_py_project_in_venv run_pylint $(get_proj_name) - mypy: - name: Mypy + basedpyright: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -74,8 +73,8 @@ jobs: curl -L -O https://tiker.net/ci-support-v0 . ci-support-v0 build_py_project_in_venv - pip install mypy - mypy "$(get_proj_name)" + pip install basedpyright + basedpyright pytest: name: Pytest on Py${{ matrix.python-version }} ${{ matrix.os }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aa3450e..835c0db 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,13 +19,13 @@ Ruff: except: - tags -Mypy: +basedpyright: script: | curl -L -O https://tiker.net/ci-support-v0 . ci-support-v0 build_py_project_in_venv - pip install mypy - mypy "$(get_proj_name)" + pip install basedpyright + basedpyright tags: - python3 except: diff --git a/namedisl/__init__.py b/namedisl/__init__.py index 2a23a2c..a2edcaf 100644 --- a/namedisl/__init__.py +++ b/namedisl/__init__.py @@ -31,7 +31,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ - import re from collections.abc import Mapping from dataclasses import dataclass @@ -39,6 +38,7 @@ from typing import TypeAlias, TypeVar, overload from constantdict import constantdict +from typing_extensions import override import islpy as isl @@ -54,7 +54,7 @@ def _strip_names(obj: IslObject) -> tuple[IslObject, NameToDim]: - name_to_dim = {} + name_to_dim: dict[str, tuple[isl.dim_type, int]] = {} for tp in isl._CHECK_DIM_TYPES: for i in range(obj.dim(tp)): name = obj.get_dim_name(tp, i) @@ -82,6 +82,7 @@ class BasicSet: _obj: isl.BasicSet _name_to_dim: NameToDim + @override def __str__(self) -> str: return str(_restore_names(self._obj, self._name_to_dim)) diff --git a/pyproject.toml b/pyproject.toml index b06e1f2..6332a91 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,13 +72,38 @@ lines-after-imports = 2 required-imports = ["from __future__ import annotations"] -[tool.mypy] -python_version = "3.10" -ignore_missing_imports = true -warn_unused_ignores = true -strict = true - [tool.typos.default] extend-ignore-re = [ "(?Rm)^.*(#|//)\\s*spellchecker:\\s*disable-line$" ] + + +[tool.basedpyright] +reportImplicitStringConcatenation = "none" +reportUnnecessaryIsInstance = "none" +reportUnusedCallResult = "none" +reportExplicitAny = "none" +reportPrivateUsage = "none" +reportPrivateImportUsage = "none" + +reportUnreachable = "hint" +reportUnnecessaryComparison = "hint" + +# This reports even cycles that are qualified by 'if TYPE_CHECKING'. Not what +# we care about at this moment. +# https://github.com/microsoft/pyright/issues/746 +reportImportCycles = "none" + +pythonVersion = "3.10" +pythonPlatform = "All" + +exclude = [ + "proto-tests/*.py", + "contrib/mem-pattern-explorer/*.py", + "loopy/ipython_ext.py", + "loopy/frontend/fortran/*.py", + "doc", + ".conda-root", + ".env", +] +