Skip to content

Commit 16c8376

Browse files
authored
Django5.2 (typeddjango#753)
1 parent 9b020ae commit 16c8376

File tree

16 files changed

+27
-32
lines changed

16 files changed

+27
-32
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
27+
python-version: ['3.10', '3.11', '3.12', '3.13']
2828
steps:
2929
- uses: actions/checkout@v4
3030
- name: Set up Python ${{ matrix.python-version }}
@@ -48,7 +48,7 @@ jobs:
4848
strategy:
4949
fail-fast: false
5050
matrix:
51-
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
51+
python-version: ['3.10', '3.11', '3.12', '3.13']
5252
steps:
5353
- uses: actions/checkout@v4
5454
- name: Setup system dependencies

mypy_drf_plugin/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Callable, Optional
1+
from collections.abc import Callable
22

33
from mypy.nodes import TypeInfo
44
from mypy.plugin import ClassDefContext, Plugin
@@ -26,7 +26,7 @@ def _get_currently_defined_serializers(self) -> dict[str, int]:
2626
else:
2727
return {}
2828

29-
def get_base_class_hook(self, fullname: str) -> Optional[Callable[[ClassDefContext], None]]:
29+
def get_base_class_hook(self, fullname: str) -> Callable[[ClassDefContext], None] | None:
3030
if fullname in self._get_currently_defined_serializers():
3131
return transform_serializer_class
3232
return None

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.ruff]
22
line-length = 120
3-
target-version = "py39"
3+
target-version = "py310"
44
# See Rules in Ruff documentation: https://docs.astral.sh/ruff/rules/
55
[tool.ruff.lint]
66
select = [

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ types-pytz==2025.2.0.20250326
77
types-requests==2.32.0.20250328
88
types-urllib3==1.26.25.14
99
types-Pygments==2.19.0.20250305
10+
types-pyyaml==6.0.12.20250402
1011
django-stubs[compatible-mypy] @ git+https://github.com/typeddjango/django-stubs
1112
django-stubs-ext @ git+https://github.com/typeddjango/django-stubs#subdirectory=ext
1213
-e .[compatible-mypy,coreapi,markdown]

rest_framework-stubs/compat.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
from typing import Any
1+
from typing import Any, TypeAlias
22

33
from django.db.models import QuerySet
4-
from typing_extensions import TypeAlias
54

65
try:
76
from django.contrib.postgres import fields as postgres_fields

rest_framework-stubs/decorators.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22
from collections.abc import Callable, Mapping, Sequence
3-
from typing import Any, Literal, Protocol, TypeVar
3+
from typing import Any, Concatenate, Literal, Protocol, TypeAlias, TypeVar
44

55
from django.http import HttpRequest
66
from django.http.response import HttpResponseBase
@@ -12,7 +12,7 @@ from rest_framework.request import Request
1212
from rest_framework.schemas.inspectors import ViewInspector
1313
from rest_framework.throttling import BaseThrottle
1414
from rest_framework.views import APIView, AsView # noqa: F401
15-
from typing_extensions import Concatenate, ParamSpec, TypeAlias
15+
from typing_extensions import ParamSpec
1616

1717
_View = TypeVar("_View", bound=Callable[..., HttpResponseBase])
1818
_P = ParamSpec("_P")

rest_framework-stubs/exceptions.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from collections.abc import Mapping, Sequence
2-
from typing import Any
2+
from typing import Any, TypeAlias
33

44
from django.http import HttpRequest, JsonResponse
55
from django_stubs_ext import StrOrPromise
66
from rest_framework.renderers import BaseRenderer
77
from rest_framework.request import Request
8-
from typing_extensions import Self, TypeAlias, TypedDict
8+
from typing_extensions import Self, TypedDict
99

1010
class ErrorDetail(str):
1111
code: str | None

rest_framework-stubs/fields.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ from decimal import Decimal
66
from enum import Enum
77
from json import JSONDecoder, JSONEncoder
88
from re import Pattern
9-
from typing import Any, ClassVar, Final, Generic, NoReturn, Protocol, TypeVar
9+
from typing import Any, ClassVar, Final, Generic, NoReturn, Protocol, TypeAlias, TypeVar
1010

1111
from django.core.files.base import File
1212
from django.db import models
1313
from django.forms import ImageField as DjangoImageField # noqa: F401
1414
from django_stubs_ext import StrOrPromise
1515
from rest_framework.serializers import BaseSerializer
1616
from rest_framework.validators import Validator
17-
from typing_extensions import Self, TypeAlias
17+
from typing_extensions import Self
1818

1919
class _Empty(Enum):
2020
sentinel = 0

rest_framework-stubs/permissions.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
from _typeshed import Incomplete
22
from collections.abc import Sequence
3-
from typing import Any, Protocol
3+
from typing import Any, Protocol, TypeAlias
44

55
from django.db.models import Model, QuerySet
66
from rest_framework.request import Request
77
from rest_framework.views import APIView
8-
from typing_extensions import TypeAlias
98

109
SAFE_METHODS: Sequence[str]
1110

rest_framework-stubs/schemas/generators.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
from _typeshed import Incomplete
22
from collections.abc import Iterable, Sequence
33
from types import ModuleType
4-
from typing import Any
4+
from typing import Any, TypeAlias
55

66
from django.db.models.base import Model
77
from rest_framework.compat import coreapi
88
from rest_framework.request import Request
99
from rest_framework.urlpatterns import _AnyURL
1010
from rest_framework.views import APIView
11-
from typing_extensions import TypeAlias
1211

1312
def common_path(paths: Iterable[str]) -> str: ...
1413
def get_pk_name(model: type[Model]) -> str: ...

0 commit comments

Comments
 (0)