Skip to main content

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

Project description

pypiv pyv Licence Downloads

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

What is the magic command?



Using pip

pip install blackcellmagic

Directly from the repository

git clone
python blackcellmagic/ install

Load Extension in IPython

%load_ext blackcellmagic


# To have it formatted to black default length 88 with string normalization.

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

# To skip string normalization.
%%black -S
%%black --skip-string-normalization


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


Bug Reports and Feature Requests

Please use issue tracker for reporting bugs or feature requests.


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


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blackcellmagic-0.0.3.tar.gz (4.1 kB view hashes)

Uploaded source

Built Distribution

blackcellmagic-0.0.3-py3-none-any.whl (4.2 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page