[Python-Dev] Proposal: go back to enabling DeprecationWarning by default

Paul Moore p.f.moore at gmail.com
Mon Nov 6 05:21:54 EST 2017


On 6 November 2017 at 03:38, Nick Coghlan <ncoghlan at gmail.com> wrote:
> - if we ever write "import foo" ourselves, then we're a Python
> developer, and it's our responsibility to work out how to manage
> DeprecationWarning when it gets raised by either our own code, or the
> libraries and frameworks that we use

As someone who was bitten by this when deprecation warnings were
displayed by default, what's the process for suppressing deprecation
warnings in modules that I import (and hence have no control over)
*without* also suppressing them for my code (where I do want to fix
them, so that my users don't have a problem)?

That's the complicated bit that needs to be in the docs - more so than
a simple pointer to how to suppress the warning altogether.

On 6 November 2017 at 06:38, Nick Coghlan <ncoghlan at gmail.com> wrote:
> Put "PYTHONWARNINGS=ignore::DeprecationWarning" before whatever
> command is giving them the warnings.
>
> Even on Windows, you can put that in a batch file with the actual
> command you want to run and silence the warnings that way.

Batch files do not behave the same in Windows as standard executables.
Having to wrap a "normal application" (for example, a script wrapper
installed via "pip install package" in a bat file is (a) messy for
inexperienced users, and (b) likely to cause weird errors (for example
nesting bat files is broken, so you can't use a "wrapped" command
transparently in another bat file without silent errors).

Paul


More information about the Python-Dev mailing list