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§

class jupyter_format.contents_manager.FileContentsManager(*args, **kwargs)[source]§

JupyterLab and Classic Notebook integration.

Add the following line to your

c.NotebookApp.contents_manager_class = 'jupyter_format.contents_manager.FileContentsManager'

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(*args, **kwargs)[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(*args, **kwargs)[source]§
class jupyter_format.exporters.HTMLExporter(*args, **kwargs)[source]§

See nbconvert.exporters.HTMLExporter.

class jupyter_format.exporters.LatexExporter(*args, **kwargs)[source]§

See nbconvert.exporters.LatexExporter.

class jupyter_format.exporters.MarkdownExporter(*args, **kwargs)[source]§

See nbconvert.exporters.MarkdownExporter.

class jupyter_format.exporters.NotebookExporter(*args, **kwargs)[source]§

See nbconvert.exporters.NotebookExporter.

class jupyter_format.exporters.PDFExporter(*args, **kwargs)[source]§

See nbconvert.exporters.PDFExporter.

class jupyter_format.exporters.PythonExporter(*args, **kwargs)[source]§

See nbconvert.exporters.PythonExporter.

class jupyter_format.exporters.RSTExporter(*args, **kwargs)[source]§

See nbconvert.exporters.RSTExporter.

class jupyter_format.exporters.ScriptExporter(*args, **kwargs)[source]§
class jupyter_format.exporters.SlidesExporter(*args, **kwargs)[source]§

See nbconvert.exporters.SlidesExporter.

class jupyter_format.exporters.TemplateExporter(*args, **kwargs)[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.