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

Ruff 2025 style guide #13371

Open
15 of 25 tasks
MichaReiser opened this issue Sep 16, 2024 · 9 comments · May be fixed by #13906
Open
15 of 25 tasks

Ruff 2025 style guide #13371

MichaReiser opened this issue Sep 16, 2024 · 9 comments · May be fixed by #13906
Assignees
Labels
formatter Related to the formatter help wanted Contributions especially welcome style How should formatted code look

Comments

@MichaReiser
Copy link
Member

MichaReiser commented Sep 16, 2024

From Black's changelog. Last checked 16.09.2024, Last release: v24.8.0.

Goals:

  • Close parity with Black when migrating from Black to Ruff
  • Fix Ruff specific bugs
  • Innovate on local formatting (to keep close parity with black)

Preview Styles

Black preview styles

Black unstable styles

Ruff preview styles

Ruff specific preview styles that we may want to stabilize

Ruff improvements

Open Bugs

Existing bugs in the ruff formatter for which no preview style exists.

Require a new style guide

Bug fixes that change how existing code is formatted and require a

Bug fixes that don't change existing formatting

Bug fixes that don't require a new style guide because they don't change existing cod

Black Bug fixes

Black preview styles that are related to Black-specific bug fixes. Ruff already handles those cases correctly

@MichaReiser MichaReiser added formatter Related to the formatter style How should formatted code look labels Sep 16, 2024
@MichaReiser MichaReiser self-assigned this Sep 16, 2024
@MichaReiser MichaReiser added help wanted Contributions especially welcome labels Sep 17, 2024
@MichaReiser
Copy link
Member Author

If anyone's interested in picking up one item on this list, let me know :) Happy to help

@MichaReiser
Copy link
Member Author

One open question is whether we want to support multiple formatter edition (or at least one old edition). It took the community a long time to upgrade to Ruff 0.2

@bnkc
Copy link

bnkc commented Sep 18, 2024

Hey @MichaReiser I'd be interested in picking up #11216. Let me know if this is alright. Thanks!

@MichaReiser
Copy link
Member Author

Hey @MichaReiser I'd be interested in picking up #11216. Let me know if this is alright. Thanks!

Sure. Feel free to give it a go. I don't know what changes are necessary for it but feel free to comment on that issue with ideas or go ahead with a PR and we can discuss there.

@MichaReiser

This comment was marked as outdated.

@MichaReiser
Copy link
Member Author

@dhruvmanila, do you remember what the open decisions were on the f-string formatting and what the remaining work is for it to be stabilized? Do you know if black implemented a similar formatting style?

@dhruvmanila
Copy link
Member

dhruvmanila commented Oct 1, 2024

@dhruvmanila, do you remember what the open decisions were on the f-string formatting and what the remaining work is for it to be stabilized? Do you know if black implemented a similar formatting style?

@MichaReiser
Copy link
Member Author

Regarding f-string formatting. We should look into whether it plays nicely with

fn is_huggable_string_argument(

From looking at the is_multiline implementation I get the impression that it is an over-approximation and a string that was a multiline string might collapse (but maybe that's fine?)

@MichaReiser
Copy link
Member Author

Black's plan is to stabilize all preview styles, but none of the unstable features which aligns with what I outlined in the summary. psf/black#4501

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter help wanted Contributions especially welcome style How should formatted code look
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants