-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
isort: bug in sorting sub-package modules #3059
Comments
I'm tempted to call this unsupported. Isn't the issue here that you're marking a module and one of its submodules as third- and first-party respectively? |
ruff should be isort compatible, right? we have a main package |
The intent is to be |
e.g. packages named "foo.bar" additionally make sure `__future__` imports are always sorted at the very top. Issue astral-sh#3059
I provided a fix in #3064. Isort has a test case for it: https://github.com/PyCQA/isort/blob/main/tests/unit/test_isort.py#L2213-L2304 → |
e.g. packages named "foo.bar" additionally make sure `__future__` imports are always sorted at the very top. Issue astral-sh#3059
e.g. packages named "foo.bar" additionally make sure `__future__` imports are always sorted at the very top. Issue astral-sh#3059
e.g. packages named "foo.bar" additionally make sure `__future__` imports are always sorted at the very top. Issue astral-sh#3059
One usecase where we encounter the same issue are namespace packages. We have different packages (in different repositories) share the same namespace package. With the following config, isort lists
I played around with |
Allow submodules to be specified in know_first_party and known_third_party config options. When two entries in config options share the same prefix, the longest match wins. Fixes astral-sh#3059
Allow submodules to be specified in know_first_party and known_third_party config options. When two entries in config options share the same prefix, the longest match wins. Fixes astral-sh#3059
.isort.cfg
valid isort-compatible code:
pyproject.toml
:The text was updated successfully, but these errors were encountered: