tools

Visual Studio and Python

While Idle is good enough to get you started with Python, if you are going beyond the basic scripting having a full IDE is more productive. There are lots of IDE’s available that support Python and it can often be a matter of personal taste but an old timer, Visual Studio, has recently become Python friendly.

While there has been a cut down version of Visual Studio packaged with the express versions for some time, Microsoft released a Community edition starting with Visual Studio 2013. This is the fully professional version aimed at open source projects, academic research, training, education and small professional teams. There is now a Visual Studio 2015 Community edition available for those wanting the latest and greatest.

The Python Tools for VS (v2.1 for 2013 and v2.2 for 2015) have also matured to the point where Python finally feels like a first class citizen in VS. This gives you code complete, ability to select the version of Python to run against (if you have more than one version of Python installed) and all the other features you expect from VS.

Python Tools installs direct from within VS with 2015 so no more hunting around the web for the right version. It comes with some templates to get you up and running (for Bottle, Django and Flask) and also support ironPython.

Where VS really comes into its own is when you are writing in more than one language. I only stumbled across the community edition because I was doing web work. VS supports JavaScript natively and can markup HTML and CSS. Then let you see the results in the browser of your choice using the internal web server in VS. Put all this together and you can write and debug the back end server in Python, modules in C and the client side in HTML, CSS and JavaScript all from with Visual Studio. The code complete alone should justify the hour to two spent learning to use VS.

If you are compiling C modules for Python, note that Python 3.5 was built with Visual Studio 2015, so the community edition gives you everything you need to compile to to embed Python in your C/C++ programs.

For those who are signed up to the Microsoft Virtual Academy, look of for a Python and Django jump start course. Also you can download from Microsoft a Windows 10 VM pre-installed with all the Visual Studio and related SDKs.

Setting up Buildbot

Buildbot is a  continuous integration / delivery server along the same lines as Jenkins / Hudson and Teamcity but without some of the polish of the other servers. It’s advantage is it written in Python and can be easily extended to more complex environments.

The problem with Buildbot is its dependencies as it compiles some of the sources; just running pip install will often fail. First you need to make sure the gcc development tools and associated software is installed on the server.

On the Red Hat family (CentOs, Amazon Linux) this can be achieved with the following commands

sudo yum group install "Development Tools"
sudo yum install python-devel

On the Debian family (Ubuntu) you can use the following

sudo apt-get install build-essential

The proceed to install the buildbot with pip

pip install buildbot

Once installed you need to set up a working directory and start buildbot

mkdir -p /tmp/buildbot
cd /tmp/buildbot
buildbot create-master
cp master.cfg.sample master.cfg
buildbot start

You should now be able to access the website on http://localhost:8010/ – you may need to configure the firewall to allow access from other machines.

Despite the suffix, master.cfg is just a python file that controls the build process. A fairly good overview of this file and the whole Buildbot philosophy can be found in this short tutorial.