Sort imports below __all__
#8540
Closed
JacobCoffee
started this conversation in
Ideas
Replies: 2 comments 1 reply
-
Interesting. I'm not sure if we can reliably sort imports that are in separate blocks. This sounds like a PyCharm bug though? |
Beta Was this translation helpful? Give feedback.
1 reply
-
https://youtrack.jetbrains.com/issue/PY-63973 this was reproduced on Jetbrains' side. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When using context UI importing in PyCharm sometimes imports get place below
__all__
.I'm just wondering, even if its not "expected behavior for iSort" or whatever, if it's possible to sort this block in the event imports are below
__all__
.If
if TYPE_CHECKING:
is below__all__
, we get the same behavior - but if it is above then things import correctly.Maybe we could sort the blocks so that we have
if TYPE_CHECKING:
__all__
?
Before:
Using the little context UI to import:
The now imported and Ruff sorted block:
However, when I am using
if TYPE_CHECKING:
(above__all__
only, below is the same behavior) it correctly imports.Doing the same thing but with `if TYPE_CHECKING:`:
Beta Was this translation helpful? Give feedback.
All reactions