Can PyCharm's optimize imports also alphabetize them?

Viewed 11569

I am enjoying PyCharm's optimizing of Python imports - as well as removing unused imports, following PEP8 gives them a sensible layout and makes them easier to read. Is there any way to get PyCharm to additionally alphabetize them (which would make scanning them faster, for me at least)?

5 Answers

This would be a nice addition to PyCharm indeed.

Until that time there's a command line tool that does what you want called isort. It doesn't come with a plug-in for PyCharm, but can be integrated via an External command and the Synchronize files after execution option, as described in their docs. You could even hook it to the original key binding.

Related