Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate unusual ways to set things in pyproject.toml #4178

Open
JelleZijlstra opened this issue Jan 26, 2024 · 1 comment
Open

Deprecate unusual ways to set things in pyproject.toml #4178

JelleZijlstra opened this issue Jan 26, 2024 · 1 comment
Labels
C: configuration CLI and configuration T: enhancement New feature or request

Comments

@JelleZijlstra
Copy link
Collaborator

@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.
@JelleZijlstra JelleZijlstra added T: enhancement New feature or request C: configuration CLI and configuration labels Jan 26, 2024
@henryiii
Copy link
Contributor

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.

Just a thought.

FYI, SchemaStore used to encourage strictness, but has gone toward encouraging matching what tools accept. See SchemaStore/schemastore#3467 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: configuration CLI and configuration T: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants