Saturday, May 31, 2008

buildout tutorial. buildout howto. buildout review.

This post is a review, a tutorial, and a howto - for and about buildout - a software development tool for the python language.

This document aims to answer the question... "buildout? WTF?".

In short: buildout automates python project building. Buildout does everything needed to get your application in a state for running in its own sandbox.

Super quick start instructions for using buildout...

  • get the source from
  • Make a new directory for your project, then copy the bootstrap/ file out of the zc.buildout source into your new project directory
  • create a "buildout.cfg" file to go with the file. Here is a simple one for your package called "YOURPACKAGENAME":
  • [buildout]
    parts = test py
    develop = .

    recipe = zc.recipe.testrunner
  • Run "python" in your empty project directory(with the buildout.cfg file in there).  This will get buildout locally into your sandbox ready to use - without touching the rest of your python installation.
  • Now you have a basic setup for "building out" your application.

  • What is buildout?

    "The Buildout project provides support for creating applications, especially Python applications. It provides tools for assembling applications from multiple parts, Python or otherwise. An application may actually contain multiple programs, processes, and configuration settings."

    Why should I care about buildout?

    Automation of building your applications is what buildout is about.

    To be able to build your application easily on multiple machines, you don't want to have to install and setup 38 different programs before you can build it.

    Buildout keeps your project separate from the main python setup.  So it doesn't install things into the main python distribution.  This is good because it keeps separate applications mucking each other up.  It's also good so you don't need to have a root user account to install python modules.

    Buildout can be extended through the use of recipes.  Recipes are like plugins, and they do all sorts of things.  You can see a list of buildout recipes on the python package index (pypi).

    buildout can do lots of other things too - but these are the core concepts.

    Where is buildout? Links to buildout pages.

  • The buildout url:
  • A buildout tutorial which seems better than the official documentation - but hard to find with search engines. It's written as a tutorial to give to people - not really to read online.
  • Plone buildout tutorial. - this one is specific to plone.
  • subversion repository for zc.buildout:
  • Licence: The Zope Public License

  • buildout recipes on pypi

  • Disadvantages to buildout?

    You become dependant on a few things. At least with buildout you become dependant on:
  • zc.buildout
  • setuptools
  • website remaining up... it is fairly often down.
  • distutils - buildout requires a file.

  • Who uses buildout? How stable is it? How portable is it?

    At the moment buildout is mostly used by zope, and other python web applications.

    It's a fairly recent project - first released mid 2006. However it's a 3rd generation buildout system used by the zope corporation - so it's got a bunch of wisdom behind it.

    Buildout seems to be stabilising... that is the amount of changes to it seems to be slowing down. There seems to be about 37 bugs in the buildout bug tracker as of writing(2008-05-01) - with 3 of the bugs marked fixed (at 2008-05-31 and still only 3 of the bugs marked fixed) - and a number of bugs under discussion.

    Documentation isn't the best (which is one reason I'm writing this post) - but there is at least a main manual, and a tutorial.

    There do seem to be quite a few doctest based tests that come with it - which is one form of documentation in itself - but more documentation about zc.buildout - rather than documentation for using zc.buildout. There is about 1400 lines of python in the tests, and about 3000 lines of non-python code in the doctests (usually description about what the tests are doing).

    I'm not sure how portable buildout is. The last release (as of writing 1.0.1 (2008-04-02)), mentions windows fixes, and was the last release for 3 months. I know of people using it on linux(suse, debian), and mac osx based machines.  Update: a note in the comments says it works fine on windows.


    ajung said...

    Buildout is running on all OSes
    including Windows.

    philikon said...

    Actually, you'll never have to easy_install zc.buildout at all. That's what is for: it will download and set up zc.buildout locally in your sandbox. That way the global Python installation is never tainted. So what we usually do in Zope is we simply include a buildout.cfg and a in our sandboxes.

    *If* you easy_install zc.buildout anyway, then you don't need Because then you have the 'buildout' executable available and can simply do 'buildout bootstrap'.

    Btw, PyPI has a listing of available buildout recipes (the things that buildout calls to actually do the work): Some are more generic than others...

    Chui Tey said...

    The new is here: