isort icon indicating copy to clipboard operation
isort copied to clipboard

Relative path not in sorting order with `--fss`

Open robsdedude opened this issue 2 years ago • 0 comments

Hi. I have a similar issue to https://github.com/PyCQA/isort/issues/1236, where my relative imports are ordered weirdly when using force_sort_within_sections=true, or --force-sort-within-sections/--fss.

Expected output:

from .. import A, B
from ..A import A
from ..B import B
from . import A, B
from .A import A
from .B import B

The output I got

from . import A, B
from .. import A, B
from ..A import A
from ..B import B
from .A import A
from .B import B

By removing the config option, the order is as expected, but I'd like to keep the way --fss mixes straight- and from-style imports.

I'm not sure if this is considered a bug or expected behavior. If it's the latter, is there a workaround to get what I want (i.e., mix straight- and from-style imports, but also keep the relative imports from furthest away to closest within the package hierarchy)?

Thanks for this great tool!

robsdedude avatar Jun 23 '22 15:06 robsdedude