15

If I was going to start an open source project using Python what version should I use to ensure that the vast majority of users can use it on their system?

I'm the kind of person who quickly jumps to the next version (which I'll do when Python 3 comes out) but many people may be more conservative if their current version seems to be working fine. What version would hit the sweet spot but still allow me to enjoy the newest and coolest language enhancements?

6 Answers 6

6

As python is in kind of an transition phase towards python 3 with breaking backward compatibility I don't think it is a good idea to go python 3 only. Based on the time line there will be at least one or two following releases of the 2.x series after 2.6/3.0 in october.

Beside not having python 3 available on your target platforms, it will take some time until important external python libraries will be ported and usable on python 3.

So as Matthew suggests staying at 2.4/2.5 and keeping the transition plan to python 3 in mind is a solid choice.

1
  • 2
    It's interesting to me that as of July 2010, the same thing is basically true, and that nothing has changed. Maybe the 2.7 release would be the new advice.
    – Warren P
    Jul 9, 2010 at 20:55
4

I've not seen a system with less than 2.3 installed for some time. Mostly 2.4+ is installed by default for most OS I use now. 2.3 is just on an older Solaris machine. Linux distros tend to have 2.4+, as does OS X.

IIRC, 2.4 has a lot of the features 2.5 does, but usable only with

from __future__ import *
1

You can use different versions of python on each machine.

Coding something new, I would not use anything less than python2.5. You can do apt-get install python2.5 on stock debian stable.

For windows, don't really worry about it. It's very easy to install the python2.5 msi.

If the users can't be bothered to do that, you can deploy an executable with py2exe (so simple) and build an installer with inno setup (again simple) then it will behave like a standard windows application and will use its own python dlls, so no need to have python installed.

Like Peter said: keep in mind the transition to 3.0 but don't build on it yet.

1

Python 2.3, or 2.2 if you can live without the many modules that were added (e.g. datetime, csv, logging, optparse, zipimport), aren't using SSL, and are willing to add boilerplate for True/False.

2.4 added decorators. generator expressions, reversed(), sorted(), and the subprocess and decimal modules. Although these are all nice, it's easy to write Pythonic code without them (assuming that your project wouldn't make heavy use of them).

2.5 added with, relative imports, better 64 bit support, and quite a bit of speed. You could live without all of those easily enough.

2.6 isn't released (although it's very close), so while it might appeal to developers, it doesn't have the compatibility you're after.

Take a look at the release notes for 2.3, 2.4, 2.5, and the upcoming 2.6 (use http://www.python.org/download/releases/2.Y/highlights/ where 'Y' is the minor version).

FWIW, for SpamBayes we support 2.2 and above (2.2 requires installing the email package separately). This isn't overly taxing, but the 2.3 additions are useful enough and 2.3 old enough that we'll probably drop 2.2 before long.

0

If the project is going to be mainstream and will be run on Linux the only sensible choise is 2.4 - just because it is a pain to get anything else installed as default on Enterprise Linuxes.

In any case, any modern OS will/can have 2.4 or newer.

0

You should use Python 2.7, the final major version of Python 2.

Python 3.x currently has limited 3rd-party library support, and is often not installed by default. So you are looking at the 2.x series.

Python 2.7 is essentially fully backwards-compatible with earlier 2.xs. In addition, it can give deprecation warnings about things that won't work in Python 3. (Particularly, it will pay to maintain unit tests, and to be pedantic about Unicode- vs. byte-strings.) The warnings will force you to write good code that the automated 2to3 tool will be able to translate to Python 3.

Guido van Rossum officially recommends maintaining a single Python 2 code-base, and using 2to3 together with unit testing to produce compatible releases for Python 2 and 3. (Since PEP 3000 was written, Python 2.6 has been superseded by 2.7.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.