Palladion Software
user icon Guest

Eggifying Zope

Building on Nathan Yergler's work from PyCon, I have just finished a big pile of eggs for both ZopeX3.0.0 and Zope 3.2.0.

Created by tseaver. Last modified 2006-04-05 19:04:42.

Overview

Part of the work I did was to reverse-engineer at least a minimal changelog for each of the packages (given the ZopeX3.0.0 version as "first release"). Please have a look:

A couple of notes on the process (summarized from my reply to Martijn Faassen earlier today):

Kickstarting a Package

There is some support for "kickstarting" an eggifying project. E.g.:

    $ export ZSVN=svn+ssh://svn.zope.org/repos/main
    $ svn cp -m "Eggify" $ZSVN/productsupport/trunk/project-template \
                         $ZSVN/zope.foopackage

The top-level zope.foopackage will have a skeleton trunk, plus empty branches and 'tags':

    $ svn co $ZSVN/zope.foopackage/trunk zope.foopackage-trunk
    $ cd zope.foopackage-trunk
    $ ls -1
    CHANGES.txt
    develop.py
    INSTALL.txt
    README.txt
    setup.cfg.in
    setup.py
    src
    test.py
    workspace

The text files are templates, and should be edited to fit.

The develop.py script will set up a local bin and lib directory inside your checkout, and try to install dependencies as specified in setup.py and setup.cfg (which it copies from setup.cfg.in). It also jams the Zope egg URL into setup.cfg.

I usually run setup.py develop afterwards, as it is better at finding all the dependencies:

    $ PYTHONPATH=lib /path/to/your/python setup.py develop

The zope.testing package is supposed to be pulled in during that bootstrapping, but often seems missed (I haven't yet figured out why). Running the local easy_install does the trick:

    $ PYTHONPATH=lib /path/to/your/python bin/easy_install \
      zope.testing

The src/zope directory is intended to contain a svn:externals pointer to the "canonical" location of the source (we may eventually reverse this, and make the main Zope tree point out at the top-level package directories). E.g.:

    $ svn propedit svn:externals src/zope
    #... add your external here
    $ svn up
    # ... fetches your external.

That src/zope directory also contains "setuptools / pkgutil" boilerplat namespace __init__.py:

    $ cat src/zope/__init__.py
    # namespace package boilerplate
    try:
        __import__('pkg_resources').declare_namespace(__name__)
    except ImportError, e:
        from pkgutil import extend_path
        __path__ = extend_path(__path__, __name__)

The test.py needs to be edited to point to your package. At that point, you should have all your package's dependencies installed (assuming that you named them in setup.py), and should be able to run the tests using your local eggs:

    $ PYTHONPATH=lib /path/to/your/python test.py

Notes from the Road

Observations I jotted down while running through this process a dozen or so times:

Test Driving It

Give a dependency-driven install of a pile of packages a spin. E.g.:

    $ mkdir aside
    $ PYTHONPATH=aside \
      /path/to/setuptools/enabled/python /path/to/easy_install \
      --install-dir=aside \
      --find-links=http://download.zope.org/distribution/ \
      zope.documenttemplate[untrusted]

That command kicks off an interesting process:

To-Do

  1. Chris McDonough made a start on the ZODB-related packages. Investigate and merge:
    • BTrees
    • persistent
    • transaction
    • ThreadedAsync
    • ZEO
    • ZODB
    • ZConfig
    • zdaemon
  2. Build a meta-package which depends on all the ZODB and related stuff, and supplies the scripts to create storage server instances.
  3. Eggify packages which were not part of zope.app in 3.0.0 / 3.2.0 (avoidg zope.app because detangling the dependencies inside that beast is too painful to think about):
    • docutils (we should be able to use a stock one from the Cheese Shop, I think)
    • zope.cachedescriptors
    • zope.configuration
    • zope.dependencytool
    • zope.hookable
    • zope.importtool
    • zope.modulealias
    • zope.publisher
    • zope.server
  4. Build a meta-package which depends on all that and contains scripts for setting up a minimal Zope3 appserver instance.
  5. Look at packaging zope.app, prefereably using some kind of automated tool (maybe the zpkgegg stuff which Nathan prototyped?)
  6. Play with packaging some of the "extras" not present in those releases:
    • bugtracker
    • zwiki
    • zope.formlib
    • zope.contentprovider

Resources