No Huddle Offense

"Individual commitment to a group effort-that is what makes a team work, a company work, a society work, a civilization work."

Hudson and Python

September 23rd, 2010 • 3 Comments

Regarding Continuous Integration (CI) systems I probably still like Hudson! Great tool and runs perfectly well. Just get the latest jar file and run it with java – jar hudson.jar. Now to get started you will need to install some plugins:

You can install those plugins in he management interface of hudson. When configuring the job in hudson you simple add a new “Build a free-style software project” job. Add SCM information – and than add some build steps. I had to use two:

python setup.py clean --all
python setup.py build
coverage erase
nosetests --with-coverage --cover-package=<your packages> --with-xunit
coverage xml

And a second one:

#!/bin/bash
pylint -f parseable <your packages> > pylint.txt
echo "pylint complete"

Both are external scripts. Now in the post-build section activate the JUnit test reporting and tell it to use the **/nosetests.xml file. Also activate the Cobertura Coverage report and tell it to use **/coverage.xml. Finally activate the Report Violations – and add pylint.txt in the right row.

Configure the rest of the stuff just as you like and hit the Build button. Thanks to XML the reporting tools written for java can parser the output generated for your Python project. Now you have nice reports from a Python project in Hudson!

A more detailed and great article about this topic can be found here.

3 responses to “Hudson and Python”

  1. Kamil Kisiel says:

    Why do you need to use two build steps? In my Hudson setup I just put all the commands in to one script that runs as a single build step.

    By convention we just call the script “hudson.sh” and keep it in source control along with the project. Handy to track as the build changes, and less work when setting up builds for branches etc.

  2. admin says:

    pylint would not complete otherwise 🙂 Do you have pylint in you setup? I probably will refactor that stuff as well and create a hudson script.

  3. […] & Builds – Probably because I have some Sun Microsystems background I like hudson – It runs as a service on my machine in the background and is bound to my local branch of my […]