- Introduction
- Jupyter notebooks
- And their JSON representation
- Jupytext demo
- Refactor a notebook
- Jupytext in Jupyter
- Paired notebooks
- Collaborate using Jupytext
- Jupytext formats
- Related projects
November 14, 2018
mwouts/jupytext_pyparis_2018
CFM (www.cfm.fr) is a global asset management company, based in Paris,
Python plays a central role at CFM.
Jupyter notebooks are great for
Share notebooks:
Jupyter notebooks are huge JSON files.
Inputs are mixed with outputs: changes are not easy to follow.
Merging JSON is hard: forget one comma, and the notebook becomes invalid.
« Turn my beautiful interactive notebook into a plain and static text file?? »
Jupytext’s promise:
« What about my outputs and widgets? »
We also have a solution for that!
Get the material for this demo at mwouts/jupytext_pyparis_2018.
Or, run the demo_script.sh
online in our binder.
PWC’s Low Carbon Economy Index 2018:
« Not one of the G20 countries achieved the 6.4% rate required to limit warming to two degrees this year. That goal is slipping further out of reach — at current levels of decarbonisation, the global carbon budget for two degrees will run out in 2036. »
jupytext --to py Greenhouse_gas_emissions.ipynb
.jupytext --to ipynb --update Greenhouse_gas_emissions.py
.# Append to .jupyter/jupyter_notebook_config.py c.NotebookApp.contents_manager_class = "jupytext.TextFileContentsManager"
jupyter notebook
or jupyter lab
.Pair a traditional ipynb
notebook with a py
file:
py
file in your favorite editor,py
fileipynb
file.
Activate paired notebooks:
"jupytext": {"formats": "ipynb,py"},
to the notebook metadata.%autosave 0
in a cell.py
representation of her notebook.py
file as a notebook.py
file.Use Jupytext to:
2to3
, etc,py.test
or import
a notebook, etc…In the demo we have used the light
format (created for jupytext
), which converts notebooks to valid Python scripts:
# +
, and its end with # -
.# %%
cellsUse the py:percent
format to generate scripts with explicit # %%
cells markers.
Compatible with:
R Markdown by Yihui Xie (2012) is an inspiring notebook format. See the recent R Markdown: The Definitive Guide.
Jupyter notebooks as (R) Markdown documents:
md
and Rmd
.Why design jupytext
? I was obsessed with the lossless round trip conversion!
nbdime, by the Jupyter team:
nbdiff
: command line diff,nbmerge
: three-way merge,nbdiff-web
: diff notebooks in a browser,nbmerge-web
: merge notebooks in a browser.nbdime
can merge the outputs cells of Jupyter notebooks — unlike jupytext
.
Impressive job by Google Colab and CoCalc!
Jupytext is now available on conda-forge.
And we are looking for contributors for a Jupyter extension. We would like to offer a user-friendly interface (buttons) for
In Towards Data Science:
On GitHub:
jupytext
to conda-forge.And to our stargazers — it’s so great to know that people like the project!