d0aab9212a
fuzz / fuzz (3.11) (push) Failing after 1s
fuzz / fuzz (3.12) (push) Failing after 1s
build and publish / sdist + pure wheel (push) Failing after 0s
diff-shades / analysis / base / ${{ matrix.mode }} (push) Has been skipped
docs / docs (ubuntu-latest) (push) Failing after 2s
fuzz / fuzz (3.10) (push) Failing after 1s
fuzz / fuzz (3.14) (push) Failing after 0s
lint and format / lint (push) Failing after 1s
diff-shades / configure (push) Failing after 1s
docker / build (linux/amd64) (push) Has been skipped
diff-shades / analysis / target / ${{ matrix.mode }} (push) Has been skipped
fuzz / fuzz (3.13) (push) Failing after 0s
build and publish / generate wheels matrix (push) Failing after 0s
test release tool / test-release-tool (ubuntu-latest, 3.13) (push) Failing after 1s
build and publish / mypyc wheels ${{ matrix.only }} (push) Has been skipped
test / test (ubuntu-latest, 3.10) (push) Failing after 0s
test / test (ubuntu-latest, 3.11) (push) Failing after 1s
test / test (ubuntu-latest, 3.13) (push) Failing after 0s
test / test (ubuntu-latest, pypy3.11-v7.3.22) (push) Failing after 1s
test / test (ubuntu-latest, 3.15) (push) Failing after 1s
test release tool / test-release-tool (ubuntu-latest, 3.15) (push) Failing after 0s
zizmor / zizmor (push) Failing after 0s
test release tool / test-release-tool (ubuntu-latest, 3.12) (push) Failing after 4s
test release tool / test-release-tool (ubuntu-latest, 3.14) (push) Failing after 3s
test / uvloop (ubuntu-latest) (push) Failing after 1s
test / test (ubuntu-latest, 3.14) (push) Failing after 1s
test / test (ubuntu-latest, 3.12.10) (push) Failing after 5s
docker / build (linux/arm64) (push) Has been cancelled
docker / push (push) Has been cancelled
docs / docs (windows-latest) (push) Has been cancelled
test release tool / test-release-tool (windows-latest, 3.14) (push) Has been cancelled
test release tool / test-release-tool (windows-latest, 3.15) (push) Has been cancelled
test release tool / test-release-tool (macOS-latest, 3.12) (push) Has been cancelled
test release tool / test-release-tool (macOS-latest, 3.13) (push) Has been cancelled
test release tool / test-release-tool (macOS-latest, 3.14) (push) Has been cancelled
test release tool / test-release-tool (macOS-latest, 3.15) (push) Has been cancelled
test release tool / test-release-tool (windows-latest, 3.12) (push) Has been cancelled
test release tool / test-release-tool (windows-latest, 3.13) (push) Has been cancelled
test / test (macOS-latest, 3.11) (push) Has been cancelled
test / test (macOS-latest, 3.12.10) (push) Has been cancelled
test / test (macOS-latest, 3.13) (push) Has been cancelled
test / test (macOS-latest, 3.14) (push) Has been cancelled
test / test (macOS-latest, 3.15) (push) Has been cancelled
test / test (macOS-latest, pypy3.11-v7.3.22) (push) Has been cancelled
test / test (windows-11-arm, 3.11) (push) Has been cancelled
test / test (windows-11-arm, 3.12.10) (push) Has been cancelled
test / test (windows-11-arm, 3.13) (push) Has been cancelled
test / test (macOS-latest, 3.10) (push) Has been cancelled
test / coveralls-finish (push) Has been cancelled
test / uvloop (macOS-latest) (push) Has been cancelled
test / uvloop (windows-11-arm) (push) Has been cancelled
test / uvloop (windows-latest) (push) Has been cancelled
test / test (windows-11-arm, 3.14) (push) Has been cancelled
test / test (windows-11-arm, 3.15) (push) Has been cancelled
test / test (windows-latest, 3.10) (push) Has been cancelled
test / test (windows-latest, 3.11) (push) Has been cancelled
test / test (windows-latest, 3.12.10) (push) Has been cancelled
test / test (windows-latest, 3.13) (push) Has been cancelled
test / test (windows-latest, 3.14) (push) Has been cancelled
test / test (windows-latest, 3.15) (push) Has been cancelled
test / test (windows-latest, pypy3.11-v7.3.22) (push) Has been cancelled
diff-shades / compare / ${{ matrix.mode }} (push) Has been cancelled
fuzz / create-issue (push) Has been cancelled
build and publish / publish-mypyc (push) Has been cancelled
build and publish / publish-hatch (push) Has been cancelled
55 lines
2.3 KiB
Markdown
55 lines
2.3 KiB
Markdown
# The Black Code Style
|
|
|
|
```{toctree}
|
|
---
|
|
hidden:
|
|
---
|
|
|
|
Current style <current_style>
|
|
Future style <future_style>
|
|
```
|
|
|
|
_Black_ is a PEP 8 compliant opinionated formatter with its own style.
|
|
|
|
While keeping the style unchanged throughout releases has always been a goal, the
|
|
_Black_ code style isn't set in stone. It evolves to accommodate for new features in the
|
|
Python language and, occasionally, in response to user feedback. Large-scale style
|
|
preferences presented in {doc}`current_style` are very unlikely to change, but minor
|
|
style aspects and details might change according to the stability policy presented
|
|
below. Ongoing style considerations are tracked on GitHub with the
|
|
[style](https://github.com/psf/black/labels/T%3A%20style) issue label.
|
|
|
|
(labels/stability-policy)=
|
|
|
|
## Stability Policy
|
|
|
|
The following policy applies for the _Black_ code style, in non pre-release versions of
|
|
_Black_:
|
|
|
|
- If code has been formatted with _Black_, it will remain unchanged when formatted with
|
|
the same options using any other release in the same calendar year.
|
|
|
|
This means projects can safely use `black ~= 26.0` without worrying about formatting
|
|
changes disrupting their project in 2026. We may still fix bugs where _Black_ crashes
|
|
on some code, and make other improvements that do not affect formatting.
|
|
|
|
In rare cases, we may make changes affecting code that has not been previously
|
|
formatted with _Black_. For example, we have had bugs where we accidentally removed
|
|
some comments. Such bugs can be fixed without breaking the stability policy.
|
|
|
|
- The first release in a new calendar year _may_ contain formatting changes, although
|
|
these will be minimised as much as possible. This is to allow for improved formatting
|
|
enabled by newer Python language syntax as well as due to improvements in the
|
|
formatting logic.
|
|
|
|
- The `--preview` and `--unstable` flags are exempt from this policy. There are no
|
|
guarantees around the stability of the output with these flags passed into _Black_.
|
|
They are intended for allowing experimentation with proposed changes to the _Black_
|
|
code style. The `--preview` style at the end of a year should closely match the stable
|
|
style for the next year, but we may always make changes.
|
|
|
|
Documentation for both the current and future styles can be found:
|
|
|
|
- {doc}`current_style`
|
|
- {doc}`future_style`
|