What's Changed
Updated stubs for DRF 3.18.3 in #1065 and #1072
Added support for mypy 2.4.x in the compatible-mypy extra in #1066
Stub fixes
Accepted values and error handling
- Allow
OrderingFilter,SearchFiltertitle/descriptionto be translated strings by @emorozov in #1057 - Allow
intkeys in exception details andListSerializer.errorsby @JPDSousa in #1058 - Accept
Mappingfor fielderror_messagesby @kalekseev in #1075 - Accept Django form errors as
APIExceptioninput by @kalekseev in #1076 - Fix
JSONFielddefault=andinitial=params to support JSON primitives and sequences (#902) by @0xrutabaga in #1071
Method signatures and return types
- Correct
DjangoTestAdapter.get_environ()and.send()to acceptrequests.PreparedRequestby @emmanuel-ferdman in #1068 - Fix
ModelSerializer.get_unique_together_constraintsmodel parameter type by @Culaii in #1087 - Fix
settings.api_settingstypes: classes and callables, not strings by @0xrutabaga in #1106 - Fix
APIRequestFactorymethods to returnWSGIRequestinstead ofRequestby @Culaii in #1103 - Bind
ViewSet@actionmethods when accessed on an instance by @Culaii in #1104
DRF and Python compatibility
- Update DRF to v3.18.3 by @browniebroke in #1072
- Match
ModelSerializer.get_unique_together_constraints()to DRF's six-item constraint tuples - Add
DefaultContentNegotiationlimit attributes andrequest.MAX_MEDIA_TYPE_LENGTH - Add
parsers.get_encoding()andutils.mediatypes.order_parsed_by_precedence()stubs - Add the
authtoken.models.TokenProxyQuerySetstub
- Match
- Improve
utils.json.dump/dumpsparameters; prepare for Python 3.15 by @intgr in #1096
Stub improvements
- Fill incomplete return types in
rest_framework.templatetagsby @emmanuel-ferdman in #1059 - Fix incomplete types in
serializers,request,permissions,negotiation,testby @emmanuel-ferdman in #1068 - Distinguish
SerializerandFieldvalidator=callback types by @Culaii in #1088 - Update DRF to v3.18.1, add
rest_framework.deprecationstubs by @intgr in #1065 - Improve
{Model,List}Serializer.to_internal_valuereturn types by @Culaii in #1094
Housekeeping
- Add
AGENTS.mdfor agentic development by @intgr in #1077 - CI: use
mypy_primer: check stubs changes on downstream projects by @intgr in #1078 - CI:
mypy_primer: Add 5 more downstream projects by @intgr in #1085 - CI:
mypy_primer: Fix PR comments for fork pull requests by @intgr in #1095 - Add Python 3.15 support by @intgr in #1097
- Version 3.18.2 release by @intgr in #1109
New Contributors
- @emorozov made their first contribution in #1057
- @JPDSousa made their first contribution in #1058
- @Culaii made their first contribution in #1087
- @0xrutabaga made their first contribution in #1106
Full Changelog: 3.18.1...3.18.2