Changes in nbconvert


The following 24 authors and reviewers contributed 224 commits – Thank you all! * 00Kai0 * Aidan Feldman * Alex Rudy * Alexander Kapshuna * Alexander Rudy * amniskin * Carol Willing * Dustin H * Hsiaoming Yang * imtsuki * Jessica B. Hamrick * KrokodileDandy * Kunal Marwaha * Matthew Seal * Matthias Geier * Miro Hrončok * M Pacer * Nils Japke * njapke * Sebastian Führ * Sylvain Corlay * Tyler Makaro * Valery M * Wayne Witzel

The full list of changes they made can be seen `on GitHub <<>`__

Significant Changes

Jupter Client Pin

The jupyter_client dependency is now pinned to >5.3.1. This is done to support the Parallel NBConvert below, and future versions may require interface changes from that version.

Parallel NBConvert

NBConvert --execute can now be run in parallel via threads, multiprocessing, or async patterns! This means you can now parallelize nbconvert via a bash loop, or a python concurrency pattern and it should be able to execute those notebooks in parallel.

Kernels have varying support for safe concurrent execution. The ipython kernel (ipykernel version 1.5.2 and higher) should be safe to run concurrently using Python 3. However, the Python 2 ipykernel does not always provide safe concurrent execution and sometimes fails with a socket bind exception. Unlike ipykernel which is maintained by the project, other community-maintained kernels may have varying support for concurrent execution, and these kernels were not tested heavily.

Issues for nbconvert can be viewed here: PR #1018:, and PR #1017:

Execute Loop Rewrite

This release completely rewrote the execution loop responsible for monitoring kernel messages until cell execution is completed. This removes an error where kernel messages could be dropped if too many were posted too quickly. Furthermore, the change means that messages are not buffered. Now, messages can be logged immediately rather than waiting for the cell to terminate.

See PR #994: for exact code changes if you’re curious.

Comprehensive notes

New Features

  • Make a default global location for custom user templates PR #1028:

  • Parallel execution improvements PR #1018:, and PR #1017:

  • Added store_history option to preprocess_cell and run_cell PR #1055:

  • Simplify the function signature for preprocess() PR #1042:

  • Set flag to not always stop kernel execution on errors PR #1040:

  • setup_preprocessor passes kwargs to start_new_kernel PR #1021:

Fixing Problems

  • Very fast stream outputs no longer drop some messages PR #994:

  • LaTeX errors now properly raise exceptions PR #1053:

  • Improve template whitespacing PR #1076:

  • Fixes for character in LaTeX exports and filters PR #1068:, PR #1039:, PR #1024:, and PR #1077:

  • Mistune pinned in preparation for 2.0 release PR #1074:

  • Require mock only on Python 2 PR #1060: and PR #1011:

  • Fix selection of mimetype when converting to HTML PR #1036:

  • Correct a few typos PR #1029:

  • Update export_from_notebook names PR #1027:

  • Dedenting html in ExtractOutputPreprocessor PR #1023:

  • Fix backwards incompatibility with markdown2html PR #1022:

  • Fixed html image tagging PR #1013:

  • Remove unnecessary css PR #1010:

Testing, Docs, and Builds


The following 18 authors contributed 144 commits – Thank you all!

  • Benjamin Ragan-Kelley

  • Clayton A Davis

  • DInne Bosman

  • Doug Blank

  • Henrique Silva

  • Jeff Hale

  • Lukasz Mitusinski

  • M Pacer

  • Maarten Breddels

  • Madhumitha N

  • Matthew Seal

  • Paul Gowder

  • Philipp A

  • Rick Lupton

  • Rüdiger Busche

  • Thomas Kluyver

  • Tyler Makaro

  • WrRan

The full list of changes they made can be seen on GitHub

Significant Changes


Python 3.4 support was dropped. Many of our upstream libraries stopped supporting 3.4 and it was found that serious bugs were being caught during testing against those libraries updating past 3.4.

See PR #979 for details.

IPyWidget Support

Now when a notebook executing contains Jupyter Widgets, the state of all the widgets can be stored in the notebook’s metadata. This allows rendering of the live widgets on, for instance nbviewer, or when converting to html.

You can tell nbconvert to not store the state using the store_widget_state argument:

jupyter nbconvert --ExecutePreprocessor.store_widget_state=False --to notebook --execute mynotebook.ipynb

This widget rendering is not performed against a browser during execution, so only widget default states or states manipulated via user code will be calculated during execution. %%javascript cells will execute upon notebook rendering, enabling complex interactions to function as expected when viewed by a UI.

