I am working on a python library where we sometimes display user warnings using pythons warnings module. We now want to be able to turn off all of this warnings based on a flag passed to the python interpreter.
I read that the __init__
files are actually called first when importing a library but putting
import warnings
warnings.simplefilter('ignore')
in the highest level __init__.py
does not change anything.
Are these options only for the current file? I am looking for a place where I can turn off all warnings in the library, because I don't want to manage this in every single file separately.