Jupytext is available on pypi and on conda-forge. Run either of
pip install jupytext --upgrade
conda install jupytext -c conda-forge
If you want to use Jupytext within Jupyter Notebook or JupyterLab, make sure you install Jupytext in the Python environment where the Jupyter server runs. If that environment is read-only, for instance if your server is started using JupyterHub, install Jupytext in user mode with:
/path_to_your_jupyter_environment/python -m pip install jupytext --upgrade --user
Jupytext’s contents manager¶
Jupytext provides a contents manager for Jupyter that allows Jupyter to open and save notebooks as text files. When Jupytext’s content manager is active in Jupyter, scripts and Markdown documents have a notebook icon.
In most cases, Jupytext’s contents manager is activated automatically by Jupytext’s server extension. When you restart either
jupyter lab or
jupyter notebook, you should see a line that looks like:
[I 10:28:31.646 LabApp] [Jupytext Server Extension] Changing NotebookApp.contents_manager_class from LargeFileManager to jupytext.TextFileContentsManager
If you don’t have the notebook icon on text documents after a fresh restart of your Jupyter server, you can either enable our server extension explicitly (with
jupyter serverextension enable jupytext), or install the contents manager manually. Append
c.NotebookApp.contents_manager_class = "jupytext.TextFileContentsManager"
.jupyter/jupyter_notebook_config.py file (generate a Jupyter config, if you don’t have one yet, with
jupyter notebook --generate-config). Our contents manager accepts a few options: default formats, default metadata filter, etc. Then, restart Jupyter Notebook or JupyterLab, either from the JupyterHub interface or from the command line with
jupyter notebook # or lab
Jupytext commands in JupyterLab¶
In JupyterLab, Jupytext adds a set of commands to the command palette (View / Activate Command Palette, or Ctrl+Shift+C):
The Jupytext extension for JupyterLab is bundled with Jupytext. In most cases you don’t need to install it explicitely.
From Jupytext 1.9.0 on, the version of the extension is compatible with JupyterLab 3.x only. If you wish to use Jupytext with JupyterLab 2.x or 1.x, please
and then, install the last version of the
jupyterlab-jupytextextension that is compatible with your version of JupyterLab, i.e.
jupyter labextension install firstname.lastname@example.org # for JupyterLab 2.x jupyter labextension install email@example.com # for JupyterLab 1.x