Adding a dependency

From OpenHatch wiki

This is a page about improving or modifying OpenHatch.

We call that "Hacking OpenHatch," and there is a whole category of pages about that.

Using buildout: adding a dependency

  1. Find the Python package name of the dependency. This will appear in the package's own setup.py file (as a parameter called "name" passed to the setup function).
  2. Edit milestone-a/setup.py.
  3. Add the dependency's Python package name to "install_requires". You may optionally include a version number.
  4. If you haven't already, create a tarball of the Python package as follows:
    1. cd to the package's top-level directory, where setup.py is
    2. Run `python setup.py sdist`
    3. This creates a tarball of your Python package in dist/.
  5. Host a tarball of the Python package at some public URL. (This is in order to cache a copy of the package somewhere everyone can reliably reach it.)
  6. (or just ask paulproteus to host it on the http://linode.openatch.org/~paulproteus server.)
  7. Add the tarball URL to the list called "dependency_links" in milestone-a/setup.py, appending the string "#egg=the package name" to the URL.
  8. Add the package name to milestone-a/buildout.cfg under "eggs".
  9. Run bin/buildout


Some things to remember...

  1. If you have problems adding a dependency, you may have a local version which is usually under /usr/local/lib/ --
  2. First make sure you have the dependency name right, unpack the dependency archive (either tar xvf or unzip),
  3. then look for the file setup.py - in there you'll find the name="some_package" - This is the name you should be adding to setup.py and buildout.cfg.
  4. Now, make sure you haven't got it locally, use the mysite shell - $ ./bin/mysite shell, then try importing your dependency.
  5. Remember to jump on #openhatch on freenode if you get stuck.