-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add --unstable flag #4096
Add --unstable flag #4096
Conversation
Seems like that's not it. |
diff-shades results comparing this PR (718ce47) to main (8fe602b). The full diff is available in the logs under the "Generate HTML diff report" step.
|
@@ -449,6 +449,12 @@ file that are not enforced yet but might be in a future version of the formatter | |||
_Black_ will normalize line endings (`\n` or `\r\n`) based on the first line ending of | |||
the file. | |||
|
|||
### Form feed characters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved from "future style", this change is in the 2024 stable style
@@ -1,117 +1,38 @@ | |||
# The (future of the) Black code style | |||
|
|||
```{warning} | |||
Changes to this document often aren't tied and don't relate to releases of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This warning isn't really true any more now that we explicitly list preview features.
_Black_. It's recommended that you read the latest version available. | ||
``` | ||
|
||
## Using backslashes for with statements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this to the end as it's a speculative feature that we haven't even implemented. The real-world preview style is more important.
These pass in stable, I think since last year
for more information, see https://pre-commit.ci
@hauntsaninja I added a separate I took the opportunity to remove |
There is no "wip.py"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making this happen!
CHANGES.md
Outdated
@@ -53,6 +61,7 @@ release: | |||
|
|||
<!-- Changes that affect Black's preview style --> | |||
|
|||
- Add `--unstable` style (#4096) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a quick link / blurb here for preview style codebases that want hug_parens?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept the hugging feature (hug_parens_with_braces_and_square_brackets
) in preview. Or maybe you're referring to multiline_string_handling
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also possibly hug_parens_with_braces_and_square_brackets
should go into unstable; I haven't thought much about it beyond not putting it in 2024 stable. We have 11 months left to do that though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry, I was wrong on the specifics. Just thought more of a mention in changelog could be nice for whatever unstable features users may want
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I'll add something.
src/black/__init__.py
Outdated
) | ||
@click.option( | ||
"--enable-unstable-feature", | ||
type=click.Choice([v.name for v in UNSTABLE_FEATURES]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be worth it to be more permissive here, so folks can set --enable-unstable-feature hug_parens
and forget about it for a year. But I think that much bother is probably fine for preview...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's actually fine since we only allow --enable-unstable-feature
if you also have --preview
, so setting it for a flag that's in preview is a no-op. I'll change this.
In psf#4096 I added a list of current preview/unstable features to the docs. I think this is important for publicizing what's in our preview style. This PR adds an automated test to ensure the list stays up to date in the future.
In #4096 I added a list of current preview/unstable features to the docs. I think this is important for publicizing what's in our preview style. This PR adds an automated test to ensure the list stays up to date in the future.
Closes #4093.
We'd need more discussion before we actually implement that idea, but this also allows me to test whether string processing is responsible for diff-shades crashing all the time.