-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Is your feature request related to a problem? Please describe.
Black recently released v23.1 which broke CI builds due to needing to reformat everything to the new "2023" style of code (see also: #3538)
Describe the solution you'd like
I would like to use v23.1 or higher and still maintain my old formatting to reduce churn and friction for new and old contributors to my project. This could be done using something like --style=2023
or --style=2022
.
Describe alternatives you've considered
Pinning black
in CI to a specific version. In my opinion this is unfeasible however, more on that below.
Additional context
With the formatting changes introduced, CI changes are bound to happen if you let yourself use an unbound (i.e. "latest") version of black
. Some might say this is to be expected, because as per the stability policy you should instead pin the version to a "major" version instead to get the style.
This implementation of pinning to CI, however, is infeasible. The main friction comes from various contributors for different projects who now have to maintain different versions of black either in various virtual environments or know which version to install for which project. Development tools such as integrations with IDEs might also use a globally installed black
executable. As more time goes on this friction of style changes will keep happening if we're unable to pick the style edition.
It is my understanding that the appeal of "black" was to not have to worry about formatting bikeshedding, but with the introduction of style editions this introduces another dimension of formatting bikeshedding.
Right now, these changes are backwards compatible so that code formatted with v23.1 when run with v22.6 will not incur changes to the output. I have only tested this with my project's configuration so I'm unsure if this holds true with the default set of features if no flags or configuration is given. However, from the stability policy there is no mention that these changes would end up being backwards compatible long term or something that is guaranteed.