4

I wrote a Python program, and I'm using a library that requires Python >= 3.0. When I wrote some code, I used some syntax introduced in 3.2, maybe 3.6, it was a long time ago! So now I have this piece of code, which will surely not run on Python 2.6, or Python 3.0, but I don't know exactly the minimum version required to run my script.

So, how can I find out what's the minimum Python version that runs my script?

5
  • 10
    gocomics.com/calvinandhobbes/1986/11/26 Commented Jan 21, 2017 at 23:42
  • 6
    Run it on older and older versions until it breaks? Commented Jan 21, 2017 at 23:42
  • @MichaelGeary - Yes, that. Commented Jan 21, 2017 at 23:44
  • Maybe if you have an example of the syntax someone might know... Commented Jan 22, 2017 at 0:47
  • I would start with 3.0 right away and if it passes that then you know you are good for each of the Python 3 version. Python 2 is a different story. 2 and 3 are not exactly compatible. And 2.6 and below are deprecated so you shouldn't have to worry about those. Commented Jan 22, 2017 at 3:14

1 Answer 1

2

The tox library allows you to test a package using multiple versions of python. That will help you find out which versions your package will run on.

This requires a test script (such as unit tests) that exercise your code sufficiently to surface issues.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.