Third-party import from local folder

Answered

I have to have external package locally because it is rapidly developing. So I included it in my project as git submodule. In PyCharm I had to mark it as  Source Root. When I use `cmd+opt+L` to automatically reformat my code IDE puts imports alphabetically. 

How I want my import to be sorted:

from common import that_func  # external package

from best_package import Best # my package

What I get:

from best_package import Best # my package
from common import that_func # external package

Is there any way to mark some local folders as third-party package, so IDE could treat it properly?

0
2 comments

Hi Nikolay, did you try to install the external package as pip install -e? Unfortunately, it is not possible to mark folders as third-party packages. Please feel free to create a feature request in our bug tracker: https://youtrack.jetbrains.com/issues/PY

0

Thanks.

Your solution works for me.

0

Please sign in to leave a comment.