LLMpediaThe first transparent, open encyclopedia generated by LLMs

Black (software)

Generated by GPT-5-mini
Note: This article was automatically generated by a large language model (LLM) from purely parametric knowledge (no retrieval). It may contain inaccuracies or hallucinations. This encyclopedia is part of a research project currently under review.
Article Genealogy
Parent: PyCon Hop 4
Expansion Funnel Raw 76 → Dedup 15 → NER 11 → Enqueued 10
1. Extracted76
2. After dedup15 (None)
3. After NER11 (None)
Rejected: 4 (not NE: 4)
4. Enqueued10 (None)
Similarity rejected: 1
Black (software)
NameBlack
DeveloperŁukasz Langa and contributors
Released2018
Programming languagePython
Operating systemUnix-like, Microsoft Windows, macOS
LicenseMIT License
Websitehttps://github.com/psf/black

Black (software) Black is an uncompromising, opinionated source code formatter for the Python (programming language) ecosystem. It reformats source code to a uniform style, minimizing debates about code layout across projects such as Django (web framework), Flask (web framework), Pandas (software) and NumPy. Black aims to provide deterministic output so that diffs become predictable and tools like pre-commit and continuous integration systems can enforce consistency.

History

Black originated in 2018 when Łukasz Langa published an initial implementation that codified a set of formatting rules intended to reduce formatting discussions in projects including Python Software Foundation-affiliated repositories. Early adoption spread through communities around pytest, tox (software), pip and other Python Package Index-hosted projects. Over time, maintainers and contributors from organizations such as Microsoft, Google, Facebook, and the Python core development community contributed code, bug reports, and reviews. Black evolved alongside developments in the Python (programming language) language, adding compatibility for syntax features from PEP 572 to PEP 626 and integrating with tooling used by teams at Instagram, Spotify, Dropbox, and research groups in universities like MIT and Stanford University.

Features

Black provides deterministic formatting for Python (programming language) source by applying rules that prioritize consistency over configurability. Key features include automatic reformatting of function definitions and calls, predictable handling of multi-line constructs used in projects such as Celery (software), inline comments common in Jupyter Notebook conversions, and stable string normalization used by codebases at Mozilla and Red Hat. It offers a "fast" mode and a mode that respects a configurable maximum line length, compatible with conventions from PEP 8 and style guides used at Google (company) and Microsoft. Black supports features introduced in newer Python Enhancement Proposals and parses Abstract Syntax Trees similar to tools used by lib2to3 and ast-based formatters. It can produce a diff-only output suitable for review workflows at GitHub, GitLab, and Bitbucket.

Usage and Integration

Black integrates with many developer environments and platforms. It is commonly invoked from command lines used in Bash (Unix shell), PowerShell, and Windows Command Prompt inside repositories managed with Git. Integration points include editors and IDEs such as Visual Studio Code, PyCharm, Vim, Emacs, Sublime Text, and Atom (text editor), and CI services like Travis CI, CircleCI, GitHub Actions, and Azure Pipelines. Black is frequently combined with linters and analysis tools like flake8, mypy, bandit (software), and isort to provide a full-quality assurance pipeline in enterprise deployments at IBM, Oracle, and financial institutions. It is also used in education and research workflows at institutions including Harvard University and UC Berkeley for reproducible code formatting in course repositories.

Configuration and Options

Black intentionally restricts configuration to reduce bikeshedding. Typical options include line-length settings that echo recommendations from PEP 8, a "target-version" option to specify Python (programming language) syntax levels like 3.6, 3.7, 3.8 and newer, and modes such as "check" for CI and "diff" for review. Configuration is supported through files like pyproject.toml, commonly used alongside tools maintained by Python Packaging Authority and projects such as setuptools and poetry (software). Integration with pre-commit hooks commonized by pre-commit and repository settings hosted on GitHub allows teams at companies such as Shopify and LinkedIn to enforce formatting at commit time. Black deliberately omits fine-grained style switches found in formatters from vendors like JetBrains to keep behavior uniform across organizations.

Performance and Compatibility

Black is implemented in Python (programming language), leveraging parsing libraries and AST processing strategies used in lib2to3 and modern parser backends adopted by tools such as ruff. Its performance scales for large monorepos maintained with Bazel (software), Buck (software), or Pants (build system), and it provides options to limit I/O overhead when used in large microservice landscapes at Amazon (company) and Google. Compatibility is maintained with interpreter versions supported by the Python Software Foundation and with code using typing extensions popularized by PEP 484 and PEP 563. In some projects, teams measure formatting time as part of CI budgets alongside test suites run with pytest and unittest.

Reception and Adoption

Black has been widely adopted across open-source and commercial projects because of its uncompromising stance and predictable results. Major projects and organizations including Django (web framework), Pandas (software), NumPy, Mozilla, Microsoft, and cloud providers have endorsed or integrated Black into their workflows. Critics from some communities favoring customizable style rules, such as adherents of Google Python Style Guide-specific conventions or maintainers of legacy codebases at financial firms, note trade-offs between uniformity and granular control. Overall, Black's influence has shifted formatting discussions in the Python (programming language) ecosystem, enabling contributors from companies like Intel, NVIDIA, PayPal, and academic labs to focus on substantive design and correctness.

Category:Python (programming language) software