Skip to content
IPython magic command to format python code in cell using black.
Python
Branch: master
Clone or download
csurfer and vishwas.sharma Version bump.
Latest commit 39d851e Apr 11, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Update gitignore Apr 25, 2018
CHANGELOG.rst New version with some bug fixes. Apr 11, 2019
LICENSE Wrapper to use black formatter within IPython Apr 25, 2018
README.md Update README.md Jul 25, 2018
README.rst Update README.rst Jul 25, 2018
_config.yml Wrapper to use black formatter within IPython Apr 25, 2018
blackcellmagic.py Address comments Apr 1, 2019
setup.py Version bump. Apr 11, 2019

README.md

blackcellmagic

pypiv pyv Licence Thanks

IPython magic command to format python code in cell using black.

Demo

What is the magic command?

%%black

Setup

Using pip

pip install blackcellmagic

Directly from the repository

git clone https://github.com/csurfer/blackcellmagic.git
python blackcellmagic/setup.py install

Load Extension in IPython

%load_ext blackcellmagic

Usage

# To have it formatted to black default length 88.
%%black

# To have it formatted to a particular line length.
%%black -l 79
%%black --line_length 79

Extras

Tobin Jones has been kind enough to develop a NPM package over blackcellmagic to format all cells at once which can be found here.

Contributing

Bug Reports and Feature Requests

Please use issue tracker for reporting bugs or feature requests.

Development

Pull requests are most welcome.

Buy the developer a cup of coffee!

If you found the utility helpful you can buy me a cup of coffee using

Donate

You can’t perform that action at this time.