Prerequisites and Installation Steps

Prerequisites

This plugin requires JupyterLab installed under a Python3.6+ environment.

Note

Black (one of the most popular formatter) requires Python3.6+.

Also this project uses typing, a 3.6+ feature.

Installation Step 1 (Installing the plugin itself)

With Pip:

pip install jupyterlab_code_formatter

With Conda:

conda install -c conda-forge jupyterlab_code_formatter

For users still using JupyterLab < 3.0.0, you will also need to run:

jupyter serverextension enable --py jupyterlab_code_formatter
jupyter labextension install @ryantam626/jupyterlab_code_formatter

Installation Step 2 (Installing a supported code formatter)

Python Code Formatters

Supported formatters are:

Install one of them via your favourite package management tool. For example, one of the following (these are not exhaustive!)

# Installing black and isort, the default python formatters of choice in this plugin
# ONLY ONE OF THESE WILL DO!!!!!!!!
pip install black isort
conda install black isort

R Code Formatters

Supported formatters are:

Install one of them via your favourite package management tool again. For example, via conda or via R directly.

Danger

You will also need to install the rpy2 Python package for this plugin to work!

Installation Step 3 (Restarting Jupyterlab)

If you have been following the above steps while Jupyterlab is already running, you will need to restart it for the changes to fully take effect.

Installation Step 4 (Configuring the plugin)

You might need to change the default formatter selection via configuration as shown in Changing Default Formatter, if you are unsure, continue reading in How To Use This Plugin.