How to use black, flake8, and isort to format Python Code

10 min readAug 3, 2021

black: The Uncompromising Code Formatter

Black can format Python code from version 2.7 to 3.8 (as of version 20.8b1). It’s a versatile tool and a good alternative to YAPF, which is limited by the Python version it’s used with.

My preference is using PEP 8 as my style guide, and so, 79-characters per line of code is what I use. So it’s as simple as running the following code at the root of my project and all non-compliant files will be reformatted: