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

Update mypy to 1.14 #2468

Merged
merged 6 commits into from
Dec 23, 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
12 changes: 6 additions & 6 deletions django-stubs/db/models/enums.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ else:
_enum_property = property
EnumType = enum.EnumMeta

class ReprEnum(enum.Enum): ...
class IntEnum(int, ReprEnum): ...
class StrEnum(str, ReprEnum): ...
class ReprEnum(enum.Enum): ... # type: ignore[misc]
class IntEnum(int, ReprEnum): ... # type: ignore[misc]
class StrEnum(str, ReprEnum): ... # type: ignore[misc]

@deprecated("ChoicesMeta is deprecated in favor of ChoicesType and will be removed in Django 6.0.")
class ChoicesMeta(EnumType):
Expand All @@ -42,7 +42,7 @@ class ChoicesMeta(EnumType):

ChoicesType: TypeAlias = ChoicesMeta

class Choices(enum.Enum, metaclass=ChoicesType):
class Choices(enum.Enum, metaclass=ChoicesType): # type: ignore[misc]
@property
def label(self) -> str: ...
@_enum_property
Expand All @@ -61,7 +61,7 @@ class _IntegerChoicesMeta(ChoicesType):
# In reality, the `__init__` overloads provided below should also support
# all the arguments of `int.__new__`/`str.__new__` (e.g. `base`, `encoding`).
# They are omitted on purpose to avoid having convoluted stubs for these enums:
class IntegerChoices(Choices, IntEnum, metaclass=_IntegerChoicesMeta):
class IntegerChoices(Choices, IntEnum, metaclass=_IntegerChoicesMeta): # type: ignore[misc]
@overload
def __init__(self, x: ConvertibleToInt) -> None: ...
@overload
Expand All @@ -77,7 +77,7 @@ class _TextChoicesMeta(ChoicesType):
@property
def values(self) -> list[str]: ...

class TextChoices(Choices, StrEnum, metaclass=_TextChoicesMeta):
class TextChoices(Choices, StrEnum, metaclass=_TextChoicesMeta): # type: ignore[misc]
@overload
def __init__(self, object: str) -> None: ...
@overload
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ Django==5.1.4; python_version >= '3.10'
-e .[redis,compatible-mypy,oracle]

# Overrides:
mypy==1.13.0
mypy==1.14.0
pyright==1.1.391
72 changes: 72 additions & 0 deletions scripts/stubtest/allowlist_todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1302,3 +1302,75 @@ django.db.models.expressions.rhs
django.db.models.expressions.result
django.db.models.expressions.lhs
django.db.backends.postgresql.base.Cursor

# mypy 1.14.0 new issues:
django.apps.__all__
django.conf.urls.__all__
django.contrib.admin.__all__
django.contrib.gis.admin.__all__
django.contrib.gis.db.models.__all__
django.contrib.gis.db.models.aggregates.__all__
django.contrib.gis.db.models.sql.__all__
django.contrib.gis.gdal.__all__
django.contrib.gis.geoip2.__all__
django.contrib.gis.geos.io.__all__
django.contrib.gis.geos.prototypes.misc.__all__
django.contrib.gis.measure.__all__
django.contrib.gis.sitemaps.__all__
django.contrib.gis.utils.__all__
django.contrib.messages.api.__all__
django.contrib.postgres.aggregates.general.__all__
django.contrib.postgres.aggregates.statistics.__all__
django.contrib.postgres.constraints.__all__
django.contrib.postgres.fields.array.__all__
django.contrib.postgres.fields.citext.__all__
django.contrib.postgres.fields.hstore.__all__
django.contrib.postgres.fields.jsonb.__all__
django.contrib.postgres.fields.ranges.__all__
django.contrib.postgres.forms.hstore.__all__
django.contrib.postgres.forms.ranges.__all__
django.contrib.postgres.indexes.__all__
django.core.cache.__all__
django.core.checks.__all__
django.core.files.locks.__all__
django.core.files.move.__all__
django.core.files.storage.memory.__all__
django.core.files.temp.__all__
django.core.files.uploadedfile.__all__
django.core.files.uploadhandler.__all__
django.core.mail.__all__
django.core.servers.basehttp.__all__
django.db.__all__
django.db.migrations.operations.__all__
django.db.models.__all__
django.db.models.aggregates.__all__
django.db.models.constraints.__all__
django.db.models.enums.__all__
django.db.models.fields.__all__
django.db.models.fields.generated.__all__
django.db.models.fields.json.__all__
django.db.models.functions.__all__
django.db.models.functions.window.__all__
django.db.models.indexes.__all__
django.db.models.sql.__all__
django.db.models.sql.query.__all__
django.db.models.sql.subqueries.__all__
django.forms.boundfield.__all__
django.forms.fields.__all__
django.forms.forms.__all__
django.forms.formsets.__all__
django.forms.models.__all__
django.forms.widgets.__all__
django.http.__all__
django.http.multipartparser.__all__
django.template.__all__
django.test.__all__
django.test.client.__all__
django.test.testcases.__all__
django.test.utils.__all__
django.urls.__all__
django.utils.choices.__all__
django.utils.timezone.__all__
django.utils.translation.__all__
django.views.__all__
django.views.generic.__all__
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def find_stub_files(name: str) -> list[str]:

# Keep compatible-mypy major.minor version pinned to what we use in CI (requirements.txt)
extras_require = {
"compatible-mypy": ["mypy>=1.12,<1.14"],
"compatible-mypy": ["mypy>=1.12,<1.15"],
"redis": ["redis"],
"oracle": ["oracledb"],
}
Expand Down
2 changes: 1 addition & 1 deletion tests/typecheck/fields/test_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
booking = Booking()
reveal_type(booking.id) # N: Revealed type is "builtins.int"
reveal_type(booking.time_range) # N: Revealed type is "Any"
reveal_type(booking.some_decimal) # N: Revealed type is "_decimal.Decimal"
reveal_type(booking.some_decimal) # N: Revealed type is "decimal.Decimal"
installed_apps:
- myapp
files:
Expand Down
4 changes: 2 additions & 2 deletions tests/typecheck/managers/test_managers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -680,8 +680,8 @@
installed_apps:
- myapp
out: |
main:2: note: Revealed type is "myapp.models.MyModel.MyManager"
main:3: note: Revealed type is "Any"
main:2: note: Revealed type is "myapp.models.MyModel.MyManager[myapp.models.MyModel]"
main:3: note: Revealed type is "myapp.models.MyModel"
files:
- path: myapp/__init__.py
- path: myapp/models.py
Expand Down
Loading