Skip to content

Releases: typeddjango/djangorestframework-stubs

3.15.1

11 Sep 20:47
5ac9749
Compare
Choose a tag to compare

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 as Validator.message and missing_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 to Token by @sobolevn in #644
  • Set configured user model as request.user by @flaeppe in #651
  • Add accepted_renderer, accepted_media_type to Request and Response by @q0w in #649
  • Version 3.15.1 release by @intgr in #659

New Contributors

Full Changelog: 3.15.0...3.15.1

3.15.0

30 Apr 19:55
6e22a6f
Compare
Choose a tag to compare

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 for SearchFilter by @saJaeHyukc in #574
  • Add get_field_name function of AutoSchema by @saJaeHyukc in #575
  • Move fields.set_value to Serializer.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 to CustomScalar by @saJaeHyukc in #586
  • Add is_already_registered function of BaseRouter 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 of ListSerializer 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] for RegexField 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 to ModelSerializer.__init__() default= and initial= 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 for ListField.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 and mypy 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

Full Changelog: 3.14.5...3.15.0

3.14.5

05 Dec 19:20
2cee23a
Compare
Choose a tag to compare

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 extra djangorestframework-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

  • Allow None for several Field constructor arguments by @intgr in #498

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 and ListSerializer method to_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

18 Oct 16:51
0ce366f
Compare
Choose a tag to compare

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 extra djangorestframework-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 for HyperlinkedRelatedField.get_url(format=) parameter by @4c0n in #485
  • Allow None for Pagination.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

  • @4c0n made their first contribution in #485

Full Changelog: 3.14.3...3.14.4

3.14.3

04 Oct 21:00
fc62c8e
Compare
Choose a tag to compare

Headline changes

  • mypy 1.5: Recommended mypy version updated to 1.5.x

Stubs additions

  • Specify return type for APIClient.credentials method by @ltakens in #469

Stubs fixes

  • Fix ReturnDict and ReturnList __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

New Contributors

Full Changelog: 3.14.2...3.14.3

3.14.2

27 Jun 17:54
7c57faf
Compare
Choose a tag to compare

Headline changes

  • mypy 1.4: Recommended mypy version updated to 1.4.x

Stubs fixes

  • Allow arbitrary nesting in APIException detail types by @intgr in #438

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 from ruff 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

02 Jun 14:19
80a81fd
Compare
Choose a tag to compare

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 to Any by @realsuayip in #394
  • Allow passing lazy translation strings to RelatedField and subclasses by @nils-van-zuijlen in #405
  • Replaced OrderedDict with dict by @terencehonles in #414
  • Changed from list to abstract Sequence type for http verbs by @namper in #415
  • Removed long-deprecated Request properties DATA, 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

Full Changelog: 3.14.0...3.14.1

3.14.0

27 Apr 14:17
6873b75
Compare
Choose a tag to compare

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 return None by @albertocerrone in #379
  • Improve APIException input and detail types by @intgr in #387

Housekeeping

New Contributors

Full Changelog: 1.10.0...3.14.0

1.10.0

16 Mar 14:57
0752c40
Compare
Choose a tag to compare

What's Changed

This release updates recommended mypy version to 1.1.x.

Stubs fixes

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 in requirements.txt by @sobolevn in #376
  • Version 1.10.0 release by @intgr in #377

New Contributors

Full Changelog: 1.9.1...1.10.0

1.9.1

23 Feb 12:19
98cca07
Compare
Choose a tag to compare

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

Full Changelog: 1.9.0...1.9.1