4.2.5
Headline changes
-
mypy 1.6: Recommended mypy version updated to 1.6.x
-
Next django-stubs version (4.2.6) will remove direct mypy dependency. If you are using mypy, please add an explicit
mypy
dev dependency to your project, or install django-stubs with the extradjango-stubs[compatible-mypy]
.Mypy remains the only supported type checker. Improvements for other type checkers may be considered in the future, pull requests welcome. See #1628 for details.
-
Officially added Python 3.12 support
Stubs fixes
- Made
default_storage
produce aStorage
object by @brianhelba in #1665 - Fixed wrong type hints for
SyndicationFeed
methods by @WhyNotHugo in #1705 - Fixed variance of
Migration.operations
attribute by @asottile in #1707 - Fixed variance of all
Migration
list attributes by @brianhelba in #1710 - Adjust
bases=
parameter inCreateModel
migration op to allow for mixins by @asottile in #1708 - Fixed
_Composable
protocol for compatibility withpsycopg2-stubs
change by @andersk in #1714 - Various fixes and improvements in
django.views
modules by @GabDug in #1716 - Removed
null
andvalidators
arguments fromManyToManyField.__init__
by @flaeppe in #1720 - Various fixes and improvements in
django.test
modules by @UnknownPlatypus in #1752 - Fixed
BaseModelForm
,ErrorList
,ErrorDict
constructorrenderer=
parameter by @GabDug in #1690
Stubs improvements
- Annotated return value of all
deconstruct
methods by @brianhelba in #1695 - Added missing arguments to
SQLCompiler
methods by @ashm-tech in #1689 - Added missing
max_length
attribute toforms.FileField
by @GabDug in #1715 - Added missing type arguments to various generic classes by @GabDug in #1717
- Added missing
Layer.num_feat
attribute (GeoDjango) by @niconoe in #1722 - Specify
AbstractBaseUser.REQUIRED_FIELDS
asClassVar
by @WhyNotHugo in #1737 - Improve
fields.Field.formfield()
method by @WhyNotHugo in #1739 - Added
ModelStateFieldsCacheDescriptor.__get__
method by @asottile in #1743 - Update
Model._meta
toClassVar[Options[Self]]
by @flaeppe in #1732 - Improved
django.test.signals
types by @UnknownPlatypus in #1751 - Updated Django to 4.2.6 and updated stubs by @sobolevn in #1757
- Require 1 callable argument for
@cached_property
decorated method by @flaeppe in #1766 - Allow
psycopg2.sql.SQL
inQuerySet.raw()
by @flaeppe in #1767 - Added missing stubs in
django.middleware.csrf
module by @UnknownPlatypus in #1770 - Various improvements in
django.core.cache
modules by @UnknownPlatypus in #1774 - Improved
Field.formfield()
,GeometryField.formfield()
methods by @brianhelba in #1724 - Fixed query
F.resolve_expression()
return type by @schinckel in #1659
Plugin improvements
- Resolve dynamic
Manager
methods through manager MRO by @flaeppe in #1701 - Use
functools.cached_property
instead of Django's in mypy plugin by @flaeppe in #1721 - Improved hints for
ReverseOneToOneDescriptor
and start using it by @flaeppe in #1733 - Add better support for
ManyToManyField
'sthrough
model by @flaeppe in #1719 - Resolve any
settings.AUTH_USER_MODEL
used asto=
in relation by @flaeppe in #1746 - Added missing
_default_manager
symbol to generatedthrough
model by @flaeppe in #1745
Plugin crash fixes
- Gracefully handle unwanted types when creating fallback managers by @flaeppe in #1728
Fixes someAssertionError
crashes. - Handle mismatching types in queryset method resolving gracefully by @flaeppe in #1727
Fixes someAssertionError
crashes. - Fixed crash on bad arguments for model relationship fields by @flaeppe in #1735
Fixes someValueError
crashes.
Documentation
- Fixed link to
django_stubs_ext
by @tony in #1747 & #1748 - Add version 4.2.4 to version compatibility table by @intgr in #1758
Housekeeping
- Removed a bunch of unused code by @flaeppe in #1687
- Removed redefinition of inherited
deconstruct
methods. by @brianhelba in #1693 & #1694 - Use
parse_bool
implementation from mypy by @flaeppe in #1703 - Specify error codes in
# type: ignore
comments for plugin code by @flaeppe in #1726 - Specify error codes in
# type: ignore
comments in stubs files by @UnknownPlatypus in #1734 - CI: Enable testing with Python 3.12 by @intgr in #1759
- Bump mypy from 1.5.1 to 1.6.0 by @dependabot in #1764
- Tests: Add mypy error codes to typecheck by @UnknownPlatypus in #1773
- chore: Migrate from flake8 to ruff by @GabDug in #1718
- Update black version by @sobolevn in #1776
- Added test to verify that
Manager.from_queryset()
handles invalid argument types by @flaeppe in #1731 - Version 4.2.5 release (django-stubs, django-stubs-ext) by @intgr in #1777
New Contributors
- @ashm-tech made their first contribution in #1689
- @WhyNotHugo made their first contribution in #1705
- @niconoe made their first contribution in #1722
- @schinckel made their first contribution in #1659
Full Changelog: 4.2.4...4.2.5