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

Create the 2024 stable style #4106

Merged
merged 30 commits into from
Jan 25, 2024
Merged

Create the 2024 stable style #4106

merged 30 commits into from
Jan 25, 2024

Conversation

JelleZijlstra
Copy link
Collaborator

Closes #4042.

Replacing #4064. I need a branch in this repo instead of my fork so I can create an alpha release from it.

This should mostly become the stable style. parenthesize_conditional_expressions and wrap_long_dict_values_in_parens should be reverted unless the issues currently open for them (listed in #4042) are fixed.

Copy link

github-actions bot commented Jan 24, 2024

diff-shades reports zero changes comparing this PR (a646358) to main (8fe602b).


What is this? | Workflow run | diff-shades documentation

@JelleZijlstra
Copy link
Collaborator Author

@hauntsaninja @cooperlees I think this is ready to go, I'll merge it soon unless you have any objections.

After this is merged, I'd also like to add the --unstable style (#4093) so that Black 24 can start its life with a meaningful preview style.

Copy link
Collaborator

@cooperlees cooperlees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good to me - I tried to look for typos etc. and couldn't find any.

Going to trust a lot of conversation I didn't part take in.

Assuming the diff shades changes are expected.

@JelleZijlstra JelleZijlstra merged commit 59b9d85 into main Jan 25, 2024
24 of 25 checks passed
@JelleZijlstra JelleZijlstra deleted the black24 branch January 25, 2024 01:06
@hauntsaninja
Copy link
Collaborator

hauntsaninja commented Jan 25, 2024

The changelog claims Black standardised on a single newline after module docstrings. However, this is false.

~/dev/black main λ cat z.py
"""
fdf
"""

def foo(): ...
~/dev/black main λ black --check z.py --diff
--- z.py	2024-01-25 07:04:18.399496+00:00
+++ z.py	2024-01-25 07:08:38.133709+00:00
@@ -1,5 +1,6 @@
 """
 fdf
 """
 
+
 def foo(): ...
would reformat z.py

Oh no! 💥 💔 💥
1 file would be reformatted.

I think it could be nice for what the changelog says to be true. I can keep the change ready. Thoughts?

Edit: okay, I missed #4027, this is intentional. I can just submit a PR updating the changelog then

@@ -168,35 +168,14 @@ def supports_feature(target_versions: Set[TargetVersion], feature: Feature) -> b
class Preview(Enum):
"""Individual preview style features."""

add_trailing_comma_consistently = auto()
blank_line_after_nested_stub_class = auto()
blank_line_between_nested_and_def_stub_file = auto()
hex_codes_in_unicode_sequences = auto()
Copy link

@MichaReiser MichaReiser Feb 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe there's a mistake in the changelog or the flag here is a leftover. The changelog mentions that the hex normalisation shipped, but the preview flag still exists in the code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, you're right. I must have confused myself somewhere. I guess this preview feature will have to wait another year.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting the 2024 stable style
4 participants