kedro does some things when it hooks logging that ...
# beginners-need-help
a
kedro does some things when it hooks logging that it shouldn't that messes up my setup for example, loading a hardcoded default config before initialization and loading my own logging.yml. This causes the loggers to print useless config messages with the wrong formatting for numexpr and kedro project dir message It's the same case with the rich pretty hook and the callbacks. I have to redo all the rich initialization on my settings.py file.
Copy code
from 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
Copy code
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)