github typeddjango/djangorestframework-stubs 3.18.2

4 hours ago

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, SearchFilter title/description to be translated strings by @emorozov in #1057
  • Allow int keys in exception details and ListSerializer.errors by @JPDSousa in #1058
  • Accept Mapping for field error_messages by @kalekseev in #1075
  • Accept Django form errors as APIException input by @kalekseev in #1076
  • Fix JSONField default= and initial= params to support JSON primitives and sequences (#902) by @0xrutabaga in #1071

Method signatures and return types

  • Correct DjangoTestAdapter.get_environ() and .send() to accept requests.PreparedRequest by @emmanuel-ferdman in #1068
  • Fix ModelSerializer.get_unique_together_constraints model parameter type by @Culaii in #1087
  • Fix settings.api_settings types: classes and callables, not strings by @0xrutabaga in #1106
  • Fix APIRequestFactory methods to return WSGIRequest instead of Request by @Culaii in #1103
  • Bind ViewSet @action methods 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 DefaultContentNegotiation limit attributes and request.MAX_MEDIA_TYPE_LENGTH
    • Add parsers.get_encoding() and utils.mediatypes.order_parsed_by_precedence() stubs
    • Add the authtoken.models.TokenProxyQuerySet stub
  • Improve utils.json.dump/dumps parameters; prepare for Python 3.15 by @intgr in #1096

Stub improvements

  • Fill incomplete return types in rest_framework.templatetags by @emmanuel-ferdman in #1059
  • Fix incomplete types in serializers, request, permissions, negotiation, test by @emmanuel-ferdman in #1068
  • Distinguish Serializer and Field validator= callback types by @Culaii in #1088
  • Update DRF to v3.18.1, add rest_framework.deprecation stubs by @intgr in #1065
  • Improve {Model,List}Serializer.to_internal_value return types by @Culaii in #1094

Housekeeping

  • Add AGENTS.md for 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

Full Changelog: 3.18.1...3.18.2

Don't miss a new djangorestframework-stubs release

NewReleases is sending notifications on new releases.