-
Notifications
You must be signed in to change notification settings - Fork 1.7k
isort: Support disabling sections with no-sections = true
#8657
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
Conversation
|
202516f to
40a1c21
Compare
charliermarsh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for getting involved! No objection to adding this, and no objection to using the same nomenclature and API as isort. Left a few small questions and comments, but should be able to get this merged relatively quickly.
This is similar to what exists in upstream isort. Fixes astral-sh#8653
40a1c21 to
fa21675
Compare
no_sections = falseno-sections = true
charliermarsh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Summary
This adds a
no-sectionsoption for isort in the linter, similar to theno_sectionsoption that exists in upstream isort (https://pycqa.github.io/isort/docs/configuration/options.html#no-sections)This option puts all imports except for
__future__into the same section, and is mostly used by monorepos.I've taken a bit of a leap in assuming that ruff wants to support the exact same option; more than happy to refactor if you'd prefer a different way of setting this up.
Fixes #8653
Test Plan
I've added a test and have run it on a large Python codebase that uses isort with --no-sections. The option is disabled by default.