Python Code Formatters

Open-source Python projects categorized as Code Formatters

Top 3 Python Code Formatter Projects

  • black

    The uncompromising Python code formatter

    Project mention: Uv: Python Packaging in Rust | news.ycombinator.com | 2024-02-15

    black @ git+https://github.com/psf/black

  • yapf

    A formatter for Python files

    Project mention: Why is Prettier rock solid? | news.ycombinator.com | 2024-02-19

    I think I agree about the testing and labor of complicated translation rules.

    But it doesn't appear that almost every pretty printer uses the Wadler pretty printing paper. It seems like MOST of them don't?

    e.g. clang-format is one of the biggest and best, and it has a model that includes "unwrapped lines", a "layouter", a line break cost function, exhaustive search with memoization, and Dijikstra's algorithm:

    https://llvm.org/devmtg/2013-04/jasper-slides.pdf

    The YAPF Python formatter is based on this same algorithm - https://github.com/google/yapf

    The Dart formatter used a model of "chunks, rules, and spans"

    https://journal.stuffwithstuff.com/2015/09/08/the-hardest-pr...

    It almost seems like there are 2 camps -- the functional algorithms for functional/expression-based languages, and other algorithms for more statement-based languages.

    Though I guess Prettier/JavaScript falls on the functional side.

    I just ran across this survey on lobste.rs and it seems to cover the functional pretty printing languages influenced by Wadler, but functional style, but not the other kind of formatter ("Google" formatters perhaps)

    https://arxiv.org/pdf/2310.01530.pdf

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

  • isort

    A Python utility / library to sort imports.

    Project mention: A Tale of Two Kitchens - Hypermodernizing Your Python Code Base | dev.to | 2023-11-12

    isort will sort the imports for you

NOTE: The open source projects on this list are ordered by number of github stars. The number of mentions indicates repo mentiontions in the last 12 Months or since we started tracking (Dec 2020). The latest post mention was on 2024-02-19.

Python Code Formatters related posts

Index

What are some of the best open-source Code Formatter projects in Python? This list will help you:

Project Stars
1 black 36,798
2 yapf 13,588
3 isort 6,240
Learn 300+ open source libraries for free using AI.
LearnThisRepo lets you learn 300+ open source repos including Postgres, Langchain, VS Code, and more by chatting with them using AI!
learnthisrepo.com