jeads/datazilla — pull request #19 by carljm (2012-05-18 22:47:33+00:00)
Title: Add vendor library for pure-Python dependencies.

This is a massive pull request because it adds all of our pure-Python dependencies (including e.g. Django) into the `vendor/` directory, as IT requires for deployment. If you don't like having all these in the main repo, we can also make `vendor/` a submodule; we do that in MozTrap, but it definitely complicates the process of updating or adding dependencies, and I'm not sure it's worth it in the end.

This also adds the script `bin/generate-vendor-lib.py` which will remove and recreate the `vendor/` directory based on the pip requirements listed in `requirements/pure.txt`. This would be kind of unsafe (if anything goes wrong, it could blow away `vendor/` entirely), but that's ok in this case because git's got our back, and we should never be making manual changes in `vendor/`. This script should only need to be run if you change the requirements listed in `requirements/pure.txt`.

`requirements/compiled.txt` lists the compiled requirements which IT will install via yum packages; this is basically just documentation for them.

`requirements/dev.txt` contains dependencies that IT doesn't need to care about, that are only useful for development (currently that means py.test and the coverage stuff). We can use `pip install -r requirements/dev.txt` (in addition to installing the compiled deps) to create a development environment.

The last thing needed here is to make the vendor library available on `sys.path`. This is the part where there's no really elegant solution currently available. Basically, every entry point into the codebase needs to import and call the function `datazilla.vendor.add_vendor_lib`, which performs the necessary `sys.path` munging. Currently the entry points which do this are `manage.py` and the two scripts in `datazilla/controller/admin/`. At some point (once I've converted the configuration to be entirely Django settings based and thus the whole codebase is Django-dependent anyway), I think we should convert the two `controller/admin` scripts to be `manage.py` subcommands, which will reduce the number of entry points we have to worry about. The WSGI application entry point, when I add that, will also need to call `datazilla.vendor.add_vendor_lib`.