isort
isort copied to clipboard
How do I tell isort that a local import that happens to have the same name as a third party library is a local folder?
I currently have a directory in my project called common
. In my main script I import certain things from this module such as from common import A, B
. In my .isort.cfg
file I have sections=FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
and so I know that this import statement should be in the last section.
However, whenever I run isort it separates the common
import in its own section after STDLIB
. Is there any way for me to prevent this?
My entire .isort.cfg
file looks like this:
[settings]
multi_line_output=3
lines_after_imports=2
sections=FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
[tool.isort]
profile="black"
The imports look like this:
# Before isort
STDLIB
THIRDPARTY
from common import A, B
LOCALFOLDER
# After isort
STDLIB
from common import A, B
THIRDPARTY
LOCALFOLDER