PyCQA / isort

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

isort open_stack profile not working properly #2188

Closed lricardo closed 1 year ago

lricardo commented 1 year ago

Description: When using isort command with profile open_stack it won't sort the imports correctly Example:

Sample code

import abc
from abc import abstractmethod
import random

isort should return

from abc import abstractmethod
import abc
import random

.isort.cfg

[settings]
force_single_line = True
force_sort_within_sections = True
lexicographical = True

or

.isort.cfg

[settings]
profile = open_stack

It seems like lexicographical = true is not working

Version: isort = "5.12.0", isort = "3.11"

ruimartinsptl commented 1 year ago

Same issue here 🙋‍♂️

lricardo commented 1 year ago

There isn't a bug with isort but the documentation on the profiles might be misleading for some, like me.

When we run test_open_stack.py it will call isort_test with a config with the following values

{'known_first_party': ['nova'], 'order_by_type': False, 'profile': 'open_stack', 'py_version': '2'}

I thought, reading the docs that using open_stack per-se would be enough but I found that I was missing the definition of the known_first_party and 'order_by_type': False.

I will now close it. Thanks.