[Django] #36477: Add an internal helper for deprecating positional arguments in favor of keyword-only arguments

10 views
Skip to first unread message

Django

unread,
Jun 24, 2025, 11:18:35 AMJun 24
to django-...@googlegroups.com
#36477: Add an internal helper for deprecating positional arguments in favor of
keyword-only arguments
-------------------------------------+-------------------------------------
Reporter: Sarah | Owner: Mike Edmunds
Boyce |
Type: | Status: assigned
Cleanup/optimization |
Component: Utilities | Version: dev
Severity: Normal | Keywords:
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
It is a fairly common pattern that "passing positional arguments [argument
names] to [something] is deprecated in favor of keyword-only arguments".
See #34355, #35060 and #36163 for some examples.

As this is common, it would be useful to have a utility to help do this
correctly (see #35554 for an issue we have had with this deprecation
pathway previously).
It would also be nice to have this utility documented within the
deprecation section in the contributing docs:
https://docs.djangoproject.com/en/5.2/internals/contributing/writing-code
/submitting-patches/#deprecating-a-feature

https://github.com/django/django/pull/19145 implements a decorator to do
this
--
Ticket URL: <https://code.djangoproject.com/ticket/36477>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 24, 2025, 12:29:52 PMJun 24
to django-...@googlegroups.com
#36477: Add an internal helper for deprecating positional arguments in favor of
keyword-only arguments
-------------------------------------+-------------------------------------
Reporter: Sarah Boyce | Owner: Mike
Type: | Edmunds
Cleanup/optimization | Status: assigned
Component: Utilities | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* stage: Unreviewed => Accepted

--
Ticket URL: <https://code.djangoproject.com/ticket/36477#comment:1>

Django

unread,
Jul 2, 2025, 1:36:18 PMJul 2
to django-...@googlegroups.com
#36477: Add an internal helper for deprecating positional arguments in favor of
keyword-only arguments
-------------------------------------+-------------------------------------
Reporter: Sarah Boyce | Owner: Mike
Type: | Edmunds
Cleanup/optimization | Status: assigned
Component: Utilities | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* needs_better_patch: 0 => 1
* needs_tests: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36477#comment:2>

Django

unread,
Jul 8, 2025, 9:31:21 PMJul 8
to django-...@googlegroups.com
#36477: Add an internal helper for deprecating positional arguments in favor of
keyword-only arguments
-------------------------------------+-------------------------------------
Reporter: Sarah Boyce | Owner: Mike
Type: | Edmunds
Cleanup/optimization | Status: assigned
Component: Utilities | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mike Edmunds):

* needs_better_patch: 1 => 0
* needs_tests: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/36477#comment:3>

Django

unread,
Jul 15, 2025, 1:20:28 PMJul 15
to django-...@googlegroups.com
#36477: Add an internal helper for deprecating positional arguments in favor of
keyword-only arguments
-------------------------------------+-------------------------------------
Reporter: Sarah Boyce | Owner: Mike
Type: | Edmunds
Cleanup/optimization | Status: assigned
Component: Utilities | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/36477#comment:4>

Django

unread,
Jul 16, 2025, 7:49:14 AMJul 16
to django-...@googlegroups.com
#36477: Add an internal helper for deprecating positional arguments in favor of
keyword-only arguments
-------------------------------------+-------------------------------------
Reporter: Sarah Boyce | Owner: Mike
Type: | Edmunds
Cleanup/optimization | Status: closed
Component: Utilities | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"f42b89f1bf49a5b89ed852b60f79342320a81c5e" f42b89f]:
{{{#!CommitTicketReference repository=""
revision="f42b89f1bf49a5b89ed852b60f79342320a81c5e"
Fixed #36477, Refs #36163 -- Added @deprecate_posargs decorator to
simplify deprecation of positional arguments.

This helper allows marking positional-or-keyword parameters as keyword-
only with a deprecation period, in a consistent and correct manner.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36477#comment:5>
Reply all
Reply to author
Forward
0 new messages