Discussion:
Using setuptools
David Wolever
2008-06-23 02:26:33 UTC
Permalink
It turns out that making everything work with setuptools is very,
very easy.

All it took was moving setup.py.in to setup.py, changing the import
from 'distutils' to 'setuptools', and one or two other little things
(which you can see if you `diff setup.py{,.in}`)

I'm having some trouble getting the patch for this to apply properly,
so I've attached the new setup.py, and these complex instructions:
0) Save setup.py in the ditrack root
1) Remove setup.py.in and make-dist.py

I don't know how familiar you are with setuptools (please ignore this
if you are), but basically there are three important commands:
setup.py install (install the package)
setup.py develop (install the package in develop mode, where all the
system-wide scripts (eg, $PATH/dt-create, $PYTHON_PATH/DITrack) are
small stubs which point to the real scripts in your development
directory)
setup.py sdist (should do exactly the same thing as the make-dist.py)

David
David Wolever
2008-06-25 15:09:53 UTC
Permalink
Hello, David.
$ python setup.py install
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?)
Ivan Glushkov
2008-06-26 12:26:06 UTC
Permalink
Hello.
Post by David Wolever
Hello, David.
$ python setup.py install
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
from ez_setup import use_setuptools
use_setuptools()
That will download and install setuptools if it is required.
I've read requirements of ez_setup.py:
"You will need at least Python 2.3.5, or if you are on a 64-bit
platform, Python 2.4.".
ditrack requires Python 2.3, so we should either set the minimal
version of Python to 2.4 (see our discussion about this in
http://lists.ditrack.org/pipermail/dev/2007-April/000210.html) or
don't use setuptools.
I suppose we should require Python 2.4, it seems to me that now it's
hard to find computers to such old version as 2.3. Though, i might be
wrong.
And by the way, rejection of requirement of python 2.3 will even
simplify our code (see DITrack/ThirdParty/Python/string.py).
Post by David Wolever
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).
We're already on the PyPi:
http://pypi.python.org/pypi/DITrack/0.7

And please, explain once more about "setup.py develop".
I've found some information about it on
http://peak.telecommunity.com/DevCenter/EasyInstall
Have you said about it? Or not?
Post by David Wolever
(but, if that's the case, could someone at least document how to develop on
DT?)
Vlad? :)

Ivan.
David Wolever
2008-06-26 13:42:01 UTC
Permalink
Post by Ivan Glushkov
"You will need at least Python 2.3.5, or if you are on a 64-bit
platform, Python 2.4.".
ditrack requires Python 2.3, so we should either set the minimal
version of Python to 2.4 (see our discussion about this in
http://lists.ditrack.org/pipermail/dev/2007-April/000210.html) or
don't use setuptools.
I suppose we should require Python 2.4, it seems to me that now it's
hard to find computers to such old version as 2.3. Though, i might be
wrong.
And by the way, rejection of requirement of python 2.3 will even
simplify our code (see DITrack/ThirdParty/Python/string.py).
The only thing I can think of that has Python 2.3 these days is Mac
OS 10.4 comes pre-loaded with it... But it's really easy to get 2.5,
and I would be willing to bet that _most_ developers who are using
OSX already have 2.5 because fewer and fewer things support 2.3 these
days.
Post by Ivan Glushkov
Post by David Wolever
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).
http://pypi.python.org/pypi/DITrack/0.7
D'oh!
Well, thanks for putting up with my ignorance.
I'd tried to `easy_install DITrack` in the past, which is what I was
basing my assertion on... I guess I must have fat fingered it or
something.
Post by Ivan Glushkov
And please, explain once more about "setup.py develop".
I've found some information about it on
http://peak.telecommunity.com/DevCenter/EasyInstall
Have you said about it? Or not?
Basically `setup.py develop` installs installs the package, but
instead of putting in the real scripts/egg, it creates skeleton
scripts that are links to the real ones in the development
environment. For example:
[***@wuntop] /tmp cat `which dt`
#!/Library/Frameworks/Python.framework/Versions/2.5/Resources/
Python.app/Contents/MacOS/Python
# EASY-INSTALL-DEV-SCRIPT: 'DITrack==0.9-alpha','dt'
__requires__ = 'DITrack==0.9-alpha'
from pkg_resources import require; require('DITrack==0.9-alpha')
del require
__file__ = '/Users/wolever/code/software/ditrack/dt'
execfile(__file__)
And the egg in $PYTHONPATH looks similar.

Basically, it means you don't need to fiddle with $PATH or `ln -s`
while you're working on a package.
Post by Ivan Glushkov
Post by David Wolever
(but, if that's the case, could someone at least document how to develop on
DT?)
Vlad? :)
Vlad Skvortsov
2008-07-05 21:16:51 UTC
Permalink
Ivan Glushkov wrote:

[skipped]
Post by Ivan Glushkov
"You will need at least Python 2.3.5, or if you are on a 64-bit
platform, Python 2.4.".
ditrack requires Python 2.3, so we should either set the minimal
version of Python to 2.4 (see our discussion about this in
http://lists.ditrack.org/pipermail/dev/2007-April/000210.html) or
don't use setuptools.
I suppose we should require Python 2.4, it seems to me that now it's
hard to find computers to such old version as 2.3. Though, i might be
wrong.
My Mac has 2.3 and I'm not planning to upgrade any time soon. Well, I
could do that, but I think the cost doesn't justify the benefits in this
particular case.
Post by Ivan Glushkov
And by the way, rejection of requirement of python 2.3 will even
simplify our code (see DITrack/ThirdParty/Python/string.py).
Yes, but at the cost of additional hassle for our users.


[skipped]
Post by Ivan Glushkov
Post by David Wolever
(but, if that's the case, could someone at least document how to develop on
DT?)
Hmm, I guess it depends on personal habits, but I personally never
install DITrack package on my development boxes. I either create an
alias or just directly specify the source tree directory when invoking 'dt'.

Just to understand better, what difficulties does the current state of
things pose to you, David?
--
Vlad Skvortsov, vss-***@public.gmane.org, http://vss.73rus.com
David Wolever
2008-07-06 02:44:45 UTC
Permalink
Post by Vlad Skvortsov
[skipped]
Post by Ivan Glushkov
"You will need at least Python 2.3.5, or if you are on a 64-bit
platform, Python 2.4.".
ditrack requires Python 2.3, so we should either set the minimal
version of Python to 2.4 (see our discussion about this in
http://lists.ditrack.org/pipermail/dev/2007-April/000210.html) or
don't use setuptools.
I suppose we should require Python 2.4, it seems to me that now it's
hard to find computers to such old version as 2.3. Though, i might be
wrong.
My Mac has 2.3 and I'm not planning to upgrade any time soon. Well,
I could do that, but I think the cost doesn't justify the benefits
in this particular case.
The Python2.3 on my mac is 2.3.5 -- so sufficient for setuptools (and
probably why they are still supporting it).
Post by Vlad Skvortsov
Just to understand better, what difficulties does the current state
of things pose to you, David?
Basically, it makes it hard for me to "get tinkering" with dt.
I'd like it to be as simple as possible for someone to grab the SVN
source and start poking around, fixing bugs, adding features, what
have you.

I think life could be made better having a `setup.py develop`, but
since there may be disadvantages to that, a couple of lines in the
README saying "run `ln -s ...` to start developing" could make life
better too.

(mmm yes, life would have been a lot better if I'd just said that to
begin with... I appreciate the patience :) )
Vlad Skvortsov
2008-07-18 03:22:00 UTC
Permalink
David Wolever wrote:


[skipped]
Post by David Wolever
Post by Vlad Skvortsov
Just to understand better, what difficulties does the current state
of things pose to you, David?
Basically, it makes it hard for me to "get tinkering" with dt.
I'd like it to be as simple as possible for someone to grab the SVN
source and start poking around, fixing bugs, adding features, what
have you.
I think life could be made better having a `setup.py develop`, but
since there may be disadvantages to that, a couple of lines in the
README saying "run `ln -s ...` to start developing" could make life
better too.
(mmm yes, life would have been a lot better if I'd just said that to
begin with... I appreciate the patience :) )
Hmm, I'm still not getting it. :-) Why can't you just check out the
source and work from that working copy? Why do you need the package to
be installed?
--
Vlad Skvortsov, vss-***@public.gmane.org, http://vss.73rus.com
Ivan Glushkov
2008-06-25 14:34:49 UTC
Permalink
It turns out that making everything work with setuptools is very, very easy.
All it took was moving setup.py.in to setup.py, changing the import from
'distutils' to 'setuptools', and one or two other little things (which you
can see if you `diff setup.py{,.in}`)
I'm having some trouble getting the patch for this to apply properly, so
0) Save setup.py in the ditrack root
1) Remove setup.py.in and make-dist.py
I don't know how familiar you are with setuptools (please ignore this if
setup.py install (install the package)
setup.py develop (install the package in develop mode, where all the
system-wide scripts (eg, $PATH/dt-create, $PYTHON_PATH/DITrack) are small
stubs which point to the real scripts in your development directory)
setup.py sdist (should do exactly the same thing as the make-dist.py)
David
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! :)
Loading...