Is there a tool for detecting the major Python version being used in a code base? I need to be able to examine source code and determine which version of Python to use to execute that code.
One approach I've considered is seeing if 2to3 suggests any changes. Any suggestions would indicate Python 2, otherwise I could assume Python 3. This feels slightly kludgy, though, so I wonder if there isn't a better approach.