ruff-format
Python bindings for the Ruff code formatter, built with Rust and PyO3.
Decision gist · record as of 2026-08-14
Yes, if you need to format Python code programmatically in your application. The package is actively maintained, has no runtime dependencies, and is backed by Ruff's well-regarded formatter. The medium install friction (compiled bindings) is offset by prebuilt wheels for most platforms. No known security issues.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.8 or later; prebuilt wheels available for most platforms, but source builds require Rust and maturin.
- Medium install friction due to compiled Rust bindings, but prebuilt wheels are available for most platforms.
- Actively maintained with recent releases.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution with minimal restrictions.
last release 2026-08-10 (4 days) · last repo commit 2026-08-10 · 1 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 97,853 downloads/mo, #13,124 on PyPI
Alternatives
Verify before relying
from ruff_format import format_string
code = "def hello( x,y, z ):\n print( x+y+z )"
formatted = format_string(code)
print(formatted)- Whether format_string handles all Python syntax edge cases or has known limitations
- Performance comparison with other formatters on large codebases
- Whether custom formatting rules beyond line_width are supported
What it is and what it does
ruff-format is a Python package that wraps Ruff's formatting engine, written in Rust and exposed via PyO3 bindings. It lets you format Python code from within your own Python programs rather than only via the command line. The package provides three main functions: is_valid_syntax to check syntax, parse_code to parse without formatting, and format_string to reformat code with a configurable line width (default 80).
The package has no runtime dependencies and is distributed as prebuilt wheels for most platforms, though it does require Rust to build from source. It supports Python 3.8 through 3.14 and is actively maintained, with recent releases available.
Use it for
- Programmatically format code snippets or user-submitted Python in a web application or IDE
- Integrate code formatting into a custom linting or code review pipeline
- Format Python code with a specific line width in a build or CI/CD workflow
- Validate Python syntax before attempting to format or execute it
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to format Python code programmatically in your application.
The package is actively maintained, has no runtime dependencies, and is backed by Ruff's well-regarded formatter. The medium install friction (compiled bindings) is offset by prebuilt wheels for most platforms. No known security issues.
Install
ruff-format on PyPI
Before you install
Medium install friction due to compiled Rust bindings, but prebuilt wheels are available for most platforms. Actively maintained with recent releases.
Requires Python 3.8 or later; prebuilt wheels available for most platforms, but source builds require Rust and maturin.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions.
Quickstart
from ruff_format import format_string
code = "def hello( x,y, z ):\n print( x+y+z )"
formatted = format_string(code)
print(formatted)
Verify before relying
- Whether format_string handles all Python syntax edge cases or has known limitations
- Performance comparison with other formatters on large codebases
- Whether custom formatting rules beyond line_width are supported
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 4 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 97,853 / month, #13,124 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Programming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyProgramming Language :: Rust |
Evidence: ruff_format-0.5.4-cp314-cp314t-macosx_10_12_x86_64.whl; ruff_format-0.5.4-cp314-cp314t-macosx_11_0_arm64.whl; ruff_format-0.5.4-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; ruff_format-0.5.4-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; ruff_format-0.5.4-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; ruff_format-0.5.4-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl; ruff_format-0.5.4-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; ruff_format-0.5.4-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl; ruff_format-0.5.4-cp314-cp314t-musllinux_1_2_aarch64.whl; ruff_format-0.5.4-cp314-cp314t-musllinux_1_2_armv7l.whl; ruff_format-0.5.4-cp314-cp314t-musllinux_1_2_i686.whl; ruff_format-0.5.4-cp314-cp314t-musllinux_1_2_x86_64.whl; ruff_format-0.5.4-cp314-cp314t-win32.whl; ruff_format-0.5.4-cp314-cp314t-win_amd64.whl; ruff_format-0.5.4-cp314-cp314t-win_arm64.whl; ruff_format-0.5.4-cp38-abi3-macosx_10_12_x86_64.whl; ruff_format-0.5.4-cp38-abi3-macosx_11_0_arm64.whl; ruff_format-0.5.4-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; ruff_format-0.5.4-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; ruff_format-0.5.4-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.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 › “ruff formatter bindings”
- ruff-formatProvides Python bindings to Ruff's code formatter, allowing you to…
- mdformat-ruffIntegrates ruff code formatting into mdformat to automatically format…
- python-lsp-ruffIntegrates ruff's linting, formatting, and code-action capabilities…
Give your agent the search over MCP, or paste the wish link into any chat.
More Quality Assurance packages
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
Ruff is a Python linter and code formatter written in Rust that combines linting, formatting, and code fixing into a single tool, replacing Flake8, Black, isort, and related utilities.
Pexpect spawns and controls interactive console applications by sending input and matching output patterns, automating tasks that would otherwise require manual interaction.
Black reformats Python source code to a consistent style by parsing entire files and rewriting them according to an opinionated, deterministic set of rules, eliminating manual formatting decisions.
pytest-xdist distributes pytest tests across multiple CPU cores or machines to speed up test execution, with the simplest usage being `pytest -n auto` to spawn workers equal to available CPUs.
Install it if your test suite takes long enough that parallelization would save meaningful time.
Validates AWS CloudFormation templates in YAML or JSON format against resource provider schemas and best practices, checking property values and configuration correctness.
Install it if you work with CloudFormation templates.
See also fable-library · mdformat-ruff · stretchable · pytest-ruff · darker · ruff-lsp · ast-serialize · dprint-py