3

I'm struggling with isort library which is sorting imports in my project.

To avoid circular dependencies, I need to import packages in following order:

from foo import *
from bar import *
from eggs import *
from spam import *

But instead of that it sort them alphabetically as you may expect.

from bar import *
from eggs import *
from foo import *
from spam import *

I tried to use noqa with some codes for import lines and for whole file, but it didn't help.

How to ignore/noqa orderign for that import?

anthony sottile
  • 61,815
  • 15
  • 148
  • 207
wowkin2
  • 5,895
  • 5
  • 23
  • 66

1 Answers1

3

Looks like isort:skip is what you are looking. Here are few more examples and options of how to use it:

from foo import *  # isort:skip
from bar import *
from eggs import *
from spam import *
wowkin2
  • 5,895
  • 5
  • 23
  • 66