YAPF is a Python code formatter that automatically rewrites source to match a chosen style, using a clang-format–inspired algorithm to search for the “best” layout under your rules. Instead of relying on a fixed set of heuristics, it explores formatting decisions and chooses the lowest-cost result, aiming to produce code a human would write when following a style guide. You can run it as a command-line tool or call it as a library via FormatCode / FormatFile, making it easy to embed in editors, CI, and custom tooling. Styles are highly configurable: start from presets like pep8, google, yapf, or facebook, then override dozens of options in .style.yapf, setup.cfg, or pyproject.toml. It supports recursive directory formatting, line-range formatting, and diff-only output so you can check or fix just the lines you touched.

Features

  • Performance helpers: Recursive formatting, --parallel for multiple files, and in-place edits with -i.
  • Configurable styles: Use pep8, google, yapf, or facebook as a base and override fine-grained knobs in config files or --style flags.
  • CLI and library APIs: Run from the terminal or call FormatCode / FormatFile programmatically.
  • Partial / selective formatting: Reformat specific line ranges (--lines) or only changed hunks via yapf-diff.
  • Editor & CI friendly: Editor plugins available; --diff and return codes enable easy CI enforcement.
  • Ignore support: Exclude paths with .yapfignore or [tool.yapfignore] in pyproject.toml.

Project Samples

Project Activity

See All Activity >

Categories

Algorithms

License

Apache License V2.0

Follow YAPF

YAPF Web Site

Other Useful Business Software
The All-in-One Commerce Platform for Businesses - Shopify Icon
The All-in-One Commerce Platform for Businesses - Shopify

Shopify offers plans for anyone that wants to sell products online and build an ecommerce store, small to mid-sized businesses as well as enterprise

Shopify is a leading all-in-one commerce platform that enables businesses to start, build, and grow their online and physical stores. It offers tools to create customized websites, manage inventory, process payments, and sell across multiple channels including online, in-person, wholesale, and global markets. The platform includes integrated marketing tools, analytics, and customer engagement features to help merchants reach and retain customers. Shopify supports thousands of third-party apps and offers developer-friendly APIs for custom solutions. With world-class checkout technology, Shopify powers over 150 million high-intent shoppers worldwide. Its reliable, scalable infrastructure ensures fast performance and seamless operations at any business size.
Learn More
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of YAPF!

Additional Project Details

Programming Language

Python

Related Categories

Python Algorithms

Registered

2025-10-09