antheas
10/01/2022, 5:22 PMfrom rich.traceback import install
from .progress import RICH_TRACEBACK_ARGS
logging.captureWarnings(True)
# TODO: verify this works
# remove handlers added by the default config
logging.getLogger("kedro").handlers = []
logging.root.handlers = []
install(**RICH_TRACEBACK_ARGS)
I also don't like how rich decides to use html elements for logging and formatting in jupyter, because it's clunky, larger (at least in vs code), and doesn't have a stable appearance when I commit my notebooks, so I need to run the following botch function after reload_kedro
def _reconfigure_rich():
from rich import reconfigure, _console
_rich_console_args = {
"width": PBAR_JUP_NCOLS,
"height": 100,
}
reconfigure(**_rich_console_args)
# Disable html rendering when using jupyter
# force_jupyter=False messes with pretty print
_console_check_buffer = _console._check_buffer
def non_html_check_buffer(self):
tmp = self.is_jupyter
self.is_jupyter = False
_console_check_buffer.__get__(self)()
self.is_jupyter = tmp
_console._check_buffer = non_html_check_buffer.__get__(_console)