November 29, 2021
Black code formatter
Black is non-configurable code formatter.
Install black for jupyter notebook
jupyter nbextension install https://github.com/drillan/jupyter-black/archive/master.zip --user
jupyter nbextension enable jupyter-black-master/jupyter-black
Change the line length character limit in Black
To change the character limit for the Black Python formatter, you can add following section to pyproject.toml file:
[tool.black]
line-length = 119
- PEP8 recommends a line length of 79 characters (72 for docstrings)
- Black sets line lengths to 88 characters by default
- The Django docs recommend a maximum line length of 119 characters (79 for docstrings)
Usages of black
- with tox
- in pre-commit hooks
- as external tool in PyCharm