simplebench.reporters.protocols packageπŸ”—

Protocols for reporters.

class simplebench.reporters.protocols.ChoiceProtocol(*args, **kwargs)[source]πŸ”—

Bases: Protocol

A protocol defining the essential attributes for a Choice-like object.

This ensures that any object used within a generic Choices collection has the necessary name and flags attributes for indexing and management.

property flags: Iterable[str]πŸ”—

An iterable of unique string flags (e.g., --my-flag) for the choice.

Returns:

An iterable of flags.

Return type:

Iterable[str]

property name: strπŸ”—

The unique name of the choice, used as a key.

Returns:

The name of the choice.

Return type:

str

class simplebench.reporters.protocols.ReportRenderer(*args, **kwargs)[source]πŸ”—

Bases: Protocol

A protocol for render methods in Reporters.

Defines a method signature for rendering benchmark results for a given Case and Section.

The signature must match the following:

def method_name(self, *, case: Case, section: Section, options: ReporterOptions) -> str | bytes | Text | Table:

Subsets of str | bytes | Text | Table for the return type are allowed for specific reporters.

class simplebench.reporters.protocols.ReporterCallback(*args, **kwargs)[source]πŸ”—

Bases: Protocol

A protocol for callback functions used by Case and Reporters.

Defines a method signature for a reporter callback function.

The method’s signature must match the following:

def method_name(self, *, case: Case, section: Section, output_format: Format, output: Any) -> None:

SubmodulesπŸ”—