The Situation

Whenever a new developer arrives to the team he and/or the IT department usually spends some time on setting up their development workstation. This time is wasted as the man-hours spent on setting up a new workstation could have been spent on creating a better product (aka adding value).

The Task

Automating the installation and configuration of a new development workstation while still maintaining flexibility and room for personal customization and preferences using scripting.

Selecting an Operating System

For Python development I strongly suggest a Linux based OS. My personal choice is Ubuntu.

Why Linux?

Most Linux distributions are shipped with Python already installed.

Most if not all Linux distributions are shipped with a C compiler which allows us to compile Python C extensions with no effort.

Some Linux distributions are shipped with package management utilities (such as apt-get and yum) which allows us to script the installation of the development environment required components.

Why Ubuntu?

First of all, this choice is based on personal preference. If you find an OS that suits for your organization go ahead and use it. With that being said, there are some rational choices for why one should Ubuntu as their development workstation OS.

The latest version of Ubuntu is shipped with a fully configured Python 2.7.2 which is the latest and the last 2.x Python version on which most of the modern Python code is currently targeted on.

You may think it is not much but what I learned from my experiment with CentOS is that it is depended on Python 2.4.

Python 2.4 is a very old version of python and most modern Python programs and libraries won't be targeting it at all.

The consequences are that switching the active Python version using pythonbrew system-wide may temporarily or permanently hurt the system's functionality. I haven't tried it though. I will check it out and let you guys know.

Ubuntu is also very easy to learn Linux with for those who aren't haven't used a Linux based OS yet.

Ubuntu has enterprise support which is important for companies who need to resolve issues quickly and can't afford to waste time that otherwise would be spent on adding value.

Why Not Windows?

Multiple Python installations are harder to manage using a Windows operating system since pythonbrew is not available. I have yet to see an alternative solution.

Compiling C extensions is far from trivial since Windows does not provide a C compiler by default and the C extensions must be compiled with the same compiler that Python was compiled on. Currently the Python installer distribution is compiled with MSVC 2008. Alternatively you can use MinGW but that is far from trivial. The implications are that if you are only working with a newer version of MSVC you may need to compile the Python sources yourself which is again far from trivial.

I've had issues with x64 Python installations where C extensions compilation is not even possible since the compiler only ships with x86 version (See above for the same compiler note).

Fabric's dependencies uses C extensions. As a result to the above, installing fabric is not trivial and sometimes not possible. Fabric is very important when automating the development process since (and I'm quoting) "it provides basic suite of operations for executing local or remote shellcommands (normally or via 'sudo') and uploading/downloading files, as well asauxiliary functionality such as prompting the running user for input, oraborting execution.".

virtualenvwrapper is based on shell scripts and although there is a port to PowerShell it is not compatible and I've had little experience with it so I can't say I recommend it. Another option is to use virtualenvwrapper with MSYS but I haven't tested how well it works with MSYS.

As mentioned before, other Python essentials are written exclusively for Linux.

Costs money.

Installing The Operating System

If your IT department has chosen to work with virtualization and you are working with VirtualBox you can get images for most Linux based OSes.

If your IT department are using VMWere, there are images you can use for some Linux based OSes as well.

Your mileage may vary.

If you listened to my advice and you chose Ubuntu, there is an automatic installer that can install itself on multiple computers. Ubuntu has only preliminary support and the automatic installer has some limitations and features that are not supported yet.

Again, your mileage may vary.

From now and on I assume you are have chosen to work with Ubuntu 11.10.

Images vs. Automatic Installers

Images are a "one size fits all" solution. If all 99% of your development workstations will be exactly the same, use an image because you can just deploy it and boot the system.

Further customization can be applied using boot scripts that will remove themselves after the first run but again, they script will be the same..

As mentioned, with Linux deploying images is by far more trivial. While incompatible hardware will often result in a crash on Windows won't crash Linux at all. All you need is that the operating system in the disc image will be the same as the deployment target's architecture and the disk image must contain all possible .

Automatic Installers are by far much more configurable and customizable but setting them up the first time can be quite consuming. If some of your development workstations will be different use an automatic installer.

Even if you are not planning to use an automatic installer currently due to the lack of time or resources, do take the time to learn what the different methods are and how to performthem.

Next time we will cover the scripting of the operating system installation.