As I’ve mentioned many times on this blog, I’m a big fan of Google AppEngine. I like the free tier, the effortless scaling, the zero administration, and how I can run Django almost unmodified and deploy in seconds. It has its downsides, but overall I like it very much.
The one part of deployment I didn’t like was dependency handling. Due to the way GAE works, you need to install all packages in the root of your application, or in some other directory by placing the source there. I haven’t been able to find a way to automate this, because pip doesn’t handle this exact workflow (I haven’t tried buildout because it confused me a bit, so I don’t know if it does this), and it was quite a hassle to get all the necessary libraries every time.
To this end, I opened an issue on the pip bug tracker, and a few short hours and some small patches on my part, along with some help from Carl Meyer, pip now supports the “–target” switch.
What the “–target” switch does is download all the packages you specify, either from the command line, a textfile, or other location (as usual with pip) and extract them in the specified directory. So, to download install all your dependencies in a certain directory, all you need to do is:
pip install -t libs shortuuid django-annoying django-debug toolbar
and the three packages will be downloaded and placed in the “libs” directory.
This feature should make it to the next pip release (or you can try it now by downloading the latest head), and I’m very psyched about it. Hopefully there will be no more deployment headaches with GAE, and things will go much smoother. If you have any other way of solving this particular problem, please let me know in the comments!