yapf
A formatter for Python code
Decision gist · record as of 2026-08-14
Yes. YAPF is actively maintained with low install friction, permissive licensing, and no known vulnerabilities. Install it if you want automatic, style-guide-compliant code formatting in your workflow—either as a standalone tool or integrated into your development environment.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.7 or later (supports 3.7, 3.8, 3.9, 3.10, 3.11)
- Low install friction with only two runtime dependencies (platformdirs and tomli).
- Actively maintained with recent commits and a large repository following (13980 stars).
License · maintenance · safety
permissive license (permissive) — Apache License 2.0 is permissive and allows commercial use, modification, and distribution with minimal restrictions—you can use YAPF in proprietary projects as long as you include a copy of the license and note any changes you make.
last release 2024-11-14 (638 days) · last repo commit 2026-08-14 · 13,980 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 9,155,087 downloads/mo, #1,557 on PyPI
Alternatives
Verify before relying
pip install yapf
from yapf.yapflib.yapf_api import FormatCode
formatted_code, changed = FormatCode("f ( a = 1, b = 2 )")
print(formatted_code)- Whether YAPF's formatting output is deterministic across different Python versions or systems.
- Performance characteristics when formatting very large files or entire codebases.
- How well YAPF integrates with modern Python tooling in the same workflow.
What it is and what it does
YAPF is a Python code formatter that automatically rewrites code to match a configured style, based on the clang-format algorithm. Rather than enforcing rules line-by-line, it analyzes the entire code structure and calculates the best formatting that conforms to your chosen style. It supports predefined styles (pep8, google, yapf, facebook) and custom configurations via .style.yapf, setup.cfg, or pyproject.toml files.
You can use YAPF as a command-line tool to format files in place, print diffs, or run recursively over directories, or as a Python library by importing FormatCode and FormatFile from yapf.yapflib.yapf_api. It requires Python 3.7 or later and integrates with many editors via community plugins.
Use it for
- Enforce consistent code style across a team or project without manual review of formatting details.
- Integrate into a CI/CD pipeline to verify that code has been formatted correctly before merging.
- Reformat legacy Python code to a modern style guide in bulk.
- Use as a library in an IDE or editor plugin to format code on save or on demand.
- Configure custom formatting rules for a project and apply them consistently to all Python files.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
YAPF is actively maintained with low install friction, permissive licensing, and no known vulnerabilities. Install it if you want automatic, style-guide-compliant code formatting in your workflow—either as a standalone tool or integrated into your development environment.
Install
yapf on PyPI
Before you install
Low install friction with only two runtime dependencies (platformdirs and tomli). Actively maintained with recent commits and a large repository following (13980 stars).
Requires Python 3.7 or later (supports 3.7, 3.8, 3.9, 3.10, 3.11)
License in practice
Apache License 2.0 is permissive and allows commercial use, modification, and distribution with minimal restrictions—you can use YAPF in proprietary projects as long as you include a copy of the license and note any changes you make.
Quickstart
pip install yapf
from yapf.yapflib.yapf_api import FormatCode
formatted_code, changed = FormatCode("f ( a = 1, b = 2 )")
print(formatted_code)
Verify before relying
- Whether YAPF's formatting output is deterministic across different Python versions or systems.
- Performance characteristics when formatting very large files or entire codebases.
- How well YAPF integrates with modern Python tooling in the same workflow.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesplatformdirstomli |
| Maintenance | Actively maintained 638 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 9,155,087 / month, #1,557 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Quality Assurance |
Evidence: yapf-0.43.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pep8 formatter”
- yapfYAPF automatically reformats Python code to conform to a specified…
- autopep8autopep8 automatically reformats Python code to comply with PEP 8…
- bashatebashate is a style checker for bash scripts that applies pep8-like…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also autopep8 · reformat-gherkin · yamlfix · darker · ydiff · bashate · beautysh · pycodestyle · blacken-docs · djade