Package: jupytext-ebp
FORK FOR EBP USE ONLYHave you always wished Jupyter notebooks were plain text documents? Wished you could edit them in your favorite IDE? And get clear and meaningful diffs when doing version control? Then... Jupytext may well be the tool you're looking for!Jupytext is a plugin for Jupyter that can save Jupyter notebooks as eitherMarkdown files (orMyST Markdownfiles, orR Markdowndocuments)Scripts inmany languages.Use casesCommonuse casesfor Jupytext are:Doing version control on Jupyter NotebooksEditing, merging or refactoring notebooks in your favorite text editorApplying Q&A checks on notebooks.InstallYou can install Jupytext withpip install jupytextorconda install jupytext -c conda-forge.Please note that Jupytext includes an extension for Jupyter Lab. In the latest version of Jupytext, this extension is compatible with Jupyter Lab >= 3.0 only. If you use Jupyter Lab 2.x, please either stay with Jupytext 1.8.2, or install, on top of the latest pip or conda version of Jupytext, a version of the extension that is compatible with Jupyter Lab 2.x:jupyter labextension install jupyterlab-jupytext@1.2.2  # For Jupyter Lab 2.xThen, restart your Jupyter server (for more installation details, see theinstall sectionin the documentation).When Jupytext is installed,.pyand.mdfiles have a notebook icon. And you can really open and run these files as notebooksWith a click on the text file in Jupyter Notebook(click on the image above to try this on)With a right click andopen with notebookin Jupyter Lab(click on the image above to try this on)Paired notebooksThe most convenient way to use Jupytext is probably throughpaired notebooks.To pair a given.ipynbor text notebook to an additional notebook format, use eitherthe"pair notebook with..."commands in Jupyter Labthe"pair notebook with..."menu entries in Jupyter Notebookjupytextat the command linewith e.g.jupytext --set-formats ipynb,py:percent notebook.ipynbsee thedocumentation.or a local or globaljupytext.tomlconfiguration file.with e.g. the following content:formats = "ipynb,py:percent"see thedocumentation.When you save a paired notebook in Jupyter, both the.ipynbfile and the text version are updated on disk.When a paired notebook is opened orreloadedin Jupyter, the input cells are loaded from the text file, and combined with the output cells from the.ipynbfile.You can edit the text representation of the notebook in your favorite editor, and get the changes back in Jupyter by simplyreloadingthe notebook (Ctrl+R in Jupyter Notebook,"reload notebook"in Jupyter Lab). And the changes are propagated to the.ipynbfile when yousavethe notebook.Alternatively, you can synchronise the two representations by runningjupytext --sync notebook.ipynbat the command line.Which text format?Jupytext implements many textformatsfor Jupyter Notebooks. If your notebook is mostly made of code, you will probably prefer to save it as a script:Use thepercent format, a format with explicit cell delimiters (# %%), supported by many IDE (Spyder, Hydrogen, VS Code, PyCharm and PTVS)Or use thelight format, if you prefer to see fewer cell markers.If your notebook contains more text than code, if you are writing a documentation or a book, you probably want to save your notebook as a Markdown documentUse theJupytext Markdown formatif you wish to render your notebook as a.mdfile (without its outputs) on GitHubUse theMyST Markdown format, a markdown flavor that “implements the best parts of reStructuredText”, if you wish to render your notebooks using Sphinx orJupyter Book.Use theR Markdown formatif you want to open your Jupyter Notebooks in RStudio.More resources?If you're new to Jupytext, you may want to start with theFAQor with theTutorials, or with this short introduction to Jupytext:.