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

Remove unnecessary config for isort 5 #8907

Merged
merged 2 commits into from
Sep 24, 2020

Conversation

hugovk
Copy link
Contributor

@hugovk hugovk commented Sep 23, 2020

Follow up to #8902.

We can remove known_first_party and default_section = THIRDPARTY with isort 5.

https://pycqa.github.io/isort/docs/upgrade_guides/5.0.0/#module-placement-changes-known_third_party-known_first_party-default_section-etc says:

isort has completely rewritten its logic for placing modules in 5.0.0 to ensure the same behavior across environments. You can see the details of this change here. The TL;DR of which is that isort has now changed from default_section=FIRSTPARTY to default_section=THIRDPARTY. If you all already setting the default section to third party, your config is probably in good shape. If not, you can either use the old finding approach with --magic-placement in the CLI or old_finders=True in your config, or preferably, you are able to remove all placement options and isort will determine it correctly. If it doesn't, you should be able to just specify your projects modules with known_first_party and be done with it.

So default_section = THIRDPARTY is now the default and can be removed from config.


You can see the details of this change here.

says:

  • FIRSTPARTY: import name starts with .
  • FIRSTPARTY: import code exists within the files isort is told to sort.
  • FIRSTPARTY: import code exists in same directory as any files isort is told to sort.

So pip and tests match first party and this can now be removed from config:

known_first_party =	
    pip	
    tests

@pradyunsg pradyunsg added skip news Does not need a NEWS file entry (eg: trivial changes) type: maintenance Related to Development and Maintenance Processes labels Sep 23, 2020
Copy link
Member

@pradyunsg pradyunsg left a comment

Choose a reason for hiding this comment

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

Aye! This is nice!

@pradyunsg pradyunsg merged commit 061dbe8 into pypa:master Sep 24, 2020
@hugovk hugovk deleted the isort-5-config-updates branch September 24, 2020 17:44
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
skip news Does not need a NEWS file entry (eg: trivial changes) type: maintenance Related to Development and Maintenance Processes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants