Skip to content

sklego/debug-pipeline-default-log

Pack Severity Fix Versions
scikit-lego info unsafe, with xpd check --fix --unsafe-fixes All versions

log_callback="default" logs at level INFO, which Python hides until logging is set up, so the pipeline prints nothing. Call logging.basicConfig(level=logging.INFO) first, or pass a callback that prints.

import logging
logging.basicConfig(level=logging.INFO)
pipeline = DebugPipeline(steps, log_callback="default")

The rule reports log_callback="default" on DebugPipeline and make_debug_pipeline in a file that neither imports logging nor uses pytest's caplog. The default callback logs each step at level INFO, which Python hides until logging is set up.

The default callback sends its records to the sklego.pipeline logger.

With --unsafe-fixes, xpd uses a callback that prints the step type and elapsed time.

Without the setup, fitting the pipeline printed 0 characters. After logging.basicConfig(level=logging.INFO) it logged one line for each step, such as [StandardScaler()] shape=(400, 6) time=0s. Logging may be set up in another module, so the rule is info.

log_callback="default" logs at level INFO, which Python hides until logging is set up, so the pipeline printed 0 characters. Call logging.basicConfig(level=logging.INFO) first, or pass a callback that prints.

See all rules in the scikit-lego pack.