Awesome Python Code Formatters
A curated list of awesome Python code formatters
Code formatters
- 2to3 -- Automated Python 2 to 3 code translation.
- add-trailing-comma -- A tool to automatically add trailing commas to calls and literals.
- autopep8 -- A tool that automatically formats Python code to conform to the PEP 8 style guide.
- black -- The uncompromising Python code formatter.
- com2ann -- Translates type comments to type annotations.
- decrapify -- Some scripts that use pybowler.io for refactoring Python code.
- docformatter -- Formats docstrings to follow PEP 257.
- eradicate -- Removes commented-out code from Python files.
- prettier -- An opinionated code formatter, not only for Python.
- pybetter -- Tool for fixing trivial problems with your code.
- pyupgrade -- A tool to automatically upgrade syntax for newer versions of the language.
- reindent.py -- Change Python (.py) files to use 4-space indents and no hard tab characters.
- teyit -- Unittest assertion formatter.
- unify -- Modifies strings to all use the same quote where possible.
- yapf -- Yet another Python code formatter from Google.
Imports formatters
- autoflake -- Removes unused imports and unused variables as reported by pyflakes.
- isort -- A Python utility / library to sort imports.
- star-destroyer -- Eliminates
import *
from your modules. - unimport -- Removes unused imports.
Improvements and wrappers
- black-macchiato -- paints part of your python code black.
- blacken-docs -- Run
black
on python code blocks in documentation files. - brunette -- best practice Python code formatter, wrapper around
black
with improvements. - gray -- wrapper around
isort
,pyupgrade
,add-trailing-comma
, andunify
. - jupyterlab_code_formatter -- A universal code formatter for JupyterLab.
- pyformat -- wrapper around
autopep8
,autoflake
,docformatter
, andunify
. - shed -- wrapper around
autoflake
,black
,com2ann
,isort
,pybetter
,pyupgrade
, andteyit
; with fully automatic configuration andblacken-docs
-inspired support for code in docs files too.