Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I isort using ruff?

Tags:

python

isort

ruff

I often work in very small projects which do not have config file. How do I use ruff in place of isort to sort the imports? I know that the following command is roughly equivalent to black:

ruff format .

The format command do not sort the imports. How do I do that?

like image 619
Hai Vu Avatar asked Sep 12 '25 01:09

Hai Vu


1 Answers

According to the documentation:

Currently, the Ruff formatter does not sort imports. In order to both sort imports and format, call the Ruff linter and then the formatter:

ruff check --select I --fix .
ruff format .
like image 99
Andrej Kesely Avatar answered Sep 14 '25 14:09

Andrej Kesely