Black
An opinionated Python code formatter that reformats files in place with minimal configuration, producing consistent formatting across projects.
Black is an opinionated Python code formatter that reformats entire files in place with deliberately limited configuration options. By adopting Black, a project cedes control over the fine details of hand-formatting in exchange for deterministic formatting that looks the same across any codebase using it, which the project argues makes code review faster by producing smaller diffs.
Black is installed with pip, requires Python 3.10 or later, and can format Jupyter notebooks when installed with the jupyter extra. Standalone executables built with PyInstaller are also published on the release page for people who want to run it without a Python installation.
As a safety check, Black verifies that the reformatted code still parses to an equivalent abstract syntax tree as the original, unless the user passes a --fast flag to skip that check.