Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dnanhkhoa/nb_black
A simple extension for Jupyter Notebook and Jupyter Lab to beautify Python code automatically using black.
https://github.com/dnanhkhoa/nb_black
black black-beautifier black-formatter codeformatter jupyter-notebook-extension jupyter-notebook-formatter jupyterlab-extension yapf
Last synced: about 1 month ago
JSON representation
A simple extension for Jupyter Notebook and Jupyter Lab to beautify Python code automatically using black.
- Host: GitHub
- URL: https://github.com/dnanhkhoa/nb_black
- Owner: dnanhkhoa
- License: mit
- Created: 2018-08-20T13:00:51.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-07-28T14:20:59.000Z (over 1 year ago)
- Last Synced: 2024-11-01T21:06:15.850Z (about 1 month ago)
- Topics: black, black-beautifier, black-formatter, codeformatter, jupyter-notebook-extension, jupyter-notebook-formatter, jupyterlab-extension, yapf
- Language: Python
- Homepage:
- Size: 24.4 KB
- Stars: 368
- Watchers: 8
- Forks: 41
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- best-of-jupyter - GitHub
README
# nb_black
[![PyPI](https://img.shields.io/pypi/v/nb_black.svg)](https://pypi.org/project/nb-black/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/nb_black.svg)](https://pypi.org/project/nb-black/)A simple extension for Jupyter Notebook and Jupyter Lab to beautify Python code automatically using **[Black](https://github.com/psf/black)**.
Please note that since the **Black** package only supports Python 3.6+, so **[YAPF](https://github.com/google/yapf)** package will
be used for the lower versions. If you edit the code while running the cell, the formatting is
not submitted to the Jupyter notebook and instead silently suppressed, so you have to stick with
the edited, but unformatted code.## Installation
You can install this package using [pip](http://www.pip-installer.org):
```
$ [sudo] pip install nb_black
```## Usage
For Jupyter Notebook:
```
%load_ext nb_black
```For Jupyter Lab:
```
%load_ext lab_black
```Just put this code into the first cell in your Notebook, and that's all. :)