jupytext
Convert Jupyter Notebooks to text-based formats
TLDR
Turn a notebook into a paired .ipynb/.py notebook
Convert a notebook to a .py file
Convert a .py file to a notebook with no outputs
Convert a .md file to a notebook and run it
Update the input cells in a notebook and preserve outputs and metadata
Update all paired representations of a notebook
SYNOPSIS
jupytext [options]
PARAMETERS
--to
Convert notebook to the specified format (e.g., markdown, python).
--update
Update the paired representation of the notebook.
--test
Test if the notebook is well paired with its representation.
--sync
Synchronize the paired representation of the notebook.
--set-formats
Set the jupytext formats for notebook.
--help
Show help message and exit.
--version
Show version information and exit.
DESCRIPTION
Jupytext is a command-line tool and Python package that allows you to work with Jupyter Notebooks as plain text files, such as Markdown, R Markdown, and Python scripts. This enables you to manage notebooks in version control systems more easily, collaborate with colleagues who prefer text-based formats, and use your favorite text editor to edit Jupyter notebooks.
Jupytext essentially synchronizes a Jupyter Notebook (.ipynb) file with a text-based representation (e.g., .md, .py). Changes made in either file are reflected in the other. This is useful for ensuring both human-readable and executable versions of your notebooks are always up-to-date. It provides a flexible solution for managing and converting between these formats. Jupytext can be installed via pip and used from the command line or within a Jupyter environment.
PAIRING
Jupytext works by 'pairing' a Jupyter Notebook with a text representation. You can configure how the pairing works by specifying the formats in the Jupyter Notebook metadata. This allows you to define exactly which text formats are associated with a given notebook.
USE CASES
Some key use cases are:
1. Version control of notebooks in text-based formats.
2. Collaborative editing of notebooks with text editors.
3. Running jupyter notebooks as python scripts.
SEE ALSO
jupyter(1), nbconvert(1)