You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@henryiii shared some useful data on common Black configurations in pyproject.toml files found on PyPI. A few pieces of weirdness stood out:
Some people set line-length to a string, e.g. line-length = "100". This is very rare, about 25 instances total out of almost 20k (~0.1%).
We allow both line_length and line-length. In Henry's sample, line_length was used about 3% as much as line-length. Our documentation only uses the hyphenated versions.
This might cause problems when we add a JSON schema (#4160), because it's harder to provide useful feedback to users if anything is allowed. For the typing issue, it also just seems confusing to allow setting an integer value to a string.
Proposed actions:
In the documentation, state clearly that the hyphenated versions are preferred and that you should use the right type.
Print a warning if we encounter the incorrect versions, and possibly remove support for them in Black 25 next year. I feel this is definitely appropriate for values of the wrong type. For the underscored versions, I feel deprecation is less justifiable as they're more common in practice and less likely to lead to confusion. Curious to hear other opinions on whether that is worth deprecating.
The text was updated successfully, but these errors were encountered:
IMO, you could deprecate the unusual types, and produce a warning, and "verbally" deprecate (as in, no warning, but docs discourage it). I think that would be enough to leave the alternate forms out of the Schema, or at the very least have them deprecated there (though most tools don't do much with the info, since it's technically not part of schema v7). Then if usage of the _ versions decreases, maybe eventually a warning could be produced.
@henryiii shared some useful data on common Black configurations in pyproject.toml files found on PyPI. A few pieces of weirdness stood out:
line-length = "100"
. This is very rare, about 25 instances total out of almost 20k (~0.1%).line_length
andline-length
. In Henry's sample,line_length
was used about 3% as much asline-length
. Our documentation only uses the hyphenated versions.This might cause problems when we add a JSON schema (#4160), because it's harder to provide useful feedback to users if anything is allowed. For the typing issue, it also just seems confusing to allow setting an integer value to a string.
Proposed actions:
The text was updated successfully, but these errors were encountered: