jupyterlab-jupytext

Save Jupyter Notebooks as Scripts or Markdown files that work well with version control & external text editors

Usage no npm install needed!

<script type="module">
  import jupyterlabJupytext from 'https://cdn.skypack.dev/jupyterlab-jupytext';
</script>

README

A JupyterLab extension for Jupytext

This extension adds a few Jupytext commands to the command palette. Use these to select the desired ipynb/text pairing for your notebook.

The latest version for this extension is npm version.

Most users do not need to install this extension, since it is already included in the latest jupytext, both on Pypi and Conda Version.

Installation

Please install Jupytext first. As mentioned above, both the pip and conda packages do include the latest version of the JupyterLab extension, so in most cases you don't need to specifically install this npm package.

In case you're not using JupyterLab 3.x, you will have to install an older version of the extension that is compatible with your version. Please first install jupytext using pip or conda, and then downgrade the extension to a version compatible with your version of Jupyter Lab with:

jupyter labextension install jupyterlab-jupytext@1.2.2  # for JupyterLab 2.x
jupyter labextension install jupyterlab-jupytext@1.1.1  # for JupyterLab 1.x

How to develop this extension

We assume that you have activated the conda environment described in CONTRIBUTING.md.

Then you can rebuild the Jupytext python package (with BUILD_JUPYTERLAB_EXTENSION=1 python setup.py sdist bdist_wheel) and reinstall it (pip install dist/jupytext-x.x.x-py3-none-any.whl).

Alternatively, if you prefer to develop iteratively, you could install a development version of the extension with

BUILD_JUPYTERLAB_EXTENSION=1 jupyter labextension develop . --overwrite

Read more on this on the JupyterLab documentation.

How to publish a new version of the extension on npm

Please note that the main purpose of updating the extension on npm is to keep the npm documentation up-to-date, since the extension is made available within the Python package itself.

Make sure you have nodejs>=12 installed, bump the version in package.json, and then:

# Go to the extension folder
cd packages/labextension

# Cleanup
rm -rf lib node_modules yarn.lock

# Install JupyterLab's plugin manager
jlpm install

# Package the extension
npm pack

# Test the extension locally
jupyter labextension install jupyterlab-jupytext-xxx.tgz

# Publish the package on npm with
npm publish --access=public