If you can’t view widget results after execution, you may need to select Trust Notebook under the File menu of the UI in question.

See PR #779, PR #900, and PR #983 for details.

Execute Preprocessor Rework

Based on monkey patching required in papermill the run_cell code path in the ExecutePreprocessor was reworked to allow for accessing individual message parses without reimplementing the entire function. Now there is a processs_message function which take a ZeroMQ message and applies all of its side-effect updates on the cell/notebook objects before returning the output it generated, if it generated any such output.

The change required a much more extensive test suite covering cell execution as test coverage on the various, sometimes wonky, code paths made improvements and reworks impossible to prove undamaging. Now changes to kernel message processing has much better coverage, so future additions or changes with specs over time will be easier to add.

See PR #905 and PR #982 for details

Out Of Memory Kernel Failure Catches

When running out of memory on a machine, if the kernel process was killed by the operating system it would result in a timeout error at best and hang indefinitely at worst. Now regardless of timeout configuration, if the underlying kernel process dies before emitting any messages to the effect an exception will be raised notifying the consumer of the lost kernel within a few seconds.

See PR #959, PR #971, and PR #998 for details

Latex / PDF Template Improvements

The latex template was long overdue for improvements. The default template had a rewrite which makes exports for latex and pdf look a lot better. Code cells in particular render much better with line breaks and styling the more closely matches notebook browser rendering. Thanks t-makaro for the efforts here!

See PR #992 for details

Comprehensive notes

New Features

Fixing Problems

  • Refactored execute preprocessor to have a process_message function PR #905:

  • Fixed OOM kernel failures hanging PR #959 and PR #971:

  • Fixed latex export for svg data in python 3 PR #985:

  • Enabled configuration to be shared to exporters from script exporter PR #993:

  • Make latex errors less verbose PR #988:

  • Typo in template syntax PR #984:

  • Improved attachments +fix supporting non-unique names PR #980:

  • PDFExporter “output_mimetype” traitlet is not longer ‘text/latex’ PR #972:

  • FIX: respect wait for clear_output PR #969:

  • address deprecation warning in cgi.escape PR #963:

  • Correct inaccurate description of available LaTeX template PR #958:

  • Fixed kernel death detection for executions with timeouts PR #998:

  • Fixed export names for various templates PR #1000, PR #1001, and PR #1001:


  • Dropped support for python 3.4 PR #979:

  • Removed deprecated export_by_name PR #945:

Testing, Docs, and Builds

  • Added tests for each branch in execute’s run_cell method PR #982:

  • Mention formats in –to options more clearly PR #991:

  • Adds ascii output type to command line docs page, mention image folder output PR #956:

  • Simplify PR #949:

  • Use utf-8 encoding in execute_api example PR #921:

  • Upgrade pytest on Travis PR #941:

  • Fix LaTeX base template name in docs PR #940:

  • Updated release instructions based on 5.4 release walk-through PR #887:

  • Fixed broken link to jinja docs PR #997:


5.4.1 on Github

Thanks to the following 11 authors who contributed 57 commits.

  • Benjamin Ragan-Kelley

  • Carol Willing

  • Clayton A Davis

  • Daniel Rodriguez

  • M Pacer

  • Matthew Seal

  • Matthias Geier

  • Matthieu Parizy

  • Rüdiger Busche

  • Thomas Kluyver

  • Tyler Makaro

Comprehensive notes

New Features

  • Expose pygments styles PR #889:

  • Tornado 6.0 support – Convert proxy handler from callback to coroutine PR #937:

  • Add option to overwrite the highlight_code filter PR #877:

Fixing Problems

  • Mathjax.tpl fix for rendering Latex in html PR #932:

  • Backwards compatbility for empty kernel names PR #927 PR #924

Testing, Docs, and Builds

  • DOC: Add missing language specification to code-block PR #882:


5.4 on Github

Significant Changes


Python 3.3 support was dropped. The version of python is no longer common and new versions have many fixes and interface improvements that warrant the change in support.

See PR #843 for implementation details.

Changes in how we handle metadata

There were a few new metadata fields which are now respected in nbconvert.

nb.metadata.authors metadata attribute will be respected in latex exports. Multiple authors will be added with , separation against their names.

nb.metadata.title will be respected ahead of for title assignment. This better matches with the notebook format.

nb.metadata.filename will override the default output_filename_template when extracting notebook resources in the ExtractOutputPreprocessor. The attribute is helpful for when you want to consistently fix to a particular output filename, especially when you need to set image filenames for your exports.

