Skip to main content

black + nbconvert

Tired of having to think about formatting in Jupyter notebooks? Look no further! This script will correctly format your Jupyter notebooks for you using black.

Warning: This project will overwrite your notebooks in place. It shouldn't change anything except the format, but use at your own risk!

Installation & Usage

To install:

pip install black_nbconvert

To check a notebook:

black_nbconvert --check /path/to/a/notebook.ipynb

To fix the formatting in a notebook (in place):

black_nbconvert /path/to/a/notebook.ipynb

If you pass a directory instead of a notebook file, notebooks will be found recursively below that directory. For example:

black_nbconvert .

will fix the formatting for all notebooks in the current directory and (recursively) below.

Configuration: Configuration for black in a pyproject.toml file above the target files will be respected.

Version control integration

Use pre-commit. Once you have it installed, add this to the .pre-commit-config.yaml in your repository:

repos:
- repo: https://github.com/dfm/black_nbconvert
  rev: v0.3.0
  hooks:
  - id: black_nbconvert

Then run pre-commit install and you're ready to go.

Metadata

Release files for black-nbconvert 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for black-nbconvert 0.4.0
File Size Uploaded
black_nbconvert-0.4.0.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for black-nbconvert 0.4.0
File Interpreter ABI Platform
black_nbconvert-0.4.0-py36-none-any.whl Python 3.6 none any Details

Total release size: 11.8 kB

Release files / black_nbconvert-0.4.0.tar.gz

Download URL black_nbconvert-0.4.0.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7beb4a73183a8e182d2d5c96ae924862c70ae4006dba700e15b1d90fb211b4b6
BLAKE2b-256 checksum
How to use checksums
1feed9ffe39274a8dbd6b2397a29458d88d9d0417696186ac78da46d0aa07668
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10

Release files / black_nbconvert-0.4.0-py36-none-any.whl

Download URL black_nbconvert-0.4.0-py36-none-any.whl
Size 4.8 kB
Tags Python 3.6
SHA-256 checksum
How to use checksums
475befd7c04f6e3cfe859e69a71e0222a6cb730d5f841f87b2435242cafe824f
BLAKE2b-256 checksum
How to use checksums
bdfe6c7fdb4198bcf4fbff5ca0c18ff102692820d199f329c6a67122b0964103
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page