macOS
brew install blacklocal Homebrew formula metadata
安装
brew install blacklocal Homebrew formula metadata
sudo apk add blackAlpine Linux edge package indexes · black · 来源: dl-cdn.alpinelinux.org
sudo dnf install blackFedora Rawhide package metadata · black · 来源: dl.fedoraproject.org
nix profile install nixpkgs#blacknixpkgs package indexes · black · 来源: raw.githubusercontent.com
winget install --id psf.black -eWindows Package Manager source index · psf.black · 来源: cdn.winget.microsoft.com
概览
Python code formatter
历史
Black is the opinionated Python code formatter whose promise is deterministic, low-choice formatting. It became one of the defining Python developer tools of the late 2010s and 2020s, normalizing gofmt-style formatting in Python projects.
Black was first published to PyPI in March 2018 and its GitHub repository was created the same day. Its README and documentation present it as 'The Uncompromising Code Formatter': users trade manual formatting control for speed, determinism, smaller diffs, and fewer style arguments.
The project is now maintained under the Python Software Foundation GitHub organization. Its documentation codifies a stability policy, preview style, and yearly stable style cadence, allowing Black to support new Python syntax while preserving formatting predictability for established projects.
Black spread rapidly through PyPI, pre-commit, CI, editor integrations, and Linux/macOS/Windows package managers. The README lists major projects and organizations using it, including pytest, Django, pandas, SQLAlchemy, Home Assistant, Zulip, Dropbox, Lyft, Mozilla, Quora, and others.
Its adoption changed Python package maintenance culture: many projects stopped debating PEP 8 edge cases in reviews and delegated whitespace, wrapping, quote normalization, and import-adjacent formatting decisions to a pinned formatter version.
The standard CLI workflow is black {source_file_or_directory}; Black reformats files in place and can also run as python -m black. Configuration normally lives in a project's pyproject.toml under [tool.black], with global fallback files at $XDG_CONFIG_HOME/black or ~/.config/black on Unix-like systems and ~/.black on Windows.
Black is commonly run from pre-commit hooks, GitHub Actions, editors, and CI jobs. Its documentation recommends the psf/black-pre-commit-mirror hook for version-control integration and warns that blackd does not use pyproject.toml configuration.
Black is package-nerd significant because it made formatter pinning a first-class dependency-management concern in Python. A Black version in pyproject.toml, pre-commit config, CI images, or distro packages can affect every formatted file in a repository, so release notes and stability guarantees matter more than they do for many CLIs.
It also helped shift Python packaging metadata toward pyproject.toml as a shared control plane: the same file that PEP 518 introduced for builds became the obvious place to store Black's project style. Black's presence in Homebrew, Debian, Ubuntu, Fedora, Alpine, Nix, and winget mirrors its role as both Python package and general developer workstation tool.
For maintainers, Black became shorthand for removing a category of bikeshed from reviews. For downstream packagers, it is a high-visibility fast-moving Python application that must track supported Python versions, parser behavior, compiled wheels, pre-commit mirrors, and reproducible CLI behavior.
安全态势
formula declares a Homebrew service.
orange 风险 · 中 置信度 · infrastructure
在无人值守的代理使用前,请检查该工具是否读取明文凭据、写入远程状态、发布制品或调用插件。
local files
These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.
Config paths the tool may read or write during local use.
pyproject.toml$XDG_CONFIG_HOME/black~/.config/blackpyproject.toml~\.black可执行文件
| 命令 | 类型 | 暴露范围 | 备注 |
|---|---|---|---|
black | cli | 全局可执行文件 | |
blackd | cli | 全局可执行文件 |
新鲜度
这些信号区分页生成时间、软件包管理器活动和上游发布比较。只有存在证据 URL 和可比较版本时,才会提示版本落后。
https://black.readthedocs.io/en/stable/
安装元数据
| 软件包键 | brew:black |
|---|---|
| 版本 | 26.5.1 |
| 软件包管理器 | Homebrew |
| 软件包管理器页面 | https://formulae.brew.sh/formula/black |
| 主页 | https://black.readthedocs.io/en/stable/ |
| 仓库 | https://github.com/psf/black |
| 上游文档 | https://black.readthedocs.io/en/stable |
| 许可证 | MIT |
| 源码归档 | https://files.pythonhosted.org/packages/c0/37/5628dd55bf2b34257fc7603f0fe97c40e3aaf24265f416a9c85c95ca1436/black-26.5.1.tar.gz |
| 最后更新 | 2026-06-09T10:24:11Z |
| Pulse | updated |
| 依赖 | python@3.14 |
| 构建依赖 | rust |
| Bottle | 可用 (于 arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux) |
| Homebrew post-install | 未定义 |
| 服务 | declared |
注册表事实
| Source Database | Homebrew formula API |
|---|---|
| Tap | homebrew/core |
| Full Name | black |
| Version Scheme | 0 |
| Revision | 1 |
| Head Version | HEAD |
| Bottle Stable Root URL | https://ghcr.io/v2/homebrew/core |
| Deprecated | no |
| Disabled | no |
| Keg Only | no |
| URL Keys |
|
源数据库匹配
匹配项来自外部软件包管理器索引,并与本地 Automic Vault 软件包链接分开显示。
black 25.1.0-3+deb13u1
uncompromising Python code formatter (Python 3)
sudo apt install blackpython-black-doc 25.1.0-3+deb13u1
uncompromising Python code formatter (common documentation)
sudo apt install python-black-docblack
nix profile install nixpkgs#blackblack 24.2.0-1ubuntu1
uncompromising Python code formatter (Python 3)
sudo apt install blackpython-black-doc 24.2.0-1ubuntu1
uncompromising Python code formatter (common documentation)
sudo apt install python-black-docblack 26.3.0-r1
The uncompromising Python code formatter
sudo apk add blackblack-bash-completion 26.3.0-r1
Bash completions for black
sudo apk add black-bash-completionblack-fish-completion 26.3.0-r1
Fish completions for black
sudo apk add black-fish-completionblack-pyc 26.3.0-r1
Precompiled Python bytecode for black
sudo apk add black-pycblack-zsh-completion 26.3.0-r1
Zsh completions for black
sudo apk add black-zsh-completionblack 25.1.0-9.fc45
The uncompromising code formatter
sudo dnf install blackpsf.black
winget install --id psf.black -e来源线索
此页面由 av-web 从 scripts/generate-pkg-sqlite.py 生成的私有软件包 SQLite 工件提供。
View the package source record on GitHub.