Skip to content

Group plain imports - #2614

Draft
DanielNoord wants to merge 1 commit into
mainfrom
group-plain-from-imports
Draft

Group plain imports#2614
DanielNoord wants to merge 1 commit into
mainfrom
group-plain-from-imports

Conversation

@DanielNoord

@DanielNoord DanielNoord commented Aug 5, 2026

Copy link
Copy Markdown
Member

Closes #2455

Code is still to be improved. I'm also unsure about some of the changes to expected test output...

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.33%. Comparing base (8d8d49d) to head (a114126).
⚠️ Report is 22 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2614      +/-   ##
==========================================
- Coverage   99.39%   99.33%   -0.07%     
==========================================
  Files          41       41              
  Lines        3163     3172       +9     
  Branches      682      686       +4     
==========================================
+ Hits         3144     3151       +7     
- Misses         11       12       +1     
- Partials        8        9       +1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DanielNoord
DanielNoord force-pushed the split-out-as-imports branch from 873f015 to 300a1dc Compare August 5, 2026 21:40
@DanielNoord
DanielNoord force-pushed the group-plain-from-imports branch from cefc0d0 to 52f4789 Compare August 5, 2026 23:21
@DanielNoord
DanielNoord force-pushed the group-plain-from-imports branch 2 times, most recently from cc796a7 to 109c47b Compare August 7, 2026 14:45
Base automatically changed from split-out-as-imports to main August 7, 2026 20:28
@DanielNoord
DanielNoord force-pushed the group-plain-from-imports branch from f693a88 to a4f5d68 Compare August 7, 2026 21:25
@DanielNoord
DanielNoord force-pushed the group-plain-from-imports branch 3 times, most recently from e7cc475 to 3a6f53f Compare August 8, 2026 21:02
@DanielNoord
DanielNoord force-pushed the group-plain-from-imports branch from 3a6f53f to a114126 Compare August 8, 2026 21:13
@DanielNoord DanielNoord added the build-wheels Label to apply to pull requests to trigger a build of the wheels label Aug 18, 2026
@staticdev

Copy link
Copy Markdown
Collaborator

@DanielNoord on a first look I see:

If you want I can try to do commits to help this PR as well.

@DanielNoord

Copy link
Copy Markdown
Member Author

@staticdev

Doesn't this address it? I thought it did but might need to double check. I think the original error is just attributing an underlying problem (not merging/grouping plain from imports) to unrelated configuration options.
By grouping plain imports we necessarily need to handle comments on the import statements we are grouping.
The tests fail because this is a breaking change and both django and habitat don't conform to this style. Note that this is the style that ruff enforces by default.

@staticdev staticdev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@DanielNoord sorry, I double-checked and the core behavior looks correct: the original multiline reproducer groups all plain imports into one statement, keeps the aliased import separate, and is idempotent with and without --fss.

I would propose to close this:

  • Add the exact long multiline #2455 reproducer as a regression test.
  • Add the reverse alias-before-plain case and assert idempotency.
  • Keep the Django and Habitat skips, but clarify that they reflect incompatibility with the intentional breaking style.

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

Labels

build-wheels Label to apply to pull requests to trigger a build of the wheels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--fss may lead to incorrect import separation for mixed multi-line and alias imports

2 participants