What linux distro is better suited for Python web development?

11,164

Solution 1

Largely distribution won't matter, as Python is present and largely self sufficient on virtually all Linux distributions.

If you're wanting to focus on development, I'd recommend Ubuntu. Ubuntu is arguably one of the most fully featured "ready for the user" distributions that makes system administration a snap, so you can focus on the development tasks you want to tackle.

If you have a Linux environment that's a target for your code (like say, RedHat or something), then go with the desktop distribution that matches your target environment (like, say, Fedora for RedHat, Gentoo for Gentoo, Ubuntu for Ubuntu Server, etc.)

Otherwise, all of them are suitable.

Solution 2

You distribution should have Python 2.6. Otherwise it's a matter of choice.

One advice: Never ever install anything as root (eg. python setup.py install). Only install things with your distribution's package manager and use virtualenv as a user to install other packages.

Ubuntu has a virtualenv package and it can even be used without being installed.

Solution 3

Using a distribution with the latest stable versions of Python only lets you test your code with those versions. Today it's very easy for developers to test their code with multiple Python versions.

Gentoo probably gives you the most flexibility with multiple Python versions installed at once:

    (2.5)  2.5.4-r4
    (2.6)  2.6.6-r2  or 2.6.7-r2
    (2.7)  2.7.2-r3
    (3.1)  3.1.4-r3
    (3.2)  3.2.2

That doesn't let you test on some older versions that are very popular on Debian based systems, for example.

pythonbrew lets you compile and install multiple Python versions in your home directory, no root access needed.

It's a snap testing your code with multiple versions of Python thanks to 'tox'. By default, tox will find your system python(s), but you can set custom interpreters you build with pythonbrew, for example.

Here's a tox.ini you can use with Jenkins, for continuous integration. With this setup you can install jenkins then 'su - jenkins' and use pythonbrew to install all the Python versions you want to test.

[tox]
envlist = py267,py271,py272

[testenv]
#You may need to change this. Are your tests here?
changedir=tests

#You can also use nose, etc., see documentation
deps=pytest
commands=py.test --junitxml=junit-{envname}.xml

[testenv:py272]
basepython=/var/lib/jenkins/.pythonbrew/pythons/Python-2.7.2/bin/python2.7

[testenv:py271]
basepython=/var/lib/jenkins/.pythonbrew/pythons/Python-2.7.1/bin/python2.7

[testenv:py267]
basepython=/var/lib/jenkins/.pythonbrew/pythons/Python-2.6.7/bin/python2.6

It's that easy, and it doesn't matter which Linux distribution you use.

See the Tox website for details on configuring Jenkins.

Share:
11,164
rmontgomery429
Author by

rmontgomery429

Updated on June 09, 2022

Comments

  • rmontgomery429
    rmontgomery429 almost 2 years

    Which linux distro is better suited for Python web development?

    Background:

    I currently develop on Windows and it's fine, but I am looking to move my core Python development to Linux. I'm sure most any distro will work fine, but does anyone have any reasons to believe one distro is better than another?

  • hasen
    hasen over 14 years
    For development I'd recommend Xubuntu (ubuntu with XFCE), it has much less "bloat" and doesn't get in your way as much.
  • Beni Cherniavsky-Paskin
    Beni Cherniavsky-Paskin over 14 years
    Ubuntu is also quite python-loving and has up-to-date python versions.
  • LeafStorm
    LeafStorm over 14 years
    Though when a new Python comes out, you have to wait until the next Ubuntu release for it to be included in the system. That drove me crazy waiting for Python 2.6.
  • Travis Bradshaw
    Travis Bradshaw over 14 years
    While that's true, you could replace "Ubuntu" with the name of every distribution without a loss in meaning. (Of course, you can install software without waiting on the distribution, but it's a much more "on-your-own" type of thing.)
  • rmontgomery429
    rmontgomery429 over 14 years
    Thanks for the good advise - virtualenv is definitely a good practice.
  • rmontgomery429
    rmontgomery429 over 14 years
    I've used Ubuntu before and like it just fine. I guess I was looking to see if there was something I was missing amongst all the Ubuntu craze out there.
  • Travis Bradshaw
    Travis Bradshaw over 14 years
    Ah. Nope. Generally speaking, a distro is a distro when it comes to developing on Linux, especially Python. Ubuntu makes the things that normally get in the way of productive development easier, so it's the current favorite. /me shrugs
  • vanthome
    vanthome over 9 years
    Plus you can very quickly switch between multiple versions just with eselect python ...