0.1.1 • Published 6 years ago

jupyterlab_formatblack v0.1.1

Weekly downloads
50
License
BSD-3-Clause
Repository
github
Last release
6 years ago

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