JupyterLab Code Formatter#

Binder npm version npm downloads code style Github Actions Status

A JupyterLab plugin to facilitate invocation of code formatters.

Source Code: GitHub.

Demo#

format-all

Requirements#

  • Python 3.6+

  • JupyterLab >= 3.0.0

  • Any supported code formatters (you can also specify your own, see custom formatter).

Important

JupyterLab Code Formatter only provides an interface for invoking code formatters on Jupyter Server, and does not include any code formatter by default.

Quick Start#

  1. Install the package

pip install jupyterlab-code-formatter
conda install -c conda-forge jupyterlab_code_formatter
poetry add jupyterlab-code-formatter
pipenv install jupyterlab-code-formatter
  1. Install some supported formatters (isort+black are default for Python)

# NOTE: Install black and isort,
#       JL code formatter is configured to invoke isort and black by default
pip install black isort
  1. Restart JupyterLab

This plugin includes a server plugin, restart JupyterLab if you have followed the above steps while it’s running.

  1. Configure plugin

To configure which/how formatters are invoked, see configuration.