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

Eric V. Smith eric at trueblade.com
Mon Nov 6 19:44:03 EST 2017


On 11/6/2017 1:12 PM, Barry Warsaw wrote:
> On Nov 5, 2017, at 20:47, Nick Coghlan <ncoghlan at gmail.com> wrote:
> 
>>> warnings.silence_deprecations()
>>> python -X silence-deprecations
>>> PYTHONSILENCEDEPRECATIONS=x
>>
>> It could be interesting to combine this with Tim's suggestion of
>> putting an upper version limit on the silencing, so the above may look
>> like:
>>
>>     warnings.ignore_deprecations((3, 7))
>>     python -X ignore-deprecations=3.7
>>     PYTHONIGNOREDEPRECATIONS=3.7
> 
> That could be cool as long as we also support wildcards, e.g. defaults along the lines of my suggestions above to ignore everything.

I'd like to see a command line or environment variable that says: "turn 
on deprecation warnings (and/or pending deprecation warnings), but do 
not show warnings for this list of modules (possibly regex's)".

Like:
PYTHONDEPRECATIONWARNINGSEXCEPTFOR=PIL,requests.*

Then I'd just turn it on for all modules (empty string?), and when I got 
something that was flooding me with output I'd add it to the list.

Eric.


More information about the Python-Dev mailing list