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.inflectionby @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
DefaultRouterconstructor and attributes by @intgr in #610 - Remove obsolete
RenameRouterMethodsmetaclass by @intgr in #612 - Accept
StrPromiseasValidator.messageandmissing_messageby @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.utilsby @DongwookKim0823 in #633 - Fix
APIRequestFactorymethod signatures by @DongwookKim0823 in #634 - Update mypy to 1.11.0 by @sobolevn in #642
- Add
objectsattribute toTokenby @sobolevn in #644 - Set configured user model as
request.userby @flaeppe in #651 - Add
accepted_renderer,accepted_media_typetoRequestandResponseby @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
ValidationErrorparams=argument &default_paramsattribute by @intgr in #338 - Add
SimpleRouteruse_regex_pathargument by @intgr in #344 - Add
construct_searchfunction queryset argument forSearchFilterby @saJaeHyukc in #574 - Add
get_field_namefunction ofAutoSchemaby @saJaeHyukc in #575 - Move
fields.set_valuetoSerializer.set_valueby @saJaeHyukc in #576 - Remove
compat.distinctfunction by @saJaeHyukc in #579 - Add
fields.loggingby @saJaeHyukc in #581 - Add
RemovedInDRF317Warningby @saJaeHyukc in #578 - Add
DecimalFieldnormalize_outputargument by @saJaeHyukc in #584 - Add
serializers.LIST_SERIALIZER_KWARGS_REMOVEby @saJaeHyukc in #580 - Add
represent_timedelta, a function related toCustomScalarby @saJaeHyukc in #586 - Add
is_already_registeredfunction ofBaseRouterby @saJaeHyukc in #587 - Add
__class_getitem__of classes by @saJaeHyukc in #585 - Add
optional_logoutcsrf_tokenargument by @saJaeHyukc in #589 - Add
run_child_validationfunction ofListSerializerby @saJaeHyukc in #590 - Add
filters.search_smart_splitby @saJaeHyukc in #592 - Add functions related to
UniqueConstraintby @saJaeHyukc in #591
Stubs changes
- allow floats for _GetDataType by @asottile-sentry in #546
- Use
Pattern[str]forRegexFieldby @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,emptytoModelSerializer.__init__()default=andinitial=kwargs by @intgr in #521 - Add
ViewSetAction.__name__attribute by @igorgaming in #567 - Make
HyperlinkedModelSerializergeneric by @intgr in #595 - Fix
HyperlinkedRelatedField.get_object()argument types by @intgr in #597 - Allow
NoneforListField.min/max_lengthby @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-commitby @sobolevn in #550 - Bump
pytest-mypy-pluginsandmypyby @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
stubtestby @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
mypydev 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
Fieldsubclasses 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
BaseSerializerandListSerializermethodto_representation()by @intgr in #509 - Allow
http.HTTPMethodenum values in@action()decorator by @sshishov in #512
Housekeeping
- Dropped hard dependency on mypy by @intgr in #495
- Tests: Allowlist stubtest
@cached_propertyerror 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
mypydev 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
NoneforHyperlinkedRelatedField.get_url(format=)parameter by @4c0n in #485 - Allow
NoneforPagination.templateattribute 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.iniconfig 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
Nonereturn 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
ReturnDictandReturnList__init__signatures by @moosbruggerj in #452 - Annotate
Field.default_error_messagesas a ClassVar by @brianhelba in #464 - Specify that
Request.parser_contextcan never be None by @intgr in #476
Documentation
- Add FAQ section in README to explain usage of generics with
ModelSerializerby @browniebroke in #444
Housekeeping
- Convert _typeshed.Self usages to typing_extensions.Self (PEP 673) by @intgr in #441
django_stubs_extwas renamed toextby @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
pyupgradefromruffby @sobolevn in #428 - Remove unused
DjangoContextcreation 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 toAnyby @realsuayip in #394 - Allow passing lazy translation strings to
RelatedFieldand subclasses by @nils-van-zuijlen in #405 - Replaced
OrderedDictwithdictby @terencehonles in #414 - Changed from
listto abstractSequencetype for http verbs by @namper in #415 - Removed long-deprecated
RequestpropertiesDATA,QUERY_PARAMSby @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 returnNoneby @albertocerrone in #379 - Improve
APIExceptioninput 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=NonetoAPIClient.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-stubsinrequirements.txtby @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-commitCI 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