Repolode
jupyterlab-contrib

jupyterlab-contrib/jupyterlab_code_formatter

A JupyterLab extension that lets you format code cells in notebooks using formatters such as black, isort, yapf, and autopep8.

Stars
907
Forks
71
Open issues
27
Last commit
3 months ago

What is it?

jupyterlab_code_formatter is a JupyterLab plugin that adds a way to run code formatters on notebook cells and files without leaving the editor. It works by calling external formatter tools from a server-side component, so the formatters you already use in your Python projects can be applied directly in JupyterLab.

The default setup invokes isort and black for Python code. The project also lists support for autopep8, yapf, and R formatting through the topics associated with the repository, and configuration options control which formatter is used and how it is invoked. Installation is done with pip, followed by installing the formatters themselves and restarting JupyterLab.

The package is composed of a Python server extension and an npm frontend extension, and the project documents troubleshooting steps for checking that both parts are enabled.

Key features

  • 01Formats notebook cells and code from within JupyterLab.
  • 02Calls external formatters such as black and isort, with isort and black as defaults for Python.
  • 03Supports autopep8, yapf, and R formatting according to its topics.
  • 04Configurable choice of formatter and invocation options.
  • 05Installs via pip with a separate frontend and server component.

Use cases

  • Keeping data science notebooks consistently formatted before sharing them.
  • Cleaning up Python code in JupyterLab while following black or isort style rules.
  • Formatting R code in JupyterLab sessions when an R formatter is available.

Quick start

  1. 1

    Install the package

    pip install jupyterlab-code-formatter
  2. 2

    Install supported formatters (isort and black are default for Python)

    pip install black isort
  3. 3

    Restart JupyterLab

  4. 4

    Configure the plugin (see the configuration docs)

In collections

Topics

#jupyterlab#python#code-formatter#black#isort#yapf#jupyter-extension#autopep8#jupyterlab-extension#jupyterlab-extensions

FAQ

What is jupyterlab_code_formatter?
A JupyterLab extension that lets you format code cells in notebooks using formatters such as black, isort, yapf, and autopep8. jupyterlab_code_formatter is a JupyterLab plugin that adds a way to run code formatters on notebook cells and files without leaving the editor. It works by calling external formatter tools from a server-side component, so the formatters you already use in your Python projects can be applied directly in JupyterLab.
Is jupyterlab_code_formatter free to use? What license does it have?
jupyterlab_code_formatter is open source under the MIT license. Check the license terms before using it in commercial products.
Is jupyterlab_code_formatter still maintained?
Updated within 6 months. The last commit to jupyterlab_code_formatter was on Aug 7, 2026.
What can I use jupyterlab_code_formatter for?
Keeping data science notebooks consistently formatted before sharing them. Cleaning up Python code in JupyterLab while following black or isort style rules. Formatting R code in JupyterLab sessions when an R formatter is available.
How do I install jupyterlab_code_formatter?
Install the package: pip install jupyterlab-code-formatter Install supported formatters (isort and black are default for Python): pip install black isort Restart JupyterLab Configure the plugin (see the configuration docs)
Where can I get jupyterlab_code_formatter?
The source code and installation instructions are on GitHub: https://github.com/jupyterlab-contrib/jupyterlab_code_formatter

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects