Zac-HD/shed

Shed requiring two passes when removing import causes ordering confusion

jakkdl opened this issue · 4 comments

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.

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.

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.

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

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