0 highlightsMarc WoutsBlockedUnblockFollowFollowingFeb 19Jupytext is an extension for Jupyter Notebook and JupyterLab that can save Jupyter notebooks in various text formats: Markdown, R Markdown, Python, Julia and R scripts, and more!A Jupyter Notebook represented as a Python script (light or percent format), Markdown, and R MarkdownJupytext will allow you to:Write or edit Jupyter notebooks in your favorite code editorEnable version control on notebooks with a clear diff historyCollaborate on Jupyter notebooks and easily merge contributionsRefactor notebooks and extract their code into a libraryA convenient way to use Jupytext is through paired notebooks.
A paired notebook is a traditional .
ipynb notebook that is synchronized with a text representation — say, a Python script.
When the notebook is saved, Jupytext updates both files.
The script has a clear diff history, focused on the input cells only.
The user can edit or refactor the script in a code editor: when the notebook is read or refreshed in Jupyter, the input cells are read from the script.
Moreover, the output cells matching unchanged input cells are reloaded from the .
Jupytext has been available since September 2018, and has benefited from a great deal of feedback by the community.
We have built upon that feedback, and we are happy to announce that Jupytext reached version 1.
Now let’s review the main new features of this major release!A Jupytext menu in Jupyter notebookJupytext gains a Jupyter notebook extension: use the new Jupytext menu to select the paired format for your notebook, and to deactivate the autosave function while you edit the text representation in another editor.
Jupytext commands in JupyterLabJupytext 1.
0 also ships an extension for JupyterLab: use the new Jupytext commands to pair your notebook with a text file.
A powerful jupytext commandThe jupytext command could already:convert notebook –from and –to the various notebook formats,–update the input cells in an .
ipynb notebook, given a text representation of the notebook,maintain up-to-date text representation of notebooks using Git pre-commit hooks.
In version 1.
0 the jupytext command was extended with new modes:–sync to synchronize the multiple representations of a notebook–set-formats (and optionally, –sync), to set or change the pairing of a notebook or a text file–pipe to pipe the text representation of a notebook into another program.
Perhaps you would like to reformat your Jupyter notebooks using black, the uncompromising Python code formatter?.That's as simple as jupytext –pipe black *.
ipynb!Paired notebooks in subfoldersIn earlier versions of Jupytext, paired notebooks had to share the same directory.
In version 1.
0, Jupytext can pair a notebook with a text file in a different folder.
Pair the notebooks in the current folder with Python scripts in a python subfolder with:jupytext –set-formats ipynb,python//py –sync *.
ipynb(use –sync to actually create the Python files; replace py with py:percent if you want to use the percent format).
Pair the notebooks in the folder notebooks with both a markdown file in the markdown folder, and a Python script in the python folder, withjupytext –set-formats notebooks//ipynb,markdown//md,python//py –sync notebooks/*.
ipynbMore information regarding notebook prefix and suffixes can be found in the documentation.
It is also possible to activate a default pairing for all notebooks.
The Hydrogen formatJupytext could already represent Jupyter notebooks as light or percent scripts.
0 introduces a new hydrogen format, which will be a best fit for users of the Hydrogen editor.
The hydrogen format is the same as the percent format, except for the Jupyter magic commands, which are left uncommented.
Below is a screenshot of an Python Hydrogen notebook with many other languages in it — see how Hydroden can render the multiple output types!A well-tested programWe’ve done our best to make sure Jupytext works flawlessly.
Our users and beta-testers have done a great job.
And for each bug they found, we increased the test database.
But you may want to stress test jupytext on your own notebook collection?.Give jupytext –test or jupytext –test-strict a try.
A plugin for VimThanks to Michael Goerz, Jupytext has a plugin for Vim.
Install the plugin and edit Jupyter notebooks represented as either Markdown documents or scripts.
vim is another very convenient way to use Jupytext!In the future, we would like to have Jupytext plugins for more editors, including PyCharm and Visual Studio Code.
Please let us know if you can help here — a good plugin starts simply with jupytext –sync!Thank youJupytext owes much to the feedback of the community!For this release I am especially thankfull to:- Florian Wetschoreck, François Wouts and Amjad Haouriqui for their support at the time of designing the Jupyter extensions- Philip Austin, who contributed the idea of piping a notebook into other tools, and that of pairing notebooks to scripts in a different folder- Michael Goerz, Andre Thrill, Philip Austin and Dang Trung Kien for the quality of their work when testing Jupytext.
Do you want to help?.You can contribute in many ways.
We are happy to learn about bugs.
Ideas are welcome!.Documentation improvements are also very helpful.
And stars keep us motivated.
Come and join us on GitHub!.. More details