autoflake
can now do this with the --expand-star-imports
option, provided
__all__
or del
in the Python fileSo you could do something like
autoflake --expand-star-imports --remove-all-unused-imports --in-place --exclude "__init__.py" my-python-project/*.py