#25999: Remove making deprecation warnings loud by default
-------------------------------------+-------------------------------------
     Reporter:  timgraham            |                    Owner:  timgraham
         Type:                       |                   Status:  assigned
  Cleanup/optimization               |
    Component:  Core (Other)         |                  Version:  master
     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 timgraham):

 * has_patch:  0 => 1


Old description:

> See #18985 for the background of why we route warnings through logging.
>
> A developer can selectively silence warnings using something like this in
> an app's `AppConfig.ready()` method:
> {{{
> import warnings
> from django.utils.deprecation import RemovedInNextVersionWarning
> warnings.simplefilter("ignore", RemovedInNextVersionWarning)
> }}}
> This example can be improved to show how to silence a particular warning
> instead of all warnings.
>
> This works because `AppConfig.ready()` methods are called after
> `django.utils.log.configure_logging()` (which does
> `warnings.simplefilter("default", RemovedInNextVersionWarning)`) in
> `django.setup()`.

New description:

 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.

--

Comment:

 [https://github.com/django/django/pull/5979 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/25999#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.7fb6df076160421834c01fbda9a64cca%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to