JupyterLab Code Formatter

3.0.3 · active · verified Fri Apr 17

jupyterlab-code-formatter is a JupyterLab plugin that integrates popular code formatters (like Black, isort, Ruff, yapf, autopep8) directly into the JupyterLab IDE. It allows users to format their Python code within notebooks and script files via a context menu, menu bar, or keyboard shortcuts. The current version, 3.0.3, is designed for JupyterLab 3.x and 4.x, leveraging its modern extension system. It maintains an active development cycle with regular updates.

Common errors

Warnings

Install

Quickstart

Install the extension and your preferred code formatters (e.g., black, isort, ruff). After installation, restart your JupyterLab server. The formatting options will appear in the right-click context menu within a notebook cell or file editor, under the 'Format Code' menu, or via the 'Edit' menu. You can also configure keyboard shortcuts and default formatters in JupyterLab's Advanced Settings Editor.

pip install jupyterlab_code_formatter
pip install black isort ruff
# Then, restart JupyterLab. Right-click on a cell or file to format.

view raw JSON →