bundles / papyri 0.0.10 / papyri / directives / make_plot_handler
function
papyri.directives:make_plot_handler
source: /papyri/directives.py :379
Signature
def make_plot_handler ( asset_store : Callable[[str, bytes], None] | None , module : str , version : str , execute : bool = False , qa : str = plot ) → Callable[[str, dict[str, str], str], list[Any]] Summary
Return a .. plot:: directive handler bound to the given execution context.
Extended Summary
When execute is True and asset_store is available the code body is run via BlockExecutor (same mechanism as doctest examples in gen.py). Every matplotlib figure open after the run is saved as a bundle asset and appended as a Figure node after the Code node.
When execute is False (or matplotlib / asset_store are absent) the code body is returned as a bare Code node so the example is not lost.
If the directive argument names an external .py script file rather than providing an inline body, a warning is emitted and nothing is returned (filesystem access is not available inside the handler).
Aliases
-
papyri.directives.make_plot_handler