diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0b71c50f1..487e35a2a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,6 +25,7 @@ jobs: strategy: matrix: python-version: ['3.10', '3.11', '3.12', '3.13'] + mypy-version: ['1.13', '1.14', '1.15', '1.16', 'latest'] fail-fast: false steps: - uses: actions/checkout@v4 @@ -38,6 +39,14 @@ jobs: - name: Install dependencies run: uv sync --no-dev --group tests + - name: Override mypy version + run: | + if [ "${{ matrix.mypy-version }}" == "latest" ]; then + uv pip install git+https://github.com/python/mypy.git@master + else + uv pip install mypy==${{ matrix.mypy-version }} + fi + - name: Run mypy on plugin code run: uv run mypy --strict mypy_django_plugin - name: Run mypy on ext code diff --git a/django-stubs/core/serializers/xml_serializer.pyi b/django-stubs/core/serializers/xml_serializer.pyi index 2762530fe..9838f6fcf 100644 --- a/django-stubs/core/serializers/xml_serializer.pyi +++ b/django-stubs/core/serializers/xml_serializer.pyi @@ -1,5 +1,5 @@ from typing import IO, Any -from xml.sax.expatreader import ExpatParser +from xml.sax.expatreader import ExpatParser # type: ignore[import-not-found, unused-ignore] from django.core.serializers import base diff --git a/django-stubs/db/models/enums.pyi b/django-stubs/db/models/enums.pyi index e6ce888a7..2935c2717 100644 --- a/django-stubs/db/models/enums.pyi +++ b/django-stubs/db/models/enums.pyi @@ -13,9 +13,9 @@ else: from enum import EnumMeta as EnumType from types import DynamicClassAttribute as enum_property - class ReprEnum(enum.Enum): ... # type: ignore[misc] - class IntEnum(int, ReprEnum): ... # type: ignore[misc] - class StrEnum(str, ReprEnum): ... # type: ignore[misc] + class ReprEnum(enum.Enum): ... # type: ignore[misc, unused-ignore] + class IntEnum(int, ReprEnum): ... # type: ignore[misc, unused-ignore] + class StrEnum(str, ReprEnum): ... # type: ignore[misc, unused-ignore] _Self = TypeVar("_Self", bound=ChoicesType) @@ -38,7 +38,7 @@ class ChoicesType(EnumType): @deprecated("ChoicesMeta is deprecated in favor of ChoicesType and will be removed in Django 6.0.") class ChoicesMeta(ChoicesType): ... -class Choices(enum.Enum, metaclass=ChoicesType): # type: ignore[misc] +class Choices(enum.Enum, metaclass=ChoicesType): # type: ignore[misc, unused-ignore] _label_: _StrOrPromise do_not_call_in_templates: Literal[True] diff --git a/mypy_django_plugin/transformers/choices.py b/mypy_django_plugin/transformers/choices.py index 232aa70e3..3b499758e 100644 --- a/mypy_django_plugin/transformers/choices.py +++ b/mypy_django_plugin/transformers/choices.py @@ -21,7 +21,7 @@ # TODO: [mypy 1.14+] Remove this backport of `TypeInfo.enum_members`. def _get_enum_members(info: TypeInfo) -> list[str]: try: - return info.enum_members + return info.enum_members # type: ignore[attr-defined, no-any-return, unused-ignore] except AttributeError: # mypy < 1.14 pass