Jaymon / pout

Python pretty print on steroids
MIT License
29 stars 0 forks source link

pout method to ignore deprecation errors? #73

Open Jaymon opened 2 years ago

Jaymon commented 2 years ago

Since developing on python3 full time I've been super annoyed by how many deprectation warnings I get in libraries I have no control over, this works in sitecustomize.py to get rid of the errors:

import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)

But I would like to see deprecation warnings for my own code. I think a solution could be having a pout method I could call at the top of the script or in sitecustomize.py that would set up a filter and only suprress the warning in site-modules installed python modules and let everything else through.

Looking at the filterwarnings docs it doesn't appear to have just like a callback I can pass it or anything, it does have a module that is a regex to filter modulepaths I would guess, but I would need to run some tests.

I think I could track the code down and find out how it is doing it and maybe add a logging filter or something also.

I got the above code from here