Opened 9 hours ago
Last modified 8 hours ago
#36477 assigned Cleanup/optimization
Add an internal helper for deprecating positional arguments in favor of keyword-only arguments
Reported by: | Sarah Boyce | Owned by: | Mike Edmunds |
---|---|---|---|
Component: | Utilities | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Mike Edmunds, Adam Johnson | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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