This page was generated from doc/api.jupyter. Interactive online version: Binder badge.

This notebook contains mostly “raw” cells in reStructuredText format, which are used to auto-generate the …

API Documentation§


Generator yielding lines to be written to .jupyter files.

Each of the lines has a line separator at the end, therefore it can e.g. be used in writelines().


nb (nbformat.NotebookNode) – A notebook node.


Convert a Jupyter notebook to a string in .jupyter format.


nb (nbformat.NotebookNode) – A notebook node.


.jupyter file content.

Return type:



Convert .jupyter string representation to Jupyter notebook.

Lines have to be terminated with '\n' (a.k.a. universal newlines mode).

If source is an iterable, line terminators may be omitted.


source (str or iterable of str) – Content of .jupyter file.


A notebook node.

Return type:


exception jupyter_format.ParseError[source]§

Exception that is thrown on errors during reading.

This reports the line number where the error occured.

Contents Manager§

Exporters for nbconvert§

class jupyter_format.exporters.JupyterImportMixin[source]§

Allow *.jupyter files as input to exporters.

This is used in all exporters as a “mixin” class.

from_file(file, resources=None, jupyter_format=None, **kw)[source]§
from_filename(filename, resources=None, **kw)[source]§
class jupyter_format.exporters.JupyterExporter(**kwargs: Any)[source]§

Convert Jupyter notebooks to .jupyter format.

from_notebook_node(nb, resources=None, **kw)[source]§

The rest of the exporters are just the ones from nbconvert.exporters, enhanced with the JupyterImportMixin.

class jupyter_format.exporters.ASCIIDocExporter(**kwargs: Any)[source]§
class jupyter_format.exporters.HTMLExporter(**kwargs: Any)[source]§

See nbconvert.exporters.HTMLExporter.

class jupyter_format.exporters.LatexExporter(**kwargs: Any)[source]§

See nbconvert.exporters.LatexExporter.

class jupyter_format.exporters.MarkdownExporter(**kwargs: Any)[source]§

See nbconvert.exporters.MarkdownExporter.

class jupyter_format.exporters.NotebookExporter(**kwargs: Any)[source]§

See nbconvert.exporters.NotebookExporter.

class jupyter_format.exporters.PDFExporter(**kwargs: Any)[source]§

See nbconvert.exporters.PDFExporter.

class jupyter_format.exporters.PythonExporter(**kwargs: Any)[source]§

See nbconvert.exporters.PythonExporter.

class jupyter_format.exporters.RSTExporter(**kwargs: Any)[source]§

See nbconvert.exporters.RSTExporter.

class jupyter_format.exporters.ScriptExporter(**kwargs: Any)[source]§
class jupyter_format.exporters.SlidesExporter(**kwargs: Any)[source]§

See nbconvert.exporters.SlidesExporter.

class jupyter_format.exporters.TemplateExporter(**kwargs: Any)[source]§

See nbconvert.exporters.TemplateExporter.

Batch Conversion with replace_all§

Script to recursively replace .ipynb with .jupyter files.


python3 -m jupyter_format.replace_all --recursive --yes

WARNING: This deletes all original files!

Usage to apply this to the whole history of a Git branch:

git filter-branch --tree-filter "python3 -m jupyter_format.replace_all --recursive --yes"

Replace given .ipynb file with a .jupyter file.

WARNING: This deletes the original file!


path (os.PathLike or str) – Path to .ipynb file.

jupyter_format.replace_all.replace_all_recursive(start_dir, mapfunction=<class 'map'>)[source]§

Replace all .ipynb files recursively.

WARNING: This deletes all original files!

  • path (os.PathLike or str) – Starting directory.

  • mapfunctionmap()-like function that can be provided in order to enable parallelization.