Personal tools
You are here: Home Documentation Tutorials Introduction to zc.buildout zope.event example

zope.event example

Example buildout file for working on the zope.event egg
Jim Fulton's tutorial for using buildout, originally given at DZUG 2007
Page 5 of 17.

zope.event project files

  • source in src directory

    handout

    Placing source in a separate src directory is a common convention. It violates "shallow is better than nested". Smaller projects may benefit from putting sources in the root directory,

  • setup.py for defining egg

    handout

    Assuming that the project will eventually produce an egg, we have a setup file for the project. As we'll see later, this can be very minimal to start.

  • README.txt

    handout

    It is conventional to put a README.txt in the root of the project. distutils used to complain if this wasn't available.

  • bootstrap.py for bootstrapping buildout

    handout

    The bootstrap script makes it easy to install the buildout software. We'll see another way to do this later.

  • buildout.cfg defines the buildout

zope.event buildout.cfg

[buildout]
parts = test
develop = .

[test]
recipe = zc.recipe.testrunner
eggs = zope.event
handout

Let's go through this line by line.

[buildout]

defines the buildout section. It is the only required section in the configuration file. It is options in this section that may cause other sections to be used.

parts = test

Every buildout is required to specify a list of parts, although the parts list is allowed to be empty. The parts list specifies what to build. If any of the parts listed depend on other parts, then the other parts will be built too.

develop = .

The develop option is used to specify one or more directories from which to create develop eggs. Here we specify the current directory. Each of these directories must have a setup file.

[test]

The test section is used to define our test part.

recipe = zc.recipe.testrunner

Every part definition is required to specify a recipe. The recipe contains the Python code with the logic to install the part. A recipe specification is a distribution requirement. The requirement may be followed by an colon and a recipe name. Recipe eggs can contain multiple recipes and can also define an default recipe.

The zc.recipe.testrunner egg defines a default recipe that creates a test runner using the zope.testing.testrunner framework.

eggs = zope.event

The zc.recipe.testrunnner recipe has an eggs option for specifying which eggs should be tested. The generated test script will load these eggs along with their dependencies.

For more information on the zc.recipe.testrunner recipe, see http://www.python.org/pypi/zc.recipe.testrunner.