Skip to content

Commit 3381b23

Browse files
JelleZijlstrapradyunsgambv
committed
Define a stability policy (#2529)
Fixes #2394. Eventually fixes #517. This is essentially @pradyunsg's suggestion from #2394. I suggest that at the same time we start the formal stability policy, we take a few other disruptive steps and drop Python 2 and the "b" marker. Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
1 parent e50a04a commit 3381b23

File tree

3 files changed

+37
-6
lines changed

3 files changed

+37
-6
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
### _Black_
88

9+
- Document stability policy, that will apply for non-beta releases (#2529)
910
- Add new `--workers` parameter (#2514)
1011
- Fixed feature detection for positional-only arguments in lambdas (#2532)
1112
- Bumped typed-ast version minimum to 1.4.3 for 3.10 compatiblity (#2519)

docs/faq.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ pragmatism. However, _Black_ is still in beta so style changes are both planned
3131
still proposed on the issue tracker. See
3232
[The Black Code Style](the_black_code_style/index.rst) for more details.
3333

34+
Starting in 2022, the formatting output will be stable for the releases made in the same
35+
year (other than unintentional bugs). It is possible to opt-in to the latest formatting
36+
styles, using the `--future` flag.
37+
3438
## Why is my file not formatted?
3539

3640
Most likely because it is ignored in `.gitignore` or excluded with configuration. See
@@ -71,9 +75,11 @@ disabled-by-default counterpart W504. E203 should be disabled while changes are
7175
## Does Black support Python 2?
7276

7377
For formatting, yes! [Install](getting_started.md#installation) with the `python2` extra
74-
to format Python 2 files too! There are no current plans to drop support, but most
75-
likely it is bound to happen. Sometime. Eventually. In terms of running _Black_ though,
76-
Python 3.6 or newer is required.
78+
to format Python 2 files too! In terms of running _Black_ though, Python 3.6 or newer is
79+
required.
80+
81+
Note that this support will be dropped in the first stable release, expected for
82+
January 2022. See [The Black Code Style](the_black_code_style/index.rst) for details.
7783

7884
## Why does my linter or typechecker complain after I format my code?
7985

docs/the_black_code_style/index.rst

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,33 @@ The Black Code Style
99

1010
*Black* is a PEP 8 compliant opinionated formatter with its own style.
1111

12-
It should be noted that while keeping the style unchanged throughout releases is a
13-
goal, the *Black* code style isn't set in stone. Sometimes it's modified in response to
14-
user feedback or even changes to the Python language!
12+
While keeping the style unchanged throughout releases has always been a goal,
13+
the *Black* code style isn't set in stone. It evolves to accomodate for new features
14+
in the Python language and, ocassionally, in response to user feedback.
15+
16+
Stability Policy
17+
----------------
18+
19+
The following policy applies for the *Black* code style, in non pre-release
20+
versions of *Black*:
21+
22+
- The same code, formatted with the same options, will produce the same
23+
output for all releases in a given calendar year.
24+
25+
This means projects can safely use `black ~= 22.0` without worrying about
26+
major formatting changes disrupting their project in 2022. We may still
27+
fix bugs where *Black* crashes on some code, and make other improvements
28+
that do not affect formatting.
29+
30+
- The first release in a new calendar year *may* contain formatting changes,
31+
although these will be minimised as much as possible. This is to allow for
32+
improved formatting enabled by newer Python language syntax as well as due
33+
to improvements in the formatting logic.
34+
35+
- The ``--future`` flag is exempt from this policy. There are no guarentees
36+
around the stability of the output with that flag passed into *Black*. This
37+
flag is intended for allowing experimentation with the proposed changes to
38+
the *Black* code style.
1539

1640
Documentation for both the current and future styles can be found:
1741

0 commit comments

Comments
 (0)