Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

Formats cells using the `Black` uncompromising Python code formatter.

Notifications You must be signed in to change notification settings

tobinjones/jupyterlab_formatblack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jupyterlab_formatblack

Formats cells using the Black uncompromising Python code formatter. This is quite a hacky solution that relies on the blackcellmagic extension by csurfer. It adds the command Format cell with Black which just

  1. adds the text %%black to the top of the cell, and
  2. runs the cell

You can add a keyboard shortcut by adding something like...

{
  "black:format-cell": {
    "command": "black:format-cell",
    "keys": ["F"],
    "selector": ".jp-Notebook:focus"
  }
}

... to the keyboard shortcuts in jupyterlab settings.

Prerequisites

Install

jupyter labextension install jupyterlab_formatblack

Development

For a development install (requires npm version 4 or later), do the following in the repository directory:

npm install
npm run build
jupyter labextension link .

To rebuild the package and the JupyterLab app:

npm run build
jupyter lab build

About

Formats cells using the `Black` uncompromising Python code formatter.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published