PyCQA / isort

A Python utility / library to sort imports.
https://pycqa.github.io/isort/
MIT License
6.49k stars 580 forks source link

False order of local imports relative to standard library imports #2257

Open JohnBioinf opened 6 months ago

JohnBioinf commented 6 months ago

I am using the isort library to automatically sort my Python imports, but I'm experiencing an issue with the ordering of the imports. Specifically, isort is grouping my local imports (e.g., from test.my_module import MyClass) with the standard library imports (e.g., import os) instead of with the other local imports (e.g., from my_app.my_module import MyOtherClass).

For example, the current ordering produced by isort is:

import os
from test.my_module import MyClass

from flask import Flask

from my_app.my_module import MyOtherClass

But as far as I understand the order should be like so:

import os

from flask import Flask

from my_app.my_module import MyOtherClass
from test.my_module import MyClass