The raises-exception cell tag (nb.cells[].metadata.tags[raises-exception]) allows for cell exceptions to not halt execution. The tag is respected in the same way by nbval and other notebook interfaces. nb.metadata.allow_errors will apply this rule for all cells. This feature is toggleable with the force_raise_errors configuration option. Errors from executing the notebook can be allowed with a raises-exception tag on a single cell, or the allow_errors configurable option for all cells. An allowed error will be recorded in notebook output, and execution will continue. If an error occurs when it is not explicitly allowed, a CellExecutionError will be raised. If force_raise_errors is True, CellExecutionError will be raised for any error that occurs while executing the notebook. This overrides both the allow_errors option and the raises-exception cell tags.

See PR #867, PR #703, PR #685, PR #672, and PR #684 for implementation changes.

Configurable kernel managers when executing notebooks

The kernel manager can now be optionally passed into the ExecutePreprocessor.preprocess and the executenb functions as the keyword argument km. This means that the kernel can be configured as desired before beginning preprocessing.

This is useful for executing in a context where the kernel has external dependencies that need to be set to non-default values. An example of this might be a Spark kernel where you wish to configure the Spark cluster location ahead of time without building a new kernel.

Overall the ExecutePreprocessor has been reworked to make it easier to use. Future releases will continue this trend to make this section of the code more inheritable and reusable by others. We encourage you read the source code for this version if you’re interested in the detailed improvements.

See PR #852 for implementation changes.

Surfacing exporters in front-ends

Exporters are now exposed for front-ends to consume, including classic notebook. As an example, this means that latex exporter will be made available for latex ‘text/latex’ media type from the Download As interface.

See PR #759 and PR #864 for implementation changes.

Raw Templates

Template exporters can now be assigned raw templates as string attributes by setting the raw_template variable.

