core.warnings: handle stacklevel properly

add more warnings about deprecated config arguments
This commit is contained in:
Dima Gerasimov 2020-09-27 18:00:19 +02:00 committed by karlicoss
parent 109edd9da3
commit abbaa47aaf
4 changed files with 18 additions and 12 deletions

View file

@ -1,9 +1,8 @@
'''
Some backwards compatibility stuff/deprecation helpers
'''
import warnings
from ..common import LazyLogger
from . import warnings
from .common import LazyLogger
logger = LazyLogger('my.core.compat')
@ -23,11 +22,10 @@ def pre_pip_dal_handler(
raise e
try:
dal = _get_dal(cfg, name)
# todo this is fairly high severity, would be nice to highlight in the terminal or something
warnings.warn(f'''
warnings.high(f'''
Specifying modules' dependencies in the config or in my/config/repos is deprecated!
Please install {' '.join(requires)} as PIP packages (see the corresponding README instructions).
'''.strip())
'''.strip(), stacklevel=2)
except ModuleNotFoundError as ee:
dal = None