Relative path not in sorting order with `--fss`
Author: robsdedudeCreated Jun 23, 2022Updated Aug 3, 2026
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 BThe 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 BBy 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!
Source: PyCQA/isort