bencher

Bencher: parameter sweeps, result collection and reports.

Every public name loads on first use (PEP 562 __getattr__), not at import bencher. Most of the package needs numpy, xarray, param, holoviews and panel, but some entry points do not: bencher.scorecard only reads summary JSON and renders HTML. An eager __init__ made import bencher.scorecard load the whole plotting stack, so a consumer that only renders scorecards paid for all of it. from bencher import X and bencher.X work as before; the TYPE_CHECKING block below gives type checkers and IDEs the same names, and test/test_lazy_init.py keeps it and _EXPORTS in step.

Submodules

Attributes

VideoResult

_EXPORTS

_NAME_TO_MODULE

_ALIASES

_RERUN_EXPORTS

_DEPRECATED_ALIASES

__all__

_SHADOWED_BY_SUBMODULE

Classes

_BencherModule

Functions

_requires_rerun(name) → type

Build a stand-in for a rerun-only export that is not importable.

__getattr__(name) → Any

__dir__() → list[str]

Package Contents

bencher.VideoResult
bencher._EXPORTS: dict[str, tuple[str, ...]]
bencher._NAME_TO_MODULE
bencher._ALIASES
bencher._RERUN_EXPORTS = ('capture_rerun_rrd', 'capture_rerun_window', 'rerun_to_pane')
bencher._DEPRECATED_ALIASES
bencher.__all__
bencher._requires_rerun(name: str) → type

Build a stand-in for a rerun-only export that is not importable.

bencher.utils_rerun is the one module in the package that imports rerun at module scope, so it is the one whose names could go missing. They used to be bound only inside a try/except ModuleNotFoundError: on an install without rerun-sdk they simply did not exist, and bn.capture_rerun_rrd raised AttributeError: module 'bencher' has no attribute ..., naming neither the optional dependency nor how to get it. It also made bencher’s public surface partial – the state ty reports as possibly-missing-attribute, which a reader has no way to discharge. The names now always exist; using one without the extra raises an ImportError that says what to install.

A class rather than a function, so isinstance against the placeholder stays legal. Deliberately a plain class: an earlier revision gave it a metaclass whose __getattr__ raised ImportError so attribute access would be branded too, but hasattr and getattr(x, n, default) only swallow AttributeError, so that turned every defensive feature probe into an uncatchable-by-idiom crash – on exactly the installs least able to diagnose it. All three names here are functions, called rather than read, so there is nothing for such a hook to protect.

bencher.__getattr__(name: str) → Any
bencher.__dir__() → list[str]
bencher._SHADOWED_BY_SUBMODULE
class bencher._BencherModule

Bases: types.ModuleType

__setattr__(name: str, value: Any) → None