Python Black
What is the Python Black formatter
Black is the uncompromising Python code formatter. By using it, you agree to cede control over minutiae of hand-formatting. In return, Black gives you speed, determinism, and freedom from pycodestyle nagging about formatting.You will save time and mental energy for more important matters.
Install Black
1 | python -m pip install black |
Format
1 | # format a file |
Check files for formatting
Check which python files can be formatted in the current directory, but do not want to modify the files yet
1
python -m black --check
Check what are the changes that black proposes
1
black --check --diff my_dummy_code_file.py
Change number of characters per line
1 | # default black value is 88 |