Role in the Ruff documentation
Black appears throughout the Ruff documentation as the code style that Ruff targets. Ruff lists "drop-in parity with Flake8, isort, and Black" among its features, and states that it can be used to replace Black, Flake8, isort, pydocstyle, pyupgrade and autoflake behind a single interface. The Ruff rules documentation notes that Ruff omits stylistic rules that overlap with the use of a formatter such as ruff format or Black.
- Cited as a formatter Ruff can replace
- Named alongside Flake8 and isort for drop-in parity
- Stylistic lint rules deferred when a formatter such as Black is used
Ruff formatter as a drop-in replacement
The Ruff formatter is described as a Python code formatter designed as a drop-in replacement for Black, available via ruff format in the ruff CLI. It adheres to Black's stable code style, which aims for "consistency, generality, readability and reducing git diffs". The documentation states the formatter is intended to emit near-identical output on Black-formatted code, and that more than 99.9% of lines are formatted identically when run over extensive Black-formatted projects such as Django and Zulip. Targeting Black compatibility is stated as a way to make formatter adoption minimally disruptive, given Black's popularity in the Python ecosystem.
- ruff format mirrors Black's in-place formatting behaviour
- ruff format --check exits non-zero on unformatted files, similar to Black
- Adheres to Black's stable code style
- Greater deviation expected on code that was not previously Black-formatted
Linter compatibility
The Ruff FAQ answers the question of whether the Ruff linter is compatible with Black: yes, out of the box, as long as the line-length setting is consistent between the two. Ruff is designed to be used alongside a formatter — either its own or Black — and defers implementing stylistic rules that automated formatting makes redundant. Line-length enforcement differs slightly: Black, like Ruff's formatter, makes a best-effort attempt to respect line-length but avoids automatic line-wrapping in some cases such as comments, whereas the Ruff linter flags line-too-long (E501) for any line exceeding the setting. As a result, E501 violations can still be raised when Black or ruff format is in use.
- Compatible out of the box with consistent line-length
- Ruff defers stylistic rules obviated by formatting
- E501 may still fire on lines Black leaves unwrapped
Installation and running via Astral tooling
Black is named in uv's documentation as an example of a tool published to a Python package index that uv can run or install. uv's tools interface covers running a tool in a temporary environment and installing, listing or uninstalling tools user-wide. Ruff itself, the Black-compatible alternative documented on the same site, is installable via pip and available through GitHub Actions, GitLab CI/CD images, pre-commit and Docker images.
- uvx / uv tool run — run a tool in a temporary environment
- uv tool install — install a tool user-wide
- uv tool list and uv tool uninstall — manage installed tools
Sources
Last verified 19 Sep 2026. This entry is compiled from the public web pages listed above. Nothing here is stated that those pages do not, and each of them was read on the date shown.