Automatically _remove_ type annotations from a .py file?


Is there a tool or technique that will allow me to keep type annotations in a python3 module, while also automatically deriving a no-type-annotations version for python2? I’m willing to sacrifice the type annotations for the python 2 version - no .pyi needed.

Might 3to2 do that?

I know, python2 is long dead, but while we’re nearly fully ported we’re not all the way there yet.

I found Remove type hints in Python source programmatically - Stack Overflow

Perhaps that’s the best option?