-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Labels
C: configurationCLI and configurationCLI and configurationT: enhancementNew feature or requestNew feature or request
Description
@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
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:
- 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.
Metadata
Metadata
Assignees
Labels
C: configurationCLI and configurationCLI and configurationT: enhancementNew feature or requestNew feature or request