Skip to content

Incorrect third vs first party categorization - namespace packages #1443

@gaborbernat

Description

@gaborbernat

https://github.com/PyCQA/isort/blob/develop/isort/place.py#L65-L71 only considers the root module name when trying to categorize a package as first party. This causes issues when your project only contains a part of that module (e.g. in case of namespace packages). Setting known_first_party to root.a will mean that root.b will also be categorized as first party even though it's third party:

root
├── __init__.py
├── a
│   └── __init__.py
└── b
    └── __init__.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions