IPython magic command to format python code in cell using black.
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 with string normalization.
%%black
# 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
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
Release files for blackcellmagic 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| blackcellmagic-0.0.3.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| blackcellmagic-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:8.3 kB
Release files / blackcellmagic-0.0.3.tar.gz
| Download URL | blackcellmagic-0.0.3.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8d42fb462d0fd6ebdb1a9fec825f40493ceb84348d052daf14765689008a665
|
|
BLAKE2b-256 checksum How to use checksums |
dd74fa04dad5312b2f401f18710a4f19dd85bfd0e040e8082d646aef0f208cbd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.8.10 Linux/5.11.0-25-generic
|
Release files / blackcellmagic-0.0.3-py3-none-any.whl
| Download URL | blackcellmagic-0.0.3-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
521a89fd1de8848dace5c570c8db5d326b6731aad34927df7d6038e400a577ea
|
|
BLAKE2b-256 checksum How to use checksums |
761e42813e6619ebed88c59818eb2e4b79ecab7b90fe28a8ba3a208c2245dbb8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.8.10 Linux/5.11.0-25-generic
|