Skip to content

isort behavior depends on available libraries  #789

@ppwwyyxx

Description

@ppwwyyxx

It appears that isort uses available libraries to determine whether a library is third-party or not. When bob is not installed, it produces:

import numpy

import bob

When bob is installed, it produces:

import bob
import numpy

This non-determinism is very undesired. A python project may have some optional dependencies that's only required by some of its files. Different developers of such project may not have the same dependencies installed and therefore get different outputs by isort. This makes it impossible to use isort as a mandatory linter or pre-commit hooks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions