Releases: typeddjango/djangorestframework-stubs
3.15.1
What's Changed
- Fix class hierachy and TypeVars of Serializer classes by @intgr in #520
- [3.15.1] Add
rest_framework.compat.inflection
by @saJaeHyukc in #607 - Fix
ModelSerializer.build_*_field()
argument types by @intgr in #609 - Mypy: Don't ignore missing imports (remove
ignore_missing_imports
) by @intgr in #611 - Improve
DefaultRouter
constructor and attributes by @intgr in #610 - Remove obsolete
RenameRouterMethods
metaclass by @intgr in #612 - Accept
StrPromise
asValidator.message
andmissing_message
by @q0w in #618 - Make
BaseSerializer.is_valid.raise_exception()
parameter kw-only by @Viicos in #620 - Cleanup: Import StrOrPromise from django_stubs_ext by @q0w in #621
- Bump djangorestframework from 3.15.1 to 3.15.2 by @sobolevn in #628
- Fix
SlugRelatedField.to_representation()
parameter name by @DongwookKim0823 in #632 - Add type hints to JSON utility methods in
rest_framework.utils
by @DongwookKim0823 in #633 - Fix
APIRequestFactory
method signatures by @DongwookKim0823 in #634 - Update mypy to 1.11.0 by @sobolevn in #642
- Add
objects
attribute toToken
by @sobolevn in #644 - Set configured user model as
request.user
by @flaeppe in #651 - Add
accepted_renderer
,accepted_media_type
toRequest
andResponse
by @q0w in #649 - Version 3.15.1 release by @intgr in #659
New Contributors
- @q0w made their first contribution in #618
- @DongwookKim0823 made their first contribution in #632
Full Changelog: 3.15.0...3.15.1
3.15.0
djangorestframework 3.15 support
- Add
ValidationError
params=
argument &default_params
attribute by @intgr in #338 - Add
SimpleRouter
use_regex_path
argument by @intgr in #344 - Add
construct_search
function queryset argument forSearchFilter
by @saJaeHyukc in #574 - Add
get_field_name
function ofAutoSchema
by @saJaeHyukc in #575 - Move
fields.set_value
toSerializer.set_value
by @saJaeHyukc in #576 - Remove
compat.distinct
function by @saJaeHyukc in #579 - Add
fields.logging
by @saJaeHyukc in #581 - Add
RemovedInDRF317Warning
by @saJaeHyukc in #578 - Add
DecimalField
normalize_output
argument by @saJaeHyukc in #584 - Add
serializers.LIST_SERIALIZER_KWARGS_REMOVE
by @saJaeHyukc in #580 - Add
represent_timedelta
, a function related toCustomScalar
by @saJaeHyukc in #586 - Add
is_already_registered
function ofBaseRouter
by @saJaeHyukc in #587 - Add
__class_getitem__
of classes by @saJaeHyukc in #585 - Add
optional_logout
csrf_token
argument by @saJaeHyukc in #589 - Add
run_child_validation
function ofListSerializer
by @saJaeHyukc in #590 - Add
filters.search_smart_split
by @saJaeHyukc in #592 - Add functions related to
UniqueConstraint
by @saJaeHyukc in #591
Stubs changes
- allow floats for _GetDataType by @asottile-sentry in #546
- Use
Pattern[str]
forRegexField
by @Viicos in #539 - Fixed
ModelSerializer.build_standard_field(model_field=)
parameter typing by @noamkush in #541 - Make
HyperlinkedRelatedField(view_name=)
&HyperlinkedIdentityField(view_name=)
param optional by @Alexerson in #530 - Allow passing
None
,empty
toModelSerializer.__init__()
default=
andinitial=
kwargs by @intgr in #521 - Add
ViewSetAction.__name__
attribute by @igorgaming in #567 - Make
HyperlinkedModelSerializer
generic by @intgr in #595 - Fix
HyperlinkedRelatedField.get_object()
argument types by @intgr in #597 - Allow
None
forListField.min/max_length
by @Viicos in #601
Housekeeping
- Omit authtoken.migration of allowlist_todo by @saJaeHyukc in #583
- Tests: Fix test after django-stubs StrPromise changes by @intgr in #518
- Update
pre-commit
by @sobolevn in #550 - Bump
pytest-mypy-plugins
andmypy
by @sobolevn in #557 - Use explicit target versions for black by @sobolevn in #558
- Update DRF to 3.15.0 by @sobolevn in #560
- Clean mypy cache on each run of
stubtest
by @intgr in #562 - Fix and enable Ruff lints PYI002, PYI026 by @intgr in #496
- Update djangorestframework to 3.15.1 by @sobolevn in #565
- Fix CI: suppress mypy errors in test suite that come from 3rd party packages by @intgr in #596
- CI: Run tests daily to detect incompatible django-stubs changes by @intgr in #519
- Version 3.15.0 release by @intgr in #605
New Contributors
- @asottile-sentry made their first contribution in #546
- @Viicos made their first contribution in #539
- @Alexerson made their first contribution in #530
- @igorgaming made their first contribution in #567
- @saJaeHyukc made their first contribution in #574
Full Changelog: 3.14.5...3.15.0
3.14.5
Headline changes
-
mypy 1.7: Recommended mypy version updated to 1.7.x
-
Removed direct mypy dependency. If you are using mypy, please add an explicit
mypy
dev dependency to your project, or install djangorestframework-stubs with the extradjangorestframework-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.
Stubs fixes
Stubs improvements
- Updated
Field
subclasses kwargs-only parameters by @intgr in #491 - Added all stubs reported missing by stubtest by @intgr in #499
- Improved
Serializer.to_representation()
return type by @4c0n in #504 - Improved
BaseSerializer
andListSerializer
methodto_representation()
by @intgr in #509 - Allow
http.HTTPMethod
enum values in@action()
decorator by @sshishov in #512
Housekeeping
- Dropped hard dependency on mypy by @intgr in #495
- Tests: Allowlist stubtest
@cached_property
error by @intgr in #503 - Upgraded to mypy 1.7.0 by @intgr in #506
New Contributors
Full Changelog: 3.14.4...3.14.5
3.14.4
Headline changes
-
mypy 1.6: Recommended mypy version updated to 1.6.x
-
Next djangorestframework-stubs version (3.14.5) will remove direct mypy dependency. If you are using mypy, please add an explicit
mypy
dev dependency to your project, or install djangorestframework-stubs with the extradjangorestframework-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.
-
We have now adopted mypy's stubtest to automatically find discrepancies between Django REST Framework and djangorestframework-stubs.
If you want to contribute but are not sure where to start, have a look at stubtest's TODO list file, which lists the many issues discovered by stubtest.
-
Officially added Python 3.12 support
Stubs fixes
- Allow
None
forHyperlinkedRelatedField.get_url(format=)
parameter by @4c0n in #485 - Allow
None
forPagination.template
attribute by @intgr in #482
Stubs improvements
- Fill remaining missing hints & disallow partial hints by @intgr in #480
This improved type hints all over the place.
Housekeeping
- Migrate from flake8 to ruff by @intgr in #488
- Harmonize
mypy.ini
config with django-stubs by @intgr in #479 - CI: Enable testing with Python 3.12 by @intgr in #478
- Update mypy requirement from ==1.5.* to ~=1.6.0 by @dependabot in #484
- Initial stubtest testing with autogenerated allowlist by @intgr in #493
- Cleanup: Add missing
None
return to__init__
methods by @intgr in #492 - Version 3.14.4 release by @intgr in #494
New Contributors
Full Changelog: 3.14.3...3.14.4
3.14.3
Headline changes
- mypy 1.5: Recommended mypy version updated to 1.5.x
Stubs additions
Stubs fixes
- Fix
ReturnDict
andReturnList
__init__
signatures by @moosbruggerj in #452 - Annotate
Field.default_error_messages
as a ClassVar by @brianhelba in #464 - Specify that
Request.parser_context
can never be None by @intgr in #476
Documentation
- Add FAQ section in README to explain usage of generics with
ModelSerializer
by @browniebroke in #444
Housekeeping
- Convert _typeshed.Self usages to typing_extensions.Self (PEP 673) by @intgr in #441
django_stubs_ext
was renamed toext
by @sobolevn in #460- Fix test broken by django-stubs 4.2.4 by @christianbundy in #471
- Version 3.14.3 release by @intgr in #477
New Contributors
- @moosbruggerj made their first contribution in #452
- @ltakens made their first contribution in #469
- @browniebroke made their first contribution in #444
Full Changelog: 3.14.2...3.14.3
3.14.2
Headline changes
- mypy 1.4: Recommended mypy version updated to 1.4.x
Stubs fixes
Housekeeping
- CI: Replace isort with Ruff import sorting by @intgr in #423
- CI: Auto-remove unused imports using Ruff by @intgr in #424
- Enable
pyupgrade
fromruff
by @sobolevn in #428 - Remove unused
DjangoContext
creation by @sobolevn in #433 - Update compatible-mypy to 1.4.x by @intgr in #437
- CI: Remove typecheck tests and clean things up by @intgr in #439
- Version 3.14.2 release by @intgr in #440
Full Changelog: 3.14.1...3.14.2
3.14.1
Headline changes
- mypy 1.3.0: Recommended mypy version updated to 1.3.0
- Compatibility: Support for Python 3.7 has been dropped.
Stubs changes
- Changed
BaseMetadata.determine_metadata()
return type toAny
by @realsuayip in #394 - Allow passing lazy translation strings to
RelatedField
and subclasses by @nils-van-zuijlen in #405 - Replaced
OrderedDict
withdict
by @terencehonles in #414 - Changed from
list
to abstractSequence
type for http verbs by @namper in #415 - Removed long-deprecated
Request
propertiesDATA
,QUERY_PARAMS
by @intgr in #420
Housekeeping
- Drop Python 3.7 compatibility by @intgr in #399
- Run pre-commit only on pre-commit.ci by @intgr in #408
- CI: Always install django-stubs from git master by @intgr in #417
- Update compatible-mypy to 1.3.0 by @intgr in #416
- Version 3.14.1 release by @intgr in #422
New Contributors
- @realsuayip made their first contribution in #394
- @namper made their first contribution in #415
Full Changelog: 3.14.0...3.14.1
3.14.0
Headline changes
- New version scheme: djangorestframework-stubs will now use the same major.minor version number as Django REST Framework.
- mypy 1.2.0: Recommended mypy version updated to 1.2.0
- Compatibility: This is the last release to support Python 3.7.
Stubs changes
- Fixed
OrderingFilter.get_default_ordering()
return type it may returnNone
by @albertocerrone in #379 - Improve
APIException
input and detail types by @intgr in #387
Housekeeping
- Update compatible-mypy 1.2.0 by @dependabot in #392
- Version 3.14.0 release by @intgr in #398
New Contributors
- @albertocerrone made their first contribution in #379
Full Changelog: 1.10.0...3.14.0
1.10.0
What's Changed
This release updates recommended mypy version to 1.1.x.
Stubs fixes
- Allow passing
user=None
toAPIClient.force_authenticate()
method by @joshuadavidthomas in #367
Housekeeping
- Release script: Also clean build directories before a build by @intgr in #366
- Update recommended mypy & CI to 1.1.1 by @intgr in #374
- Update
django-stubs
inrequirements.txt
by @sobolevn in #376 - Version 1.10.0 release by @intgr in #377
New Contributors
- @joshuadavidthomas made their first contribution in #367
Full Changelog: 1.9.1...1.10.0
1.9.1
Emergency release to fix packaging issues in yesterday's version.
For yet unknown reasons, the wheel package of djangorestframework-stubs 1.9.0 also contained the full source code of Django REST Framework version 3.11. Thus installing djangorestframework-stubs 1.9.0 would overwrite djangorestframework files.
To fix an installation with this issue: pip uninstall djangorestframework djangorestframework-stubs && pip install djangorestframework djangorestframework-stubs==1.9.1
(tweak as necessary if you need a particular djangorestframework version)
Thanks to @monosans for debugging this issue. For details, see #362
What's Changed
Housekeeping
- Update package metadata: release notes URL, classifiers, maintainer by @intgr in #359
- Version 1.9.1 release by @intgr in #365
Project CI
- Adds
pre-commit
CI by @sobolevn in #360 - Fix strict mypy errors in plugin and scripts by @intgr in #363
- CI: Run mypy on self check by @sobolevn in #361
Full Changelog: 1.9.0...1.9.1