Code Monkey home page Code Monkey logo

jupyterlab-cell-formatter-black's Introduction

jupyterlab-cell-formatter-black

This is modified from https://github.com/tobinjones/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-cell-formatter-black

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

jupyterlab-cell-formatter-black's People

Contributors

fltd avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.