Configure isort to not touch already existing sections but only sort within sections

292 Views Asked by At

I want to configure isort such that it doesn't touch my sections but only sorts within sections alphabetically or according to some other parameter. Namely I want it to turn:

import z
import a

from my.package.b import thing
from my.package.a import other

into:

import a
import z

from my.package.a import other
from my.package.b import thing

or any other readable ordering. Is this possible?

1

There are 1 best solutions below

0
kamiwis On

I believe you can set the force_alphabetical_sort_within_sections option to true to accomplish this. (isort configuration options)