hhatto / autopep8

A tool that automatically formats Python code to conform to the PEP 8 style guide.
https://pypi.org/project/autopep8/
MIT License
4.54k stars 291 forks source link

Is there any tool that autoformats multiple "from" imports according to PEP E401? #673

Closed ioudas closed 1 month ago

ioudas commented 1 year ago

I'm surprised that no tool seems to regard this code as bad, since it makes git unnecessary conflicts:

from A import alpha, beta

This will create manual git conflicts for anyone changing the import.

Is there any tool that autoformats above code to:

from A import (alpha,
                beta)

Thanks for any tips

asottile commented 1 year ago

I wrote reorder-python-imports -- there's also settings for isort to do this