Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#25999 closed Cleanup/optimization (fixed)

Remove making deprecation warnings loud by default

Reported by: Tim Graham Owned by: Tim Graham
Component: Core (Other) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

See #18985 for the background of why we route warnings through logging.

However, this idea is slightly flawed given our current deprecation scheme. If a third-party library wants to support both 1.8 and 1.11 (next LTS) would have to use a try (new import)/except (old import) pattern to avoid code running on 1.11 from raising deprecation warnings (some pending deprecation in 1.10, deprecated in 1.11, and removed in 2.0). In my mind, part of the purpose of the new policy was to avoid this type of complexity.

For that reason, I think we should reconsider making Django's deprecation warnings loud by default (at least in LTS versions). Otherwise, users will pester library authors to fix those warnings and we haven't really made things easier.

Instead, the idea would be for library authors to continue using the deprecated APIs while supporting the LTS in which they are deprecated and the previous LTS. When the version of Django following the LTS is released, library authors can then drop support for all Django versions before the LTS, check their package with the LTS using python -Wd and make the deprecation warning fixes, then seamlessly add support for the next version of Django.

Change History (6)

comment:1 Changed 7 years ago by Tim Graham

I raised a proposal to discontinue making RemovedInNextVersionWarning loud by default.

comment:2 Changed 6 years ago by Tim Graham

Component: DocumentationCore (Other)
Owner: changed from nobody to Tim Graham
Status: newassigned
Summary: Document why Django makes its deprecation warnings loud by default and how to silence themRemove making deprecation warnings loud by default

comment:3 Changed 6 years ago by Tim Graham

Description: modified (diff)
Has patch: set

comment:4 Changed 6 years ago by Claude Paroz

Triage Stage: AcceptedReady for checkin

I'm a bit torn by this issue. I understand the current policy is making things complex for 3-party apps to prevent warnings. On another side, I always considered prominent deprecation warnings as a feature of Django, as it helps so much to keep clean up-to-date code in your project. Let's educate developers to think a bit more about -Wall!

comment:5 Changed 6 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 5b94b17f:

Fixed #25999 -- Removed promotion of RemovedInNextVersionWarning to loud by default.

comment:6 Changed 6 years ago by Tim Graham <timograham@…>

In 4bb70cb:

Removed an obsolete (as of refs #25999) logging test from refs #18985.

Note: See TracTickets for help on using tickets.
Back to Top