sphinx_gallery.notebook¶
Parser for Jupyter notebooks¶
Class that holds the Jupyter notebook information
Functions¶
-
sphinx_gallery.notebook.
add_code_cell
(work_notebook, code)¶ Add a code cell to the notebook
Parameters: code (str) – Cell content
-
sphinx_gallery.notebook.
add_markdown_cell
(work_notebook, text)¶ Add a markdown cell to the notebook
Parameters: code (str) – Cell content
-
sphinx_gallery.notebook.
directive_fun
(match, directive)¶ Helper to fill in directives
-
sphinx_gallery.notebook.
fill_notebook
(work_notebook, script_blocks)¶ Writes the Jupyter notebook cells
Parameters: script_blocks (list of tuples) –
-
sphinx_gallery.notebook.
jupyter_notebook
(script_blocks)¶ Generate a Jupyter notebook file cell-by-cell
Parameters: script_blocks (list) – script execution cells
-
sphinx_gallery.notebook.
jupyter_notebook_skeleton
()¶ Returns a dictionary with the elements of a Jupyter notebook
-
sphinx_gallery.notebook.
python_to_jupyter_cli
(args=None, namespace=None)¶ Exposes the jupyter notebook renderer to the command line
Takes the same arguments as ArgumentParser.parse_args
-
sphinx_gallery.notebook.
replace_py_ipynb
(fname)¶ Replace .py extension in filename by .ipynb
-
sphinx_gallery.notebook.
rst2md
(text)¶ Converts the RST text from the examples docstrigs and comments into markdown text for the Jupyter notebooks
-
sphinx_gallery.notebook.
save_notebook
(work_notebook, write_file)¶ Saves the Jupyter work_notebook to write_file
-
sphinx_gallery.notebook.
split_code_and_text_blocks
(source_file)¶ Return list with source file separated into code and text blocks.
Returns: - file_conf (dict) –
File-specific settings given in comments as:
# sphinx_gallery_<name> = <value>
- blocks (list of (label, content)) – List where each element is a tuple with the label (‘text’ or ‘code’), and content string of block.
- file_conf (dict) –
File-specific settings given in comments as:
Classes¶
-
class
sphinx_gallery.notebook.
partial
¶ partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.
-
__call__
¶
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
args
¶ tuple of arguments to future partial calls
-
func
¶ function object to use in future partial calls
-
keywords
¶ dictionary of keyword arguments to future partial calls
-