All Projects → life4 → awesome-python-code-formatters

life4 / awesome-python-code-formatters

Licence: MIT license
A curated list of awesome Python code formatters

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to awesome-python-code-formatters

Black
The uncompromising Python code formatter
Stars: ✭ 23,973 (+14169.64%)
Mutual labels:  formatter, yapf, gofmt, autopep8
ufmt
Safe, atomic formatting with black and µsort
Stars: ✭ 46 (-72.62%)
Mutual labels:  formatter, formatting, black
Golite
Add essential language support for the Go language to Sublime Text 3.
Stars: ✭ 14 (-91.67%)
Mutual labels:  formatter, formatting, gofmt
Isort
A Python utility / library to sort imports.
Stars: ✭ 4,377 (+2505.36%)
Mutual labels:  formatter, isort
palantir-java-format
A modern, lambda-friendly, 120 character Java formatter.
Stars: ✭ 203 (+20.83%)
Mutual labels:  formatter, gofmt
kirai
String formatting library for Java, Android, Web and Unix Terminal
Stars: ✭ 69 (-58.93%)
Mutual labels:  formatter, formatting
Vse Formatdocumentonsave
Visual Studio - Format Document on Save
Stars: ✭ 61 (-63.69%)
Mutual labels:  formatter, formatting
Editorconfig Netbeans
A NetBeans IDE plugin supporting the EditorConfig standard. ⛺
Stars: ✭ 123 (-26.79%)
Mutual labels:  formatter, formatting
Juliaformatter.jl
An opinionated code formatter for Julia. Plot twist - the opinion is your own.
Stars: ✭ 217 (+29.17%)
Mutual labels:  formatter, formatting
Bluestyle
A Julia style guide that lives in a blue world
Stars: ✭ 210 (+25%)
Mutual labels:  styleguide, formatting
guidelines
Guidelines, patterns, and coding styles
Stars: ✭ 16 (-90.48%)
Mutual labels:  styleguide, formatting
Sublime-uroboroSQL-formatter
Beautiful SQL Formatter for Sublime Text 3
Stars: ✭ 25 (-85.12%)
Mutual labels:  formatter, formatting
formatting
源码格式自动化调整工具
Stars: ✭ 37 (-77.98%)
Mutual labels:  formatter, formatting
teks
Easily get custom go template based outputs to your command-line tool. Like in docker/kubernetes
Stars: ✭ 41 (-75.6%)
Mutual labels:  formatter, formatting
snakefmt
The uncompromising Snakemake code formatter
Stars: ✭ 78 (-53.57%)
Mutual labels:  formatter, black
dockerfile-utils
A library and command line interface for formatting and linting Dockerfiles.
Stars: ✭ 17 (-89.88%)
Mutual labels:  formatter, formatting
yapf-online
google/yapf online demo
Stars: ✭ 23 (-86.31%)
Mutual labels:  formatter, yapf
blackbricks
Black for Databricks notebooks
Stars: ✭ 40 (-76.19%)
Mutual labels:  formatter, black
AutoFormatInputWatcher
This repository contains input watcher for auto formatting digits in edit text
Stars: ✭ 15 (-91.07%)
Mutual labels:  formatter, formatting
Nginx Config Formatter
nginx config file formatter/beautifier written in Python.
Stars: ✭ 222 (+32.14%)
Mutual labels:  formatter, formatting

Awesome Python Code Formatters

A curated list of awesome Python code formatters

All-in formatters

Formatters that take care of all your code.

  • autopep8: format Python code to conform to the PEP 8 style guide.
  • black: uncompromising Python code formatter.
  • prettier: opinionated code formatter, not only for Python.
  • yapf: yet another Python code formatter from Google.

UNIX-way formatters

Formatters that do only one job and do it well.

  • add-trailing-comma: adds trailing commas to calls and literals.
  • decrapify: some scripts that use pybowler.io for refactoring Python code.
  • docformatter: formats docstrings to follow PEP 257.
  • docstrfmt: a tool for automatically formatting reStructuredText in files and Python docstrings in a consistent way.
  • eradicate: removes commented-out code from Python files.
  • fix8: fixes some Python linting issues found by Flake8.
  • flynt: converts old string literal formatting to f-strings.
  • formate: a wrapper around isort and yapf with a few custom rules.
  • kwonly-transformer: Opinionated tool to ensure functions with multiple parameters to have exclusively keyword only parameters.
  • no-optional: Replace Optional[T] by Union[T, None].
  • pybetter: fixes some trivial problems with your code.
  • pydocstringformatter: Automatically format your Python docstrings to conform with PEP 8 and PEP 257.
  • pyment: formats and generates docstrings.
  • remove-print-statements: A tool (and pre-commit hook) to remove print statements from your Python project.
  • ssort: sorts and groups classes, functions, and methods.
  • Tornado Async Transformer: A libcst transformer for updating tornado @gen.coroutine syntax to python3.5+ native async/await.
  • teyit: formats unittest assertions.
  • unify: modifies strings to all use the same quote where possible.

Imports formatters

Formatters for import statements.

  • absolufy-imports: converts relative imports to absolute ones.
  • autoflake: removes unused imports and unused variables as reported by pyflakes.
  • isort: sorts imports.
  • pyall: keeps the __all__ list always up to date.
  • pycln: removes unused imports.
  • removestar: replaces import * in Python files with explicit imports.
  • reorder-python-imports: reorders imports.
  • unimport: removes unused imports.
  • usort: Safe, minimal import sorting for Python projects.

Upgrading tools

Tools to upgrade to newer versions of Python or a framework.

  • 2to3: translates Python 2 to 3.
  • auto-walrus: automatically use the walrus operator where possible.
  • com2ann: translates type comments to type annotations.
  • django-codemod: upgrades Django projects to newer version of the framework by automatically fixing deprecations.
  • django-upgrade: upgrades Django projects.
  • pyupgrade: upgrades syntax for newer versions of the language.

Improvements and wrappers

Wrappers for existing code formatters to make them more accessible.

  • black-macchiato: runs black on parts of the code.
  • blacken-docs: runs black on python code blocks in documentation files.
  • brunette: wrapper around black with improvements.
  • formate-black: integrates black with formate.
  • gray: wrapper around isort, pyupgrade, add-trailing-comma, and unify.
  • jupyterlab-code-formatter: code formatter for JupyterLab.
  • nbQA: run isort, pyupgrade, mypy, pylint, flake8, and more on Jupyter Notebooks.
  • pyformat: wrapper around autopep8, autoflake, docformatter, and unify.
  • shed: wrapper around autoflake, black, com2ann, isort, pybetter, pyupgrade, and teyit.

Libraries and refactoring

If you need to write your own formatter, these are libraries for you.

  • autotransform: framework for large-scale code modification.
  • bowler: safe code refactoring for modern Python.
  • fissix: backport of lib2to3, with enhancements.
  • importlab: A library that automatically infers dependencies for Python files. Importlab's main use case is to work with static analysis tools that process one file at a time, ensuring that a file's dependencies are analysed before it is.
  • libcst: parses Python code as a CST tree that keeps all formatting details (comments, whitespaces, parentheses, etc).
  • massedit: edit text files with Python.
  • refactor: AST-based fragmental source code refactoring toolkit.
  • rope: refactoring library.
  • semgrep: like grep but for code. Supports --autofix flag for simple replacement of matched code.
  • comby: Comby is a tool for searching and changing code structure

Code generators

This list doesn't contain tools that generate code, type annotations, comments etc. The difference is that code formatters transform your code from one form into another (which should be safe if the tool is stable) while code generators bring something totally new. If you're looking for code generators, check out the following links:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].