noqa isort in module imports

2.6k Views Asked by At

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?

1

There are 1 best solutions below

0
On

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 *