/awesome-python-code-formatters

A curated list of awesome Python code formatters

MIT LicenseMIT

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, and unify.
  • jupyterlab_code_formatter -- A universal code formatter for JupyterLab.
  • pyformat -- wrapper around autopep8, autoflake, docformatter, and unify.
  • shed -- wrapper around autoflake, black, com2ann, isort, pybetter, pyupgrade, and teyit; with fully automatic configuration and blacken-docs-inspired support for code in docs files too.

Libraries and refactoring

  • bowler -- Safe code refactoring for modern Python.
  • fissix -- backport of lib2to3, with enhancements.
  • massedit -- edit text files with Python.
  • rope -- a python refactoring library.
  • undebt -- tool for performing massive, automated Python code refactoring.