diff --git a/pyproject.toml b/pyproject.toml index c2f6735a3..2a369e0dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,3 +7,6 @@ line_length = 120 multi_line_output = 3 include_trailing_comma = true profile = 'black' + +[build-system] +requires = ["setuptools<64", "wheel"] diff --git a/requirements.txt b/requirements.txt index 82a3cf604..5728f75d5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,4 +5,6 @@ pytest==7.1.2 pytest-mypy-plugins==1.9.3 djangorestframework==3.13.1 types-pytz==2022.1.2 +django-stubs==1.12.0 +django-stubs-ext==0.5.0 -e .[compatible-mypy,coreapi,markdown] diff --git a/rest_framework-stubs/decorators.pyi b/rest_framework-stubs/decorators.pyi index d2265dfb6..a301826ea 100644 --- a/rest_framework-stubs/decorators.pyi +++ b/rest_framework-stubs/decorators.pyi @@ -48,6 +48,7 @@ _MIXED_CASE_HTTP_VERBS = List[ "PUT", "PATCH", "TRACE", + "HEAD", "OPTIONS", "get", "post", @@ -55,6 +56,7 @@ _MIXED_CASE_HTTP_VERBS = List[ "put", "patch", "trace", + "head", "options", ] ] diff --git a/rest_framework-stubs/permissions.pyi b/rest_framework-stubs/permissions.pyi index 5a0823941..5b7acba92 100644 --- a/rest_framework-stubs/permissions.pyi +++ b/rest_framework-stubs/permissions.pyi @@ -43,8 +43,8 @@ class OR(_SupportsHasPermission): class NOT(_SupportsHasPermission): def __init__(self, op1: _SupportsHasPermission) -> None: ... -class BasePermissionMetaclass(OperationHolderMixin, type): ... -class BasePermission(_SupportsHasPermission, metaclass=BasePermissionMetaclass): ... +class BasePermissionMetaclass(OperationHolderMixin, type): ... # type: ignore[misc] +class BasePermission(_SupportsHasPermission, metaclass=BasePermissionMetaclass): ... # type: ignore[misc] class AllowAny(BasePermission): ... class IsAuthenticated(BasePermission): ... class IsAdminUser(BasePermission): ... diff --git a/scripts/typecheck_tests.py b/scripts/typecheck_tests.py index 3b5b612e4..819c1b579 100644 --- a/scripts/typecheck_tests.py +++ b/scripts/typecheck_tests.py @@ -157,6 +157,8 @@ '"ResolverMatch" has incompatible type "str"; expected "Callable[..., Any]"', "_SupportsHasPermission", "Invalid type alias: expression is not a valid type", + '"object" not callable', + 'Cannot assign multiple types to name "composed_perm" without an explicit "Type[...]" annotation', ], "test_relations.py": [ 'Invalid index type "int" for "Union[str, List[Any], Dict[str, Any]]"; expected type "str"',