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 http://pypi.python.org/pypi/zc.buildout
  • Make a new directory for your project, then copy the bootstrap/bootstrap.py file out of the zc.buildout source into your new project directory
  • create a "buildout.cfg" file to go with the bootstrap.py file. Here is a simple one for your package called "YOURPACKAGENAME":
  • [buildout]
    parts = test py
    develop = .

    [test]
    recipe = zc.recipe.testrunner
    eggs = YOURPACKAGENAME
  • Run "python bootstrap.py" 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: http://pypi.python.org/pypi/zc.buildout
  • 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: http://svn.zope.org/zc.buildout/
  • Licence: The Zope Public License
  • http://www.ohloh.net/projects/compare?project_0=zc.buildout

  • 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
  • pypi.python.org website remaining up... it is fairly often down.
  • distutils - buildout requires a setup.py 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.

    Thursday, May 29, 2008

    gsoc2008 and pygame...

    The Google Summer of Code(gsoc) has started, and students have officially begun their work this week.

    Already design, and code are starting to appear from them.

    Here are the pygame related projects, and their blogs:

    Zhang Fan, "minz", blog:
    physics stuff

    Zhang Fan went through the earth quake in China, but luckily him and his family are ok. Zhang has been studying various physics libraries, algorithms and code. As well he has begun work in a separate branch. So hopefully his work will then be merged in at a later time after his project. You can view his branch here:
    physics branch


    Nicholas Dudfield, "akalias", blog:
    tests for pygame

    Nicholas's test work is going into the pygame trunk, and he has been working on some tools to help generate most of the test bodies. So this way we will be able to see the number of tests needed to implement. As well he began to write some tests for some parts of pygame that need more tests for the pygame 1.8.1 release(coming soon).

    Nirav Patel, "nrp", blog:
    computer vision stuff (through the OLPC project, not mentored through pygame)

    Nirav has been working in his local git repository since he doesn't always have internet access where he is. He's proposed some ideas for how his camera access API would work on the mailing list, and discussion has begun there. He plans to upload his work onto the internet when he has access for people to look at.

    SDL gsoc projects


    Also there are SDL related GSOC projects which will help pygame too (pygame uses SDL)...

    Edgar "bobbens" Simo:
    Bobbens is an undergrad in industrial engineering, and will be working on developing a force feedback API.

    Aaron Wishnick:
    Aaron is an undergrad in mathematics, and will be working on audio resampling and pitch shifting.

    Holmes Futrell:
    Holmes is an undergrad in computer science and mathematics, and will be porting SDL to the iPhone.

    Darren Alton:
    Darren is an undergrad in computer science, and will be porting SDL 1.3 to the Nintendo DS, using the hardware capabilities of the DS to showcase the new features in SDL 1.3.
    http://lifning.americankryptonite.net/blag/

    Szymon "Wilku" Wilczek:
    Wilku is an undergrad in computer science, and wants to add support for pressure sensitive devices to the SDL API, specifically using the Wacom tablet as an example.
    http://wilku.ravenlord.ws/doku.php?id=start