How to detect minimum version of python that a script required

python

Solution

There isn't really an automated way to check what features your code is using and correlate that to specific Python versions. If your code relies on fixed bugs or additional keywords to existing methods, the version detection gets harder still.

Generally speaking, you set the minimal version based on experience and knowledge of what features you are using; you can check the What's New documentation.

If you have a comprehensive test suite, you could just run that on older Python versions; if all your tests pass you support that older version.

Problem

I have built an application with python. How can I detect minimum version of Python that my application needs? Like Django , in that website it tells you the minimum version of python that it required (example: 2.6.6 and later). It means I wanna tell to user what minimum version of python he should install on his system

Original source