Python Formatter
Format and clean up Python code — fix indentation, spacing around operators, and blank lines per PEP 8.
About Python Formatting
PEP 8 is Python's official style guide, specifying 4-space indentation, maximum 79-character line length, two blank lines between top-level functions and classes, one blank line between methods, spaces around operators, and no trailing whitespace. Black is the dominant Python formatter — it is opinionated, non-configurable, and produces deterministic output. isort handles import sorting. Ruff is a newer Rust-based linter+formatter that combines both tools at extreme speed.
FAQ
Black vs autopep8 — which should I use?
Black is the modern standard. It is opinionated (no configuration) and produces consistent output regardless of developer preferences. This makes code reviews focus on logic rather than style. autopep8 is more flexible but that flexibility means style inconsistencies can persist. For new projects, use Black. Integrate it into your editor and CI pipeline with pre-commit.