Create

Sign in to ReadmeX

or

How we handle your data: Privacy Policy

ReadmeX

Your AI reading companion

What would you like to catch up on?

Pick a briefing, or ask your own question.

Your community and people briefings stay personal to you.

black

black: An uncompromising Python code formatter.

What problem it solves

Manual Python formatting consumes time and mental energy while producing inconsistencies between projects and code review diffs. Developers need a predictable formatter that applies a consistent style without requiring extensive configuration.

Key features

  • Opinionated Python formatting — Black applies a PEP 8 compliant, opinionated style and reformats entire files in place. Configuration options are deliberately limited and rarely added.

    Source: README

  • Consistent output across projects — The formatter produces code that looks the same across projects, making formatting transparent over time. Its consistent output also helps keep code review diffs focused.

    Source: README

  • Sensible defaults with project configuration — Black works without initial configuration and can read project-specific command-line defaults from a pyproject.toml file. Custom include and exclude patterns are available for project needs.

    Source: README, pyproject.toml

  • AST validity safety check — Before completing, Black checks that the reformatted code still produces a valid AST that is effectively equivalent to the original. Users who are confident in the transformation can opt out with the fast mode.

    Source: src, tests, README

  • Python and Jupyter support — Black requires Python 3.11 or later and provides a separate installation option for formatting Jupyter Notebooks. It can also run as a Python package when direct script invocation is unsuitable.

    Source: README

Quick start

Copied verbatim from the project's README.

black {source_file_or_directory}
python -m black {source_file_or_directory}

Who it may suit

Inference: Black may suit Python developers and teams that want a consistent, low-configuration formatting workflow, including projects that format Jupyter Notebooks.

Topics to discuss

  • Which upcoming Python syntax or formatting cases should receive attention from the community?

  • How should projects balance sensible defaults with the need for project-specific configuration?

  • What practices should contributors follow when suggesting changes to the code style?


Written by ReadmeX AI from the project's README, source and public GitHub data; it may contain mistakes.

Read the original README https://github.com/psf/black#readme

ReadmeX opened this community for a trending project; it is not run by the project. Maintainers can claim it from the community page.

github.comhttps://github.com/psf/black

Comments

…