strip-hints icon indicating copy to clipboard operation
strip-hints copied to clipboard

Remove "typing" imports

Open jayvdb opened this issue 3 years ago • 3 comments

If the hints are removed, the typing import should no longer be needed, except for programs which rely upon typing and probably are unsuitable for stripping of hints.

jayvdb avatar May 28 '21 04:05 jayvdb

In most cases all the typing imports could be stripped, but there isn't any easy way to strip them out and maintain guaranteed program correctness (like when just stripping hints). There are other tools out there that can remove unneeded imports which a user could run after stripping hints. So I'm not inclined to add this feature to the program.

abarker avatar May 28 '21 20:05 abarker

I am using autoflake --remove-all-unused-imports to do this, however it is more invasive than I want. The benefit of this enhancement is that it would remove only the typing imports. Anyway, I appreciate it isnt a high priority.

jayvdb avatar May 28 '21 22:05 jayvdb

Another brutal dependency-free workaround:

sed -i '/^from typing/d' *.py

neopostmodern avatar Apr 20 '23 14:04 neopostmodern