-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
Closed
Labels
Code StyleCode style, linting, code_checksCode style, linting, code_checks
Description
About 2 years ago, we introduced force_grid_wrap to reduce merge conflicts due to imports #39780
This helped, but we do better in the case when there's a single import per group.
For example, in #49736 the diff was:
- from typing import Iterator
+ from typing import (
+ Generic,
+ Iterator,
+ TypeVar,
+ ), which caused conflicts when backporting to 1.5.x, because 1.5.x didn't have the Iterator import
If the import style had instead been:
from typing import Generic
from typing import Iterator
from typing import TypeVarthen the PR above could have just added the Generic and TypeVar imports, without touching the Iterator import, and the backport wouldn't have had this conflict
As an aside, this would also remove nearly 5,000 lines of code
This is how it would look like: #50275
An alternative would be to have forced
from typing import (
Iterator,
), see #51693
This makes imports a lot longer, but has the same effect of reducing conflicts
Metadata
Metadata
Assignees
Labels
Code StyleCode style, linting, code_checksCode style, linting, code_checks