PyCQA / isort

A Python utility / library to sort imports.
https://pycqa.github.io/isort/
MIT License
6.45k stars 574 forks source link

Third-party incorrectly identify as First-party depending on the name of the root directory #2240

Open pvanderlinden opened 6 months ago

pvanderlinden commented 6 months ago

Third-party packages are incorrectly identify as First-party depending on the name of the root directory. I can't find a setting to override this behaviour. Example:

tree:

some_name
|-package_name
|--__init__.py
|--file1.py
|-tests
|-docs
|-pyproject.toml

What isort thinks it should be:

import datetime

import third_party

from package_name.file1 import xyz
from some_name import xyz

What it should be:

import datetime

import third_party
from some_name import xyz

from package_name.file1 import xyz

If I rename the root directory (some_name -> some_other_name), but this means for the CI run I have to also rename the repository.