Skip to content

Automated Refactoring with Black

What Black does

Black is an opinionated formatter that:

  • rewrites code formatting automatically
  • enforces consistent style

Run

black .
black .

Check only (CI mode):

black --check .
black --check .

Configure line length

In pyproject.tomlpyproject.toml:

[tool.black]
line-length = 88
[tool.black]
line-length = 88

Tip

Run Black before linting so style issues disappear.

If this helped you, consider buying me a coffee ☕

Buy me a coffee

Was this page helpful?

Let us know how we did