Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mypy: Don't ignore missing imports (remove ignore_missing_imports) #611

Merged
merged 2 commits into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[mypy]
allow_redefinition = true
check_untyped_defs = true
ignore_missing_imports = true
incremental = true
strict_optional = true
show_traceback = true
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ djangorestframework==3.15.1
types-pytz==2024.1.0.20240417
types-requests==2.31.0.20240406
types-urllib3==1.26.25.14
types-Pygments==2.18.0.20240506
django-stubs[compatible-mypy] @ git+https://github.com/typeddjango/django-stubs
django-stubs-ext @ git+https://github.com/typeddjango/django-stubs#subdirectory=ext
-e .[compatible-mypy,coreapi,markdown]
6 changes: 3 additions & 3 deletions rest_framework-stubs/compat.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ try:
except ImportError:
postgres_fields: TypeAlias = None # type: ignore[no-redef]
try:
import coreapi
import coreapi # type: ignore[import-untyped]
except ImportError:
coreapi: TypeAlias = None # type: ignore[no-redef]
try:
import uritemplate
except ImportError:
uritemplate: TypeAlias = None # type: ignore[no-redef]
try:
import coreschema
import coreschema # type: ignore[import-untyped]
except ImportError:
coreschema: TypeAlias = None # type: ignore[no-redef]
try:
import yaml
except ImportError:
yaml: TypeAlias = None # type: ignore[no-redef]
try:
import inflection
import inflection # type: ignore[import-not-found,unused-ignore]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we don't do anything with inflection, only re-export it via rest_framework.compat, it seems unnecessary to add it even as an optional dependency.

except ImportError:
inflection: TypeAlias = None # type: ignore[no-redef]
try:
Expand Down
2 changes: 1 addition & 1 deletion rest_framework-stubs/pagination.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from collections.abc import Callable, Sequence
from typing import Any, NamedTuple, TypeVar

from coreapi import Field as CoreAPIField
from coreapi import Field as CoreAPIField # type: ignore[import-untyped]
from django.core.paginator import Page, Paginator
from django.db.models import Model, QuerySet
from rest_framework.request import Request
Expand Down
2 changes: 1 addition & 1 deletion rest_framework-stubs/test.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ from _typeshed import Incomplete
from collections.abc import Iterable, Mapping
from typing import Any

import coreapi
import coreapi # type: ignore[import-untyped]
import requests
import urllib3
from django.contrib.auth.base_user import AbstractBaseUser
Expand Down