sphinx_gallery.gen_rst#

reST file generator.

Generate the rst files for the examples by iterating over the python example files.

Files that generate images should start with β€˜plot’.

Functions#

sphinx_gallery.gen_rst.codestr2rst(codestr: str, lang: str = 'python', lineno: int | None = None) str[source]#

Return reStructuredText code block from code string.

Classes#

class sphinx_gallery.gen_rst.ExampleCost(execution_time: float, memory: float, src_file: str, target_dir: str)[source]#

Runtime cost of a single example script.

execution_time#

Execution time in seconds.

Type:

float

memory#

Peak memory usage in MB.

Type:

float

src_file#

Path to the source Python file.

Type:

str

target_dir#

Path to the target output directory.

Type:

str

sort_key() tuple[float, float, str][source]#

Return sort key for consistent ordering.

Returns tuple of: descending time, descending memory, ascending filename. This orders examples to show the most expensive/problematic ones first.