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

Shed requiring two passes when removing import causes ordering confusion #78

Closed
jakkdl opened this issue Feb 28, 2023 · 4 comments · Fixed by #82
Closed

Shed requiring two passes when removing import causes ordering confusion #78

jakkdl opened this issue Feb 28, 2023 · 4 comments · Fixed by #82

Comments

@jakkdl
Copy link
Contributor

jakkdl commented Feb 28, 2023

another instance of isort shenanigans making shed require two passes:

-from typing import TYPE_CHECKING, Any, NamedTuple, TypeVar
+from typing import NamedTuple, TYPE_CHECKING, TypeVar
-from typing import NamedTuple, TYPE_CHECKING, TypeVar
+from typing import TYPE_CHECKING, NamedTuple, TypeVar

So in the first pass it removes Any, but also sorts the imports lexically - except on the second pass it resorts them with constants first, then lexically.

@Zac-HD
Copy link
Owner

Zac-HD commented Feb 28, 2023

Huh. If base isort does that we should report upstream and then bump shed's required version once it's fixed. If not, then we should have some "run again if means we might need to" logic.

@jakkdl
Copy link
Contributor Author

jakkdl commented Mar 1, 2023

Ah, it's autoflake getting run after isort that's the culprit here. I opened PyCQA/autoflake#229 - so we either wait for that to be resolved, and/or have shed run autoflake before isort.
Doing the latter I think also fixes #75, but maybe there's some other reason you opted to run isort before autoflake.

@Zac-HD
Copy link
Owner

Zac-HD commented Mar 1, 2023

Probably no reason, let's just swap the order 👍

DRMacIver added a commit to DRMacIver/shed that referenced this issue Mar 2, 2023
@Zac-HD Zac-HD closed this as completed in #82 Mar 2, 2023
@jakkdl
Copy link
Contributor Author

jakkdl commented Mar 11, 2023

PyCQA/autoflake#232 is now merged - so the temporary fix of running isort twice can be removed as soon as a new version is released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants