I have a project that I've recently upgraded to Python 3. Now that I've dropped Python 2 support, I'd now like to remove the from __future__
imports, and think I might be able to use isort
(docs)
Say I have a file myfile.py
:
from __future__ import print_function
from foo import bar
import baz
I can run the following command,
isort --rm __future__ myfile.py
and it rewrites my file to
import baz
from foo import bar
It's removed the __future__
import as required, but it's also reordered the other imports. This will make it harder to review the patch when there are thousands of files in the project.
Is it possible to run isort
so that it only removes the import, and doesn't make any other changes?