Blocks#

Blocks are modular content units used to structure a Report. They define how runs are structured, however not how they are rendered or exported.

Each block operates on a list of Run objects, either globally (from the report) or locally via the runs argument.

Tip

To create custom blocks, inherit from AbstractBlock and implement the build() method.

Abstract Block#

class ablate.blocks.AbstractBlock(runs=None)[source]#

Abstract content block for a report.

Parameters:

runs (Optional[List[Run]]) – Optional list of runs to be used for the block instead of the default runs from the report. Defaults to None.

abstract build(runs)[source]#

Build the intermediate representation of the block, ready for rendering and export.

Parameters:

runs (List[Run]) – List of runs to be used for the block.

Return type:

Any

Returns:

The intermediate representation of the block.

Text Blocks#

class ablate.blocks.AbstractTextBlock(text, runs=None)[source]#

Block containing styled text for a report.

Parameters:
  • text (str) – The text content of the block.

  • runs (Optional[List[Run]]) – Optional list of runs to be used for the block instead of the default runs from the report. Defaults to None.

build(runs)[source]#

Build the intermediate representation of the block, ready for rendering and export.

Parameters:

runs (List[Run]) – List of runs to be used for the block.

Return type:

str

Returns:

The intermediate representation of the block.

class ablate.blocks.Text(text, runs=None)[source]#

Block containing styled text for a report.

Parameters:
  • text (str) – The text content of the block.

  • runs (Optional[List[Run]]) – Optional list of runs to be used for the block instead of the default runs from the report. Defaults to None.

class ablate.blocks.H1(text, runs=None)[source]#

Block containing styled text for a report.

Parameters:
  • text (str) – The text content of the block.

  • runs (Optional[List[Run]]) – Optional list of runs to be used for the block instead of the default runs from the report. Defaults to None.

class ablate.blocks.H2(text, runs=None)[source]#

Block containing styled text for a report.

Parameters:
  • text (str) – The text content of the block.

  • runs (Optional[List[Run]]) – Optional list of runs to be used for the block instead of the default runs from the report. Defaults to None.

class ablate.blocks.H3(text, runs=None)[source]#

Block containing styled text for a report.

Parameters:
  • text (str) – The text content of the block.

  • runs (Optional[List[Run]]) – Optional list of runs to be used for the block instead of the default runs from the report. Defaults to None.

class ablate.blocks.H4(text, runs=None)[source]#

Block containing styled text for a report.

Parameters:
  • text (str) – The text content of the block.

  • runs (Optional[List[Run]]) – Optional list of runs to be used for the block instead of the default runs from the report. Defaults to None.

class ablate.blocks.H5(text, runs=None)[source]#

Block containing styled text for a report.

Parameters:
  • text (str) – The text content of the block.

  • runs (Optional[List[Run]]) – Optional list of runs to be used for the block instead of the default runs from the report. Defaults to None.

class ablate.blocks.H6(text, runs=None)[source]#

Block containing styled text for a report.

Parameters:
  • text (str) – The text content of the block.

  • runs (Optional[List[Run]]) – Optional list of runs to be used for the block instead of the default runs from the report. Defaults to None.

Table Blocks#

class ablate.blocks.AbstractTableBlock(columns, runs=None)[source]#

Table block for a report.

Parameters:
  • columns (List[AbstractSelector]) – Columns to be included in the table. Each column is defined by a selector that extracts the data from the runs.

  • runs (Optional[List[Run]]) – Optional list of runs to be used for the block instead of the default runs from the report. Defaults to None.

abstract build(runs)[source]#

Build the intermediate representation of the block, ready for rendering and export.

Parameters:

runs (List[Run]) – List of runs to be used for the block.

Return type:

DataFrame

Returns:

The intermediate representation of the block.

class ablate.blocks.Table(columns, runs=None)[source]#

Table block for a report.

Parameters:
  • columns (List[AbstractSelector]) – Columns to be included in the table. Each column is defined by a selector that extracts the data from the runs.

  • runs (Optional[List[Run]]) – Optional list of runs to be used for the block instead of the default runs from the report. Defaults to None.

build(runs)[source]#

Build the intermediate representation of the block, ready for rendering and export.

Parameters:

runs (List[Run]) – List of runs to be used for the block.

Return type:

DataFrame

Returns:

The intermediate representation of the block.

Metric Blocks#

class ablate.blocks.AbstractFigureBlock(runs=None)[source]#

Abstract content block for a report.

Parameters:

runs (Optional[List[Run]]) – Optional list of runs to be used for the block instead of the default runs from the report. Defaults to None.

abstract build(runs)[source]#

Build the intermediate representation of the block, ready for rendering and export.

Parameters:

runs (List[Run]) – List of runs to be used for the block.

Return type:

DataFrame

Returns:

The intermediate representation of the block.

class ablate.blocks.MetricPlot(metrics, identifier=None, runs=None)[source]#

Block for plotting metrics over time.

Parameters:
  • metrics (Union[AbstractMetric, List[AbstractMetric]]) – Metric or list of metrics to be plotted over time.

  • identifier (Optional[Param]) – Optional identifier for the runs. If None, the run ID is used. Defaults to None.

  • runs (Optional[List[Run]]) – Optional list of runs to be used for the block instead of the default runs from the report. Defaults to None.

build(runs)[source]#

Build the intermediate representation of the block, ready for rendering and export.

Parameters:

runs (List[Run]) – List of runs to be used for the block.

Return type:

DataFrame

Returns:

The intermediate representation of the block.