mortymacs
mortymacs

Reputation: 3726

How to detect minimum version of python that a script required

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

Upvotes: 36

Views: 10506

Answers (2)

Morten Kristensen
Morten Kristensen

Reputation: 7613

I know this is an old post, but I've recently started a project called Vermin that tries to detect the minimum required Python versions needed to run code. It will do what you request, @Mortezaipo.

Upvotes: 43

Martijn Pieters
Martijn Pieters

Reputation: 1121158

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.

Upvotes: 2

Related Questions