Sort Orders
#630
Replies: 3 comments 3 replies
-
I think that this is good to codify and I agree with the way it is formatted above except that there should not be whitespace between numpy and sklearn.manifold -- they are all library dependencies. |
Beta Was this translation helpful? Give feedback.
1 reply
-
hello world |
Beta Was this translation helpful? Give feedback.
0 replies
-
i think i agree with the above, i always just use the |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In #628 @vmdhhh sorted all the imports after I asked him to sort the
from typing ...
line. He wasn't sure he should have and was a bit alarmed and I realized that while we (meaning JHU and Microsoft) had talked about this in the past, we didn't really codify what we expected.Rather than keep expecting the outside world to know our little enclave's rules of thumb, we should write them down and put them in our contribution guide.
@bdpedigo @j1c @asaadeldin11 @alyakin314 @Nyecarr, I'm kind of initially proposing (without any super deep thought, just as a starting point for discussion):
Imports should be grouped by type, and alphabetized within that group
So an example would be:
There's a little bit in the relative imports that make this not super straight forward - namely, should we treat
..
and.
as equivalent for the purposes of sorting, such that it becomes:Or should we keep them separated?
(Aside: is it even possible to go up more than one level with the relative imports? Like, could I do
from ...foo import bar
from something 5 packages deep?, presuming foo.py was a toplevel module?)Beta Was this translation helpful? Give feedback.
All reactions