views:

103

answers:

2

I would like to release a python module I wrote which depends on several packages. What's the easiest way to make it so these packages are programmatically downloaded just in case they are not available on the system that's being run? Most of these modules should be available by easy_install or pip or something like that. I simply want to avoid having the user install each module separately.

thanks.

+1  A: 

See the setuptools docs on how to declare your dependencies -- this will allow easy_install to find, download and install all of them (and transitive closure thereof) if everything's available in PyPi, or otherwise if you specify the dependencies' URLs.

Alex Martelli
What do you think about pip? The pip comparisons to setuptools seem very strongly worded... is there really a consensus in the Python community that pip is better?
Also, can pip handle non-PyPi dependencies like setuptools can?
@user, unfortunately I don't have much direct experience with pip, but my impression is that it can do what `easy_install` can, and more. As http://www.b-list.org/weblog/2008/dec/15/pip/ says, "pip does not change your packaging workflow in any way. You just make your package the way you’ve always made it, and then put it up on the Web somewhere (preferably listing it in the Python package index, but you don’t have to if you don’t want to) and people using pip can grab it and install it.".
Alex Martelli
+2  A: 

pip uses requirements files, which have a very straightforward format.

use distribute and pip distribute and pip are the new hotness

gotgenes
+1 for propaganda. What is the source for the first picture?
J.F. Sebastian
@J.F. I would guess Idan Gazit is responsible for the first image; I'm not sure who's responsible for the second. Both are hosted on Amazon S3; the image locations point to their S3 locations, so you can just copy the image locations and use those here and elsewhere. I saw the "Python Comrades" one at Titus Brown's PyCon 2010 talk; the "New Hotness" has been around for maybe a year now. Perhaps some sleuthing on the Python mailing lists can turn up the original source(s).
gotgenes