Using setuptools
David Wolever
wolever at cs.toronto.edu
Wed Jun 25 08:09:53 PDT 2008
On 25-Jun-08, at 11:34 AM, Ivan Glushkov wrote:
> Hello, David.
>
> I've tried to use setuptools on my machine at work and it fails:
>
> $ python setup.py install
> Traceback (most recent call last):
> File "setup.py", line 3, in ?
> from setuptools import setup, find_packages
> ImportError: No module named setuptools
>
> I suppose the same situation might take place anywhere else, so i
> propose not to use this module.
> And thanks for the refactoring of our setup.py script! :)
D'oh! I'd forgotten about that.
The generally accepted solution to this (used by, eg, SQLAlchemy) is
to keep a copy of ez_setup.py (the script which installs setuptools
-- available here: peak.telecommunity.com/dist/ez_setup.py) along
with their distribution, then adding this onto the top of setup.py
(before the setuptools import):
from ez_setup import use_setuptools
use_setuptools()
That will download and install setuptools if it is required.
There are two reasons I'd prefer using setuptools:
0) `setup.py develop` is _incredibly_ useful
1) To get on the PyPi (http://pypi.python.org/pypi), so DT can be
installed with easy_install and listed in a package's dependencies
(so, for example, when someone runs `setup.py develop`, DT gets
installed automatically, making it that much easier to access the
project's issue database).
Now, after a little reading, it looks like packages which use
distutils can be submitted too (http://wiki.python.org/moin/
CheeseShopTutorial), so reason #1 is out...
And if the general feeling is that adding the ez_setup script to take
care of the dependency is too much work, I'll pipe down and just use
setuptools locally.
(but, if that's the case, could someone at least document how to
develop on DT?)
More information about the Dev
mailing list