Use the python zimports package to sort your python imports.
zimports is available via melpa. Make
sure the python zimports
executable is on PATH
.
Call zimports-buffer
to sort imports in the current python buffer.
Enable zimports-mode
to sort imports every time you save the buffer.
You can turn on zimports-mode
by creating a .dir-locals.el
file
with the following contents:
((python-mode . ((mode . zimports))))