Is there something similar to Pylint, that will look at a Python script (or run it), and determine which version of Python each line (or function) requires?
For exam
Not an actual useful answer but here it goes anyway. I think this should be doable to make (though probably quite an exercise), for example you could make sure you have all the official grammars for the versions you want to check, like this one .
Then parse the bit of code starting with the first grammar version. Next you need a similar map of all the built-in module namespaces and parse the code again starting with the earliest version, though it might be tricky to differentiate between built-in modules and modules that are external or something in between like ElementTree.
The result should be an overview of versions that support the syntax of the code and an overview of the modules and which version (if at all) is needed to use it. With that result you could calculate the best lowest and highest version.