AutoDoc Examples

This page demonstrates .. badge-filter:: used directly with standard sphinx.ext.autodoc directives (.. autoclass:: and .. automodule::), without a separate autosummary table.

Unlike toctree or autosummary filtering — where badges are looked up from a per-page index — autodoc filtering works entirely in the DOM: badge IDs are read directly from the rendered badge spans already present on the page.

Each individual member block (method, function, attribute, …) is a filterable unit. Class containers (dl.py.class) are intentionally kept visible at all times so their remaining members are always accessible.

Filtering class members (OR mode)

The filter below wraps DataProcessor and shows only the two explicitly listed methods. Clicking a stability or area button hides methods that do not carry that badge. Because OR mode is active, selecting multiple badges broadens the visible set.

Stability
Area
class datalib.DataProcessor(config)
Stable📦Core

Process data records.

Note

Just a sample class

Parameters

configdict

Configuration mapping.

filter_records(data, predicate)
New📦Core

Return records that satisfy a predicate.

Parameters

datalist

Input records.

predicatecallable

A function that accepts a record and returns True to keep it.

Returns

list

Filtered records.

merge(left, right, on='id')
🧪Experimental📦Core

Merge two datasets on a common key.

Parameters

leftlist

Left dataset.

rightlist

Right dataset.

onstr, optional

Key field used for joining. Default is "id".

Returns

list

Merged records.

preview(data, n=5)
Beta📦Core

Return a beta preview of processed output.

Parameters

datalist

Input records.

nint, optional

Number of preview items. Default is 5.

Returns

list

run(data)
📦CoreStable

Execute the processing pipeline.

Parameters

datalist

Input records.

Returns

list

Processed records.

summarize(data, field)
📦MathDeprecated

Compute basic summary statistics for a numeric field.

Parameters

datalist

Input records.

fieldstr

Name of the numeric field to summarize.

Returns

dict

Dictionary with min, max, mean, and count keys.

to_dict(data)
🔧UtilsBeta

Convert a list of records to a column-oriented dictionary.

Parameters

datalist

Input records (list of dicts).

Returns

dict

Column-oriented mapping.

validate(data, schema=None)
Stable📦Core

Validate records against a schema.

Parameters

datalist

Input records to validate.

schemadict, optional

Validation schema. When None a default schema is used.

Returns

bool

True if all records pass validation.

Filtering module functions (AND mode)

The filter below wraps the mathlib module. In AND mode all active badges must be present simultaneously, so selecting two badges from different groups quickly narrows the list to a precise match.

Stability
Area

Example library used to demonstrate sphinx-badges autodoc integration.

All public objects carry a numpy-style Badges section using the group:name syntax. sphinx-badges parses and renders these automatically.

class datalib.DataProcessor(config)
Stable📦Core

Process data records.

Note

Just a sample class

Parameters

configdict

Configuration mapping.

filter_records(data, predicate)
New📦Core

Return records that satisfy a predicate.

Parameters

datalist

Input records.

predicatecallable

A function that accepts a record and returns True to keep it.

Returns

list

Filtered records.

merge(left, right, on='id')
🧪Experimental📦Core

Merge two datasets on a common key.

Parameters

leftlist

Left dataset.

rightlist

Right dataset.

onstr, optional

Key field used for joining. Default is "id".

Returns

list

Merged records.

preview(data, n=5)
Beta📦Core

Return a beta preview of processed output.

Parameters

datalist

Input records.

nint, optional

Number of preview items. Default is 5.

Returns

list

run(data)
📦CoreStable

Execute the processing pipeline.

Parameters

datalist

Input records.

Returns

list

Processed records.

summarize(data, field)
📦MathDeprecated

Compute basic summary statistics for a numeric field.

Parameters

datalist

Input records.

fieldstr

Name of the numeric field to summarize.

Returns

dict

Dictionary with min, max, mean, and count keys.

to_dict(data)
🔧UtilsBeta

Convert a list of records to a column-oriented dictionary.

Parameters

datalist

Input records (list of dicts).

Returns

dict

Column-oriented mapping.

validate(data, schema=None)
Stable📦Core

Validate records against a schema.

Parameters

datalist

Input records to validate.

schemadict, optional

Validation schema. When None a default schema is used.

Returns

bool

True if all records pass validation.