Registry / devops / jupyterlab-code-formatter

jupyterlab-code-formatter

JSON →
library3.0.3pypypiunverified

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.

pip install jupyterlab_code_formatter
INSTALL
IMPORT
SIG · JUPYTERLAB-CODE-FO
J
jupyterlab-code-formatter
devopspythonv3.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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.
Debug
Known issues
breakingJupyterLab Code Formatter versions are tied to JupyterLab major versions. Version 3.x is for JupyterLab 3.x/4.x. If you are using JupyterLab 2.x, you need to install jupyterlab-code-formatter 2.x.
fix
Ensure your `jupyterlab-code-formatter` version matches your `jupyterlab` major version (e.g., `jupyterlab_code_formatter>=3` for `jupyterlab>=3`). Upgrade JupyterLab if necessary or downgrade the extension.
affects: <3.0.0
gotchaThe `jupyterlab_code_formatter` extension itself does not include the actual code formatters (like Black, isort, Ruff). You must install your desired formatters separately in the same Python environment where JupyterLab is running.
fix
After installing `jupyterlab_code_formatter`, always run `pip install black isort ruff` (or your preferred formatters) to make them available to the extension.
affects: All
gotchaAfter installing or updating the extension, you might need to rebuild your JupyterLab frontend for the changes to take effect, especially with older JupyterLab versions or complex environments. The `jupyter lab build` command is often helpful.
fix
If the extension doesn't appear after restarting JupyterLab, try running `jupyter lab build` in your terminal and then restart JupyterLab again. Clear browser cache if issues persist.
affects: <3.0.0 (less common in >=3.0.0)
gotchaConfiguration for jupyterlab-code-formatter is done via JupyterLab's 'Advanced Settings Editor', not via Python code or separate config files in your user directory. Common issues include incorrect paths or enabled formatters.
fix
Open 'Settings' > 'Advanced Settings Editor' in JupyterLab, then select 'Code Formatter'. Ensure 'formatOnSave' or specific formatters are enabled and paths are correct if you've customized them. Save changes and restart JupyterLab if necessary.
affects: All
Errors
Common errors & fixes
Error: Formatter 'black' not found. Please ensure 'black' is installed and available in your PATH.
The specific formatter (e.g., Black) is not installed in the Python environment where JupyterLab is running.
fix
Install the missing formatter: `pip install black` (or `isort`, `ruff`, etc.). Restart JupyterLab after installation.
JupyterLab extension is not showing up or formatting options are missing from the menu.
The JupyterLab frontend did not properly load or enable the extension, or there's a version mismatch.
fix
Check for version compatibility (`jupyterlab-code-formatter` and `jupyterlab`). If versions match, try running `jupyter lab build` in your terminal, then clear your browser cache and restart JupyterLab. Ensure you've installed formatters.
No module named 'jupyterlab_code_formatter' when I try to import it.
jupyterlab-code-formatter is a JupyterLab *extension* and is not meant to be imported directly into Python scripts by end-users. It's a server-side component for the JupyterLab frontend.
fix
You do not need to `import jupyterlab_code_formatter` in your Python code. Install it via `pip` and interact with its features directly through the JupyterLab UI (right-click menu, Edit menu, keyboard shortcuts).
Upgrade
Version history
3.0.3latest on PyPI · released Feb 11, 2026
Audit
Dependencies
jupyterlabrequiredThis is a JupyterLab extension and requires JupyterLab to run.
blackoptionalOne of the popular Python formatters supported by the extension. Must be installed separately.
isortoptionalOne of the popular Python import sorters supported by the extension. Must be installed separately.
ruffoptionalA fast Python linter and formatter. Supported by the extension and must be installed separately.
Agent activity
2 hits · last 30 days
node
2
Resources
jupyterlab-code-formatter — pip install jupyterlab-code-formatter · libregistry