class AttrExporter(TemplateExporter):
    # If the class has a special template and you want it defined within the class
    raw_template = """{%- extends 'rst.tpl' -%}
{%- block in_prompt -%}
raw template
{%- endblock in_prompt -%}
exporter_attr = AttrExporter()
output_attr, _ = exporter_attr.from_notebook_node(nb)
assert "raw template" in output_attr

See PR #675 for implementation changes.

New command line flags

The --no-input will hide input cells on export. This is great for notebooks which generate “reports” where you want the code that was executed to not appear by default in the extracts.

An alias for notebook was added to exporter commands. Now --to ipynb will behave as --to notebook does.

See PR #825 and PR #873 for implementation changes.

Comprehensive notes

New Features

  • No input flag (--no-input) PR #825

  • Add alias --to ipynb for notebook exporter PR #873

  • Add export_from_notebook PR #864

  • If set, use nb.metadata.authors for LaTeX author line PR #867

  • Populate language_info metadata when executing PR #860

  • Support for \mathscr PR #830

  • Allow the execute preprocessor to make use of an existing kernel PR #852

  • Refactor ExecutePreprocessor PR #816

  • Update widgets CDN for ipywidgets 7 w/fallback PR #792

  • Add support for adding custom exporters to the “Download as” menu. PR #759

  • Enable ANSI underline and inverse PR #696

  • Update notebook css to 5.4.0 PR #748

  • Change default for slides to direct to the reveal cdn rather than locally PR #732

  • Use “title” instead of “name” for metadata to match the notebook format PR #703

  • Img filename metadata PR #685

  • Added MathJax compatibility definitions PR #687

  • Per cell exception PR #684

  • Simple API for in-memory templates PR #674 PR #675

  • Set BIBINPUTS and BSTINPUTS environment variables when making PDF PR #676

  • If nb.metadata.title is set, default to that for notebook PR #672


  • Drop support for python 3.3 PR #843

Fixing Problems

  • Fix api break PR #872

  • Don’t remove empty cells by default PR #784

  • Handle attached images in html converter PR #780

  • No need to check for the channels already running PR #862

  • Update font-awesome version for slides PR #793

  • Properly treat JSON data PR #847

  • Skip executing empty code cells PR #739

  • Ppdate log.warn (deprecated) to log.warning PR #804

  • Cleanup notebook.tex during PDF generation PR #768

  • Windows unicode error fixed, nosetest added to PR #757

  • Better content hiding; template & testing improvements PR #734

  • Fix Jinja syntax in custom template example. PR #738

  • Fix for an issue with empty math block PR #729

  • Add parser for Multiline math for LaTeX blocks PR #716 PR #717

  • Use defusedxml to parse potentially untrusted XML PR #708

  • Fixes for traitlets 4.1 deprecation warnings PR #695

Testing, Docs, and Builds

  • A couple of typos PR #870

  • Add python_requires metadata. PR #871

  • Document --inplace command line flag. PR #839

  • Fix minor typo in usage.rst PR #863

  • Add note about local reveal_url_prefix PR #844

  • Move onlyif_cmds_exist decorator to test-specific utils PR #854

  • Include LICENSE file in wheels PR #827

  • Added Ubuntu Linux Instructions PR #724

  • Check for too recent of pandoc version PR #814 PR #872

  • Removing more nose remnants via dependencies. PR #758

  • Remove offline statement and add some clarifications in slides docs PR #743

  • Linkify PR number PR #710

  • Added shebang for python PR #694

  • Upgrade mistune dependency PR #705

  • add feature to improve docs by having links to prs PR #662

  • Update notebook CSS from version 4.3.0 to 5.1.0 PR #682

  • Explicitly exclude or include all files in Manifest. PR #670


5.3.1 on Github

  • updated to include LICENSE and scripts/ when creating sdist. PR #666


5.3 on Github

Major features

Tag Based Element Filtering

For removing individual elements from notebooks, we need a way to signal to nbconvert that the elements should be removed. With this release, we introduce the use of tags for that purpose.

Tags are user-defined strings attached to cells or outputs. They are stored in cell or output metadata. For more on tags see the nbformat docs on cell metadata.


  1. Apply tags to the elements that you want to remove.

For removing an entire cell, the cell input, or all cell outputs apply the tag to the cell.

For removing individual outputs, put the tag in the output metadata using a call like display(your_output_element, metadata={tags=[<your_tags_here>]}).

NB: Use different tags depending on whether you want to remove the entire cell, the input, all outputs, or individual outputs.

  1. Add the tags for removing the different kinds of elements to the following traitlets. Which kind of element you want to remove determines which traitlet you add the tags to.

The following traitlets remove elements of different kinds:

  • remove_cell_tags: removes cells

  • remove_input_tags: removes inputs

  • remove_all_outputs_tag: removes all outputs

  • remove_single_output_tag: removes individual outputs

Comprehensive notes

  • new: configurable browser in ServePostProcessor PR #618

  • new: --clear-output command line flag to clear output in-place PR #619

  • new: remove elements based on tags with TagRemovePreprocessor. PR #640, PR #643

  • new: CellExecutionError can now be imported from nbconvert.preprocessors PR #656

  • new: slides now can enable scrolling and custom transitions PR #600

  • docs: Release instructions for nbviewer-deploy

  • docs: improved instructions for handling errors using the ExecutePreprocessor PR #656

  • tests: better height/width metadata testing for images in rst & html PR #601 PR #602

  • tests: normalise base64 output data to avoid false positives PR #650

  • tests: normalise ipython traceback messages to handle old and new style PR #631

  • bug: mathjax obeys \\(\\) & \\[\\] (both nbconvert & pandoc) PR #609 PR #617

  • bug: specify default templates using extensions PR #639

  • bug: fix pandoc version number PR #638

  • bug: require recent mistune version PR #630

  • bug: catch errors from IPython execute_reply and error messages PR #642

  • nose completely removed & dependency dropped PR #595 PR #660

  • mathjax processing in mistune now only uses inline grammar PR #611

  • removeRegex now enabled by default on all TemplateExporters, does not remove cells with outputs PR #616

  • validate notebook after applying each preprocessor (allowing additional attributes) PR #645

  • changed to LICENSE for more standard licensing that GitHub knows how to read PR #654


5.2 on GitHub

Major features

In this release (along with the usual bugfixes and documentation improvements, which are legion) we have a few new major features that have been requested for a long time:

Global Content Filtering

You now have the ability to remove input or output from code cells, markdown cells and the input and output prompts. The easiest way to access all of these is by using traitlets like TemplateExporter.exclude_input = True (or, for example HTMLExporter.exclude_markdown = True if you wanted to make it specific to HTML output). On the command line if you just want to not have input or output prompts just use –no-prompt.

Execute notebooks from a function

You can now use the executenb function to execute notebooks as though you ran the execute preprocessor on the notebooks. It returns the standard notebook and resources options.

Remove cells based on regex pattern

This removes cells based on their matching a regex pattern (by default, empty cells). This is the RegexRemovePreprocessor.

Script exporter entrypoints for nonpython scripts

Now there is an entrypoint for having an exporter specific to the type of script that is being exported. While designed for use with the IRkernel in particular (with a script exporter focused on exporting R scripts) other non-python kernels that wish to have a language specific exporter can now surface that directly.

Comprehensive notes

  • new: configurable ExecutePreprocessor.startup_timeout configurable PR #583

  • new: RemoveCell preprocessor based on cell content (defaults to empty cell) PR #575

  • new: function for executing notebooks: executenb PR #573

  • new: global filtering to remove inputs, outputs, markdown cells (&c.), this works on all templates PR #554

  • new: script exporter entrypoint PR #531

  • new: configurable anchor link text (previously ¶) HTMLExporter.anchor_link_text PR #522

  • new: configurable values for slides exporter PR #542 PR #558

  • improved releases (how-to documentation, version-number generation and checking) PR #593

  • doc improvements PR #593 PR #580 PR #565 PR #554

  • language information from cell magics (for highlighting) is now included in more formats PR #586

  • mathjax upgrades and cdn fixes PR #584 PR #567

  • better CI PR #571 PR #540

  • better traceback behaviour when execution errs PR #521

  • deprecated nose test features removed PR #519

  • bug fixed: we now respect width and height metadata on jpeg and png mimetype outputs PR #588

  • bug fixed: now we respect the resolve_references filter in report.tplx PR #577

  • bug fixed: output metadata now is removed by ClearOutputPreprocessor PR #569

  • bug fixed: display id respected in execute preproessor PR #563

  • bug fixed: dynamic defaults for optional jupyter_client import PR #559

  • bug fixed: don’t self-close non-void HTML tags PR #548

  • buf fixed: upgrade jupyter_client dependency to 4.2 PR #539

  • bug fixed: LaTeX output through md→LaTeX conversion shouldn’t be touched PR #535

  • bug fixed: now we escape < inside math formulas when converting to html PR #514


This release has been larger than previous releases. In it 33 authors contributed a total of 546 commits.

Many thanks to the following individuals who contributed to this release (in alphabetical order):

  • Adam Chainz

  • Andreas Mueller

  • Bartosz T

  • Benjamin Ragan-Kelley

  • Carol Willing

  • Damián Avila

  • Elliot Marsden

  • Gao, Xiang

  • Jaeho Shin

  • Jan Schulz

  • Jeremy Kun

  • Jessica B. Hamrick

  • John B Nelson

  • juhasch

  • Livia Barazzetti

  • M Pacer

  • Matej Urbas

  • Matthias Bussonnier

  • Matthias Geier

  • Maximilian Albert

  • Michael Scott Cuthbert

  • Nicholas Bollweg

  • Paul Gowder

  • Paulo Villegas

  • Peter Parente

  • Philipp A

  • Scott Sanderson

  • Srinivas Reddy Thatiparthy

  • Sylvain Corlay

  • Thomas Kluyver

  • Till Hoffmann

  • Xiang Gao

  • YuviPanda


5.1.1 on GitHub

  • fix version numbering because of incomplete previous version number


5.1 on GitHub


5.0 on GitHub

  • Use xelatex by default for latex export, improving unicode and font support.

  • Use entrypoints internally to access Exporters, allowing for packages to declare custom exporters more easily.

  • New ASCIIDoc Exporter.

  • New preprocessor for sanitised html output.

  • New general convert_pandoc filter to reduce the need to hard-code lists of filters in templates.

  • Use pytest, nose dependency to be removed.

  • Refactored Exporter code to avoid ambiguity and cyclic dependencies.

  • Update to traitlets 4.2 API.

  • Fixes for Unicode errors when showing execution errors on Python 2.

  • Default math font matches default Palatino body text font.

  • General documentation improvements. For example, testing, installation, custom exporters.

  • Improved link handling for LaTeX output

  • Refactored the automatic id generation.

  • New kernel_manager_class configuration option for allowing systems to be set up to resolve kernels in different ways.

  • Kernel errors now will be logged for debugging purposes when executing notebooks.


4.3 on GitHub

  • added live widget rendering for html output, nbviewer by extension


4.2 on GitHub

  • Custom Exporters can be provided by external packages, and registered with nbconvert via setuptools entrypoints.

  • allow nbconvert reading from stdin with --stdin option (write into notebook basename)

  • Various ANSI-escape fixes and improvements

  • Various LaTeX/PDF export fixes

  • Various fixes and improvements for executing notebooks with --execute.


4.1 on GitHub

  • setuptools fixes for entrypoints on Windows

  • various fixes for exporters, including slides, latex, and PDF

  • fixes for exceptions met during execution

  • include markdown outputs in markdown/html exports