53 lines
2.5 KiB
Markdown
53 lines
2.5 KiB
Markdown
# Jupytext - efficient editing
|
|
|
|
[Jupytext](https://github.com/mwouts/jupytext) is a Jupyter serverextension
|
|
that allows creating a text file from a notebook that can be kept in sync with
|
|
it **with the aim of using more efficient editors or IDEs on it**. The file can
|
|
be created in a number of formats, e.g. *markdown, *.py (light Script)*, and
|
|
others. `Jupytext` will keep the both the notebook and this **paired** file in
|
|
sync: If you save the paired file, changes will be carried over into the
|
|
notebook, and vice versa. This pairing will persist also in new sessions of
|
|
your notebook until you explicitely remove it again.
|
|
|
|
The paired file contains only the cell contents and not the output. Therefore
|
|
it also is **much better suited for revision control**, since the differences
|
|
between versions are limited to the cells and these file formats yield more
|
|
meaningful text differences than the default notebook storage format.
|
|
|
|
## Creating a paired file in python format for efficient refactoring
|
|
|
|
From your notebook, go to the `file` menu and navigate to the `jupytext`
|
|
submenu. Select the **light script** pairing option. This will create a `*.py`
|
|
file version with the same basename as your notebook file.
|
|
|
|

|
|
/// caption
|
|
///
|
|
|
|
You can edit that file separately in your favourite python editor. The markdown
|
|
text parts will be conserved in the file in the form of python comments.
|
|
|
|
When you save the file and do a browser page reload of your jupyter notebook,
|
|
you will see all the changes carried over into your jupyter notebook.
|
|
|
|
## Creating a paired file in mardown format for efficient text authoring
|
|
|
|
If you want to efficiently work on the descriptive text base of your notebook,
|
|
just pair it using the `Pair notebook with Markdown` menu item and edit the
|
|
generated `*.md` file with your favourite Markdown editor.
|
|
|
|
## Disable autosaving when working on the paired file
|
|
|
|
Your notebooks usually auto save every 2 min (default). Turn this feature off
|
|
when working with the paired file. Otherwise Jupyter will continue to save the
|
|
state while you are editing the paired file, and the changes will be synced to
|
|
the disk version of the paired file. You can disable the autosave by unchecking
|
|
the `Autosave notebook` menu item in the Juytext menu (see above image).
|
|
|
|
## Further information
|
|
|
|
Please refer to:
|
|
|
|
* [the Jupytext FAQ](https://jupytext.readthedocs.io/en/latest/faq.html)
|
|
* [the Jupytext documentation](https://jupytext.readthedocs.io/en/latest/index.html)
|