Skip to content

Instantly share code, notes, and snippets.

@mwouts
Last active February 2, 2020 07:51
Show Gist options
  • Save mwouts/724efe5e00654fc2145a4c916796e071 to your computer and use it in GitHub Desktop.
Save mwouts/724efe5e00654fc2145a4c916796e071 to your computer and use it in GitHub Desktop.
New in Jupytext 1.3

What's new in Jupytext 1.3?

Jupytext's Word Cloud

The image was generated with the wordcloud package - see this notebook.

We are also looking for a logo for Jupytext. Please let us know if you can help!

Multiple pairing

Notebooks can be paired to more than one text representation #290. When the notebook is loaded in Jupyter, the inputs are loaded from the most recent text representation. Both the Jupyter Notebook and the JupyterLab extensions have been updated to allow multiple pairing.

Multiline comments in Python scripts

Markdown cells in Python scripts can now use multiline comments #305. For instance, this is a valid Markdown cell:

# %% [markdown]
"""
A long
markdown
cell
"""

in the percent format, and

# + [markdown]
"""
A long
markdown
cell
"""

is a valid markdown cell in the light format.

Cell metadata are encoded as key=value everywhere

Cf. #344. Metadata were previously encoded as JSON

# %% {"key": "value"}
1 + 1

Now they are encoded as

# %% key="value"
1 + 1

This affect all the formats. To avoid causing large diffs like this one, we have implemented an option cell_metadata_json that is set automatically to true when Jupytext detects that you were using JSON metadata in the text file. If you want to make the transition to the key=value representation, change the value for that option to false.

Raw cells in the Markdown format

Raw cells were previously represented as code cells (triple backticks) with no language information. That representation was not compatible with Jupyter Nbconvert, cf. #321.

Raw cells are now encoded using HTML comments <!-- #raw --> and <!-- #endraw -->. If you were previously using raw cells in your Markdown files, please make sure you do have the YAML header - Jupytext will notice that the file was generated with a previous version of Jupytext, and will do the translation automatically.

Testing the impact on your project

Assume that you use the Markdown format to store your notebooks, you can update them with jupytext --to md *.md. The impact should be limited, see for instance our test on the plotly.py-docs repository.

Jupytext pytest

jupytext --pipe and jupytext --check understand {} in the command as a placeholder for a temporary file name. This allows to execute commands that don't accept pipes, like pytest:

jupytext --check 'pytest {}' notebook.ipynb # or notebook.md

If you want to read more about this, have a look at our sample notebook.

Powershell, Rust, Robot Framework

Have joined the list of supported languages. Rust was contributed by Jonas Bushart #351, and Robot Framework by Asko Soukka #378 - many thanks to them!

And if you want to see the detailed CHANGELOG, it's here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment