← All open source projects

Black

psf/black

Black is an opinionated Python code formatter with very few configuration choices.

Forks 2,781
Author psf
Language Python
License MIT
Synced 2026-06-27

What it is

Black is an automatic Python code formatter. It became a de facto standard because of its uncompromising approach: fewer options, fewer debates, and the same result for everyone.

Manual formatting creates review noise, mixes style with logic, and takes attention away from meaningful changes. This catalog page treats the project as a concrete tool with context, typical use cases, and limits, not just as a ranked repository.

What is inside

The repository contains the formatter, parser, code output rules, CLI, test suites, integrations, and usage documentation.

Black reads Python files, builds an internal representation, and rewrites code in a stable format while preserving behavior. That repository shape helps readers understand whether they are looking at a library, an application, a learning course, or a reference guide.

How it is used

Teams run Black locally, through pre-commit, in CI, or inside editors so formatting stays automatic.

A practical path is to format the project once in a dedicated commit and then check formatting on every change. A good first step is to repeat the small scenario below and then test the project against your own data, code, or team task.

Strengths and limits

The strength is predictability and reduced code-review noise.

The limitation is that it intentionally leaves little room for personal taste; teams need to accept the style as a technical rule.

The practical value of Black is easiest to see through a small verifiable scenario: take the task the project was made for and follow it to a result. Black formats Python code automatically so teams spend less time debating style and more time reviewing behavior. That makes the project easier to judge by actual work removed from the team.

If Black remains in use beyond the first experiment, maintenance, updates, access rules, license terms, and clear ownership become as important as features. That is where the difference between an interesting repository and a durable product dependency usually appears.

Black is also easier to understand through practice than through metadata alone. It has a concrete audience, a typical adoption path, and conditions where it becomes useful or unnecessary.

Example

Проверка и форматирование Black

Пример показывает обычный режим: сначала проверить формат, затем применить автоматическое исправление.

Language: Bash
black --check .
black .