Thanks to visit codestin.com
Credit goes to github.com

Skip to content

STY: ruff/isort config tweaks - episode 2 #29185

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jorenham
Copy link
Member

This follows #29183. It's a separate PR, because not everyone might like these two config options.

I feel like combine-as-imports rule is a rather natural rule, but that's probably just a personal preference thing.

The split-on-trailing-comma rule, on the other hand, is rather unforgiving. It can reduce diffs, but it takes away the freedom of choosing to vertically align your imports. However, if you really want to do so anyway, then there's always the option of throwing a # noqa: I001 at it.

(and don't worry, I'm not planning on making this a trilogy)

@charris
Copy link
Member

charris commented Jun 12, 2025

I like a lot of these changes. I'm also growing fond of the one line/item style, it is easy to read even though it takes more space, maybe even some of the one line multiple imports would benefit from that.

@jorenham
Copy link
Member Author

jorenham commented Jun 12, 2025

I'm also growing fond of the one line/item style, it is easy to read even though it takes more space, maybe even some of the one line multiple imports would benefit from that.

Do you mean something like:

from .utils import (
    test_directory as test_directory,
    test_id as test_id
)

Because if so, we could enable force-wrap-aliases.

Or are you talking about force-single-line?

@charris
Copy link
Member

charris commented Jun 12, 2025

Yep, something like that. But I would hesitate to force that until there is a consensus. That said, it would probably be an easy follow on to this if we decide to go that way.

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

Successfully merging this pull request may close these issues.

2 participants