Packaging in Zamboni

There are two ways of getting packages for zamboni. The first is to install everything using pip. We have our packages separated into three files:

requirements/compiled.txt
All packages that require (or go faster with) compilation. These can’t be distributed cross-platform, so they need to be installed through your system’s package manager or pip.
requirements/prod.txt
The minimal set of packages you need to run zamboni in production. You also need to get requirements/compiled.txt.
requirements/dev.txt
All the packages needed for running tests and development servers. This automatically includes requirements/prod.txt.

Installing through pip

You can get a development environment with

pip install --no-deps -r requirements/dev.txt

Adding new packages

Note: this is deprecated, all packages should be added in requirements.

The vendor repo was seeded with

pip install --no-install --build=vendor/packages --src=vendor/src -I -r requirements/dev.txt

Then I added everything in /packages and set up submodules in /src (see below). We’ll be keeping this up to date through Hudson, but if you add new packages you should seed them yourself.

If we wanted to add a new dependency called cheeseballs to zamboni, you would add it to requirements/prod.txt or requirements/dev.txt and then do

pip install --no-install --build=vendor/packages --src=vendor/src -I cheeseballs

Then you need to update vendor/zamboni.pth. Python uses .pth files to dynamically add directories to sys.path (docs).

I created zamboni.pth with this:

find packages src -type d -depth 1 > zamboni.pth

html5lib and selenium are troublesome, so they need to be sourced with packages/html5lib/src and packages/selenium/src. Hopefully you won’t hit any snags like that.

Adding submodules

Note: this is deprecated, all packages should be added in requirements.

for f in src/*
    pushd $f >/dev/null && REPO=$(git config remote.origin.url) && popd > /dev/null && git submodule add $REPO $f

Holy readability batman!