Inconsistent isort results from the same version

The same version of all packages on two machines. The difference — one has them on virtualenv, the other globally.

The problem

isort can’t correctly determine which imports are from third party and first party when it’s installed globally.

Fixes

With conversion to virtualenv

Just install it in virtualenv. It may not be optimal when you’re using virtualization already.

Without

In isort settings file set:

default_section=THIRDPARTY

Also list all your local packages in the following option:

known_first_party=

For example:

known_first_party=my_awesome_package,tests,utils,more_utils,everything_is_an_util

Cumbersome, but that’s the workaround. Hopefully it will be fixed.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.