bencher.plugins.registry ======================== .. py:module:: bencher.plugins.registry Attributes ---------- .. autoapisummary:: bencher.plugins.registry.ENTRY_POINT_GROUP bencher.plugins.registry.log bencher.plugins.registry._REGISTRY Classes ------- .. autoapisummary:: bencher.plugins.registry.PluginRegistry Functions --------- .. autoapisummary:: bencher.plugins.registry._render_error_pane bencher.plugins.registry.get_registry bencher.plugins.registry.register_plugin bencher.plugins.registry.unregister_plugin Module Contents --------------- .. py:data:: ENTRY_POINT_GROUP :value: 'bencher.plot_plugins' .. py:data:: log .. py:function:: _render_error_pane(plugin_name: str, exc: BaseException) -> panel.viewable.Viewable .. py:class:: PluginRegistry In-process registry of plot plugins, keyed by (name, backend). `name` is the chart type ("line", "heatmap", ...); `backend` is the rendering library namespace ("holoviews", "rerun", ...). Several backends may implement the same chart type; selection resolves each chart type to one implementation — the preferred backend when given, otherwise the highest-priority one. Registering an existing (name, backend) pair replaces it, which is the documented override mechanism (a user plugin replaces a built-in by sharing its name and backend, or outranks it from a different backend via priority/preference). .. py:attribute:: _plugins :type: dict[tuple[str, str], bencher.plugins.plugin.PlotPlugin] .. py:attribute:: _entry_points_loaded :value: False .. py:method:: register(plugin: bencher.plugins.plugin.PlotPlugin) -> None .. py:method:: unregister(name: str, backend: Optional[str] = None) -> None Remove a plugin. With no backend, removes every backend's implementation of that chart type. .. py:method:: clear() -> None .. py:method:: mark_entry_points_loaded() -> None Skip the entry-point scan on next lookup. Test-only helper. .. py:method:: get(name: str, backend: Optional[str] = None) -> Optional[bencher.plugins.plugin.PlotPlugin] Resolve a chart type to one implementation. With a backend, exact lookup. Without, the preferred implementation: highest priority among all backends providing `name` (ties broken by backend string for determinism). .. py:method:: implementations(name: str) -> tuple[bencher.plugins.plugin.PlotPlugin, Ellipsis] Every backend's implementation of a chart type, highest priority first. .. py:method:: all() -> tuple[bencher.plugins.plugin.PlotPlugin, Ellipsis] .. py:method:: _ensure_entry_points_loaded() -> None .. py:method:: _register_loaded(ep_name: str, obj) -> None .. py:method:: select(data: bencher.plugins.bench_data.BenchData, *, include: Optional[Iterable[str]] = None, exclude: Optional[Iterable[str]] = None, backend: Optional[str] = None, only: Optional[str] = None) -> tuple[bencher.plugins.plugin.PlotPlugin, Ellipsis] Return one matching implementation per chart type, by descending priority. - `only` short-circuits to a single named chart type (no match-filter check; explicit opt-in by name implies the user knows what they want). - `include` / `exclude` filter the candidate set by chart-type name. - `backend` states the *preferred* backend: where a chart type is implemented by several backends, the preferred one is chosen when it matches; chart types the preferred backend does not provide still render through their best other implementation. This is what lets a config flag swap the rendering library under the same set of plotters. .. py:method:: render(data: bencher.plugins.bench_data.BenchData, *, include: Optional[Iterable[str]] = None, exclude: Optional[Iterable[str]] = None, backend: Optional[str] = None, only: Optional[str] = None, strict: bool = False) -> tuple[tuple[str, panel.viewable.Viewable], Ellipsis] Run every selected plugin, returning (name, pane) pairs in priority order. With strict=False (default) a render exception is caught and replaced with a visible error pane so one broken plugin doesn't kill the report. strict=True re-raises the first failure — intended for development. .. py:data:: _REGISTRY .. py:function:: get_registry() -> PluginRegistry .. py:function:: register_plugin(plugin: bencher.plugins.plugin.PlotPlugin) -> bencher.plugins.plugin.PlotPlugin .. py:function:: unregister_plugin(name: str, backend: Optional[str] = None) -> None