About this project
YAPF is a Python formatter that uses an algorithm based on clang-format to calculate the best formatting for code based on configured style settings. Its goal is to produce code that looks as if it were written by a programmer following a style guide, reducing the manual effort of code maintenance.
Key features include:
- Support for multiple predefined styles, including PEP8, Google, Facebook, and a custom YAPF style.
- High configurability through a wide array of "knobs" (settings) to tune indentation, bracket placement, line splitting, and spacing.
- Flexible configuration via command-line arguments, `.style.yapf` files, `setup.cfg`, or `pyproject.toml`.
- Ability to run recursively over directories, format specific line ranges, and exclude files using `.yapfignore` or `pyproject.toml`.
- Integration capabilities as a library via `FormatCode` and `FormatFile` APIs.
- A `yapf-diff` tool to reformat only the lines changed in a unified diff, which is useful for CI workflows and patch management.
YAPF supports Python 3.7+ and is compatible with various editors through community plugins.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.