Registry / testing / ruff
library0.16.4pypypi✓ verified 27d ago

Extremely fast Python linter and formatter written in Rust by Astral. Current version is 0.15.7. Two separate subcommands: ruff check (linting, replaces Flake8/isort/pyupgrade) and ruff format (formatting, replaces Black). Not a Python library to import — CLI tool only. The format setting and RUFF_FORMAT env var were repurposed/removed; use output-format and RUFF_OUTPUT_FORMAT instead. 2026 style guide introduced in 0.15.0 changes lambda formatting.

uv tool install ruff@latest
INSTALL
IMPORT
SIG · RUFF
R
ruff
testingpythonv0.16.4
Install
2.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.16.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.5s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ruff (CLI)
# ruff is a CLI tool — not a Python library to import # Two separate subcommands: # Linting (replaces flake8, isort, pyupgrade, etc.) ruff check . # lint all files ruff check . --fix # lint and auto-fix safe issues ruff check . --unsafe-fixes # also apply unsafe fixes # Formatting (replaces Black) ruff format . # format all files ruff format . --check # check only, no changes # Configuration in pyproject.toml: # [tool.ruff] # line-length = 88 # [tool.ruff.lint] # select = ["E", "F", "B", "I"] # [tool.ruff.format] # quote-style = "double"
import ruff # ModuleNotFoundError — ruff is a CLI tool from ruff import check # ModuleNotFoundError
ruff is a CLI tool only. Configure via pyproject.toml [tool.ruff] or ruff.toml. Two subcommands: ruff check for linting, ruff format for formatting.

ruff check for linting, ruff format for formatting. Configure in pyproject.toml [tool.ruff].

# Install pip install ruff # Lint all Python files in current directory ruff check . # Lint with auto-fix ruff check . --fix # Format all Python files ruff format . # Check formatting without modifying (for CI) ruff format . --check # Minimal pyproject.toml config # [tool.ruff] # line-length = 88 # target-version = "py311" # # [tool.ruff.lint] # select = ["E", "F", "B", "I", "UP"] # ignore = ["E501"] # # [tool.ruff.format] # quote-style = "double" # indent-style = "space" # Pre-commit hook (pin the version!) # - repo: https://github.com/astral-sh/ruff-pre-commit # rev: v0.15.7 # hooks: # - id: ruff-check # args: [--fix] # - id: ruff-format
ruff --version
Debug
Known issues
breakingThe format setting in [tool.ruff] was repurposed: it no longer controls CLI output format. Use output-format instead. The RUFF_FORMAT env var was removed — use RUFF_OUTPUT_FORMAT. Old configs using format = 'json' to get JSON output are silently broken.
fix
Replace [tool.ruff] format = 'json' with [tool.ruff] output-format = 'json'. Replace RUFF_FORMAT=json with RUFF_OUTPUT_FORMAT=json.
affects: >= 0.2.0
breaking2026 style guide (introduced in 0.15.0) changes lambda formatting — lambda bodies are now parenthesized instead of breaking parameters across lines. Reformatting existing code will produce diffs.
fix
Run ruff format . after upgrading to reformat under the 2026 style guide. Review diffs carefully, especially for lambdas as function arguments.
affects: >= 0.15.0
breakingbuild/ directory no longer excluded by default. Previously ruff excluded build/, which caused confusion when projects had a legitimate build/ directory. Now build/ is only excluded if in .gitignore or extend-exclude.
fix
If you relied on build/ being excluded, add it explicitly: [tool.ruff] extend-exclude = ['build']
affects: >= 0.4.0
gotcharuff check and ruff format are separate subcommands — running ruff check does NOT format code. Need both: ruff check --fix && ruff format. In pre-commit, two separate hooks are needed: ruff-check and ruff-format.
fix
Use both subcommands. In pre-commit: - id: ruff-check then - id: ruff-format. ruff-check must come BEFORE ruff-format when using --fix.
affects: all
gotchaRuff only enables F (Pyflakes) and a subset of E (pycodestyle) rules by default. Common rules like isort (I), bugbear (B), pyupgrade (UP) must be explicitly selected. Not specifying select means most linting power is unused.
fix
Add to [tool.ruff.lint]: select = ['E', 'F', 'B', 'I', 'UP', 'RUF']. Or use select = ['ALL'] with specific ignores.
affects: all
gotcha--format flag on ruff check and ruff linter was renamed to --output-format. Using --format raises an error.
fix
Replace ruff check --format json with ruff check --output-format json.
affects: >= 0.2.0
gotchaThe command 'pip install ruff' was executed as Python code, leading to a SyntaxError. Pip commands should be run directly in the shell or via a subprocess call, not as part of a Python script.
fix
Execute `pip install ruff` directly in your shell environment or, if running from a Python script, use `subprocess.run(['pip', 'install', 'ruff'], check=True)`.
affects: all
gotchaRunning shell commands (like `pip install`) directly within a Python script will raise a `SyntaxError: invalid syntax`. Python interprets such lines as invalid Python code rather than shell commands.
fix
To execute shell commands like `pip install ruff` from within a Python script, use `import subprocess; subprocess.run(['pip', 'install', 'ruff'])` or `import os; os.system('pip install ruff')`.
affects: all
Upgrade
Version history
0.16.4latest on PyPI · released Aug 20, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Resources