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

Endless import sorting #1454

Closed
PhilippSelenium opened this issue Sep 3, 2020 · 2 comments · Fixed by #1458
Closed

Endless import sorting #1454

PhilippSelenium opened this issue Sep 3, 2020 · 2 comments · Fixed by #1458
Labels
bug Something isn't working

Comments

@PhilippSelenium
Copy link

With the following setup isort claims to fix the imports on every run despite never changing anything:

.isort.cfg

[settings]
known_third_party=local_lib
import_heading_thirdparty=related third party imports

test.py

# standard library imports
import sys

try:
    # Comment about local lib
    # related third party imports
    from local_lib import stuff
except ImportError as e:
    pass

Rerun isort

$ isort .
Fixing test.py

I am not sure why this is happening but it can be fixed by

  • removing the comment
  • using a std lib import instead of local_lib

isort version 5.5.0

timothycrosley added a commit that referenced this issue Sep 4, 2020
@timothycrosley timothycrosley added the bug Something isn't working label Sep 4, 2020
timothycrosley added a commit that referenced this issue Sep 4, 2020
…ting

Fix issue #1454: Endless import sorting for indendent imports with se…
@PhilippSelenium
Copy link
Author

@timothycrosley Wow, that was fast. Thanks!

@timothycrosley
Copy link
Member

No problem happy to help! Just released it to PyPI as 5.5.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants