Skip to content

sklego/debug-pipeline-default-log

Rule debug-pipeline-default-log
Pack scikit-lego
Severity info
Fix none, edit by hand
Library versions every version

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.

xpd has no automatic fix, so make the change by hand.

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.

xpd prints this message with the issue. A name that starts with $ stands for code from your file.

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.

Browse the other rules of the scikit-lego pack.