Skip to content

stats: styling classes' requires_summary is never checked against the stats the pipeline provides #964

Description

@paddymul

Problem

A styling class declares the summary stats it needs in requires_summary, e.g. DefaultMainStyling.requires_summary = ["histogram", "is_numeric", "dtype", "_type"] (buckaroo/customizations/styling.py:67). Nothing checks that the stats pipeline actually provides them. StatPipeline._normalize_inputs treats styling ColAnalysis classes as no-ops (buckaroo/pluggable_analysis_framework/stat_pipeline.py:51), so their requires_summary never enters the DAG validation that @stat functions go through.

When a required stat is missing, what happens depends on how style_column reads it:

  • DefaultMainStyling.style_column checks for _type and returns an obj displayer if it is absent (styling.py:77). The column renders plain with no warning.
  • If style_column raises instead, StylingAnalysis.style_columns swallows the exception when col_meta is empty and requires_summary is non-empty (buckaroo/dataflow/styling_core.py:470), and falls back to default_styling. It only logs a warning when col_meta is non-empty.

Impact

A styling class used with a backend or stat set that doesn't compute its inputs produces plain columns instead of an error. This matters more now that styling is meant to be backend-generic (#928 types the styling frame argument as DataFrameLike and the analysis lists as ColAnalysis).

Suggested fix

When the pipeline is built, check each styling class's requires_summary against the union of stats the @stat functions provide, and warn (or raise under debug=True) naming the class and the missing keys. Keep the per-column fallback for the startup case where col_meta is legitimately empty.

Context

Identified while typing the dataflow pipeline in #928.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions