[Distutils] Distribution downloads by pip (and multiple distribution types)
fuzzyman at gmail.com
Wed Jul 14 13:50:43 CEST 2010
For unittest2 I now have three different distributions. A "version" that
supports Python 2.4 - 2.7, one for Python 2.3 that is developed in a
separate branch because it makes the code ugly, and a separate distribution
for Python 3.
The reason I'm not using 2to3 with a single codebase is that unittest2 for
Python 3 is *basically* just a straight copy of the unittest package from
Python 3.2 (with a few fixes to work in 3.0 and a few other changes that are
in unittest2 anyway). Having a single distribution with multiple versions in
and having setup.py decide at install time would be another approach, but
that plays badly with test discovery.
So the challenge is, how do I put all of these up on PyPI and have pip
install the right one?
pip doesn't make it clear what versions of Python it supports, and the PyPI
page doesn't use the trove classifiers (naughty!), but I'm fine with users
of the Python 2.3 distribution having to download and install manually.
Unfortunately it *seems* that "pip install unittest2" (on Python 2.4 - 2.7)
will just install from whichever file was *most recently uploaded* to the
PyPI page - even if it is marked as not a source distribution and has Python
2.3 in the name. So, the good news is that if you've used pip to install
unittest2 in the last few days you've got the Python 2.3 version. It is
feature complete with tests, so that shouldn't actually be a problem.
As far as I can tell the only way I can solve this is to remove the Python
2.3 download from PyPI and host it separately, which is what I've now done.
(Download link on the PyPI page if you need it.)
Similarly I guess there is no way to have a Python 3 distribution under the
same project and have pip install the correct distribution under the correct
version of Python.
To get round this I have created a separate project: unittest2py3k. It still
installs the same *package name*, just has a different project name.
Now if distutils2 could solve these problems, that would be great. :-) I'm
aware that setuptools / distribute allows you to provide (what are
effectively binary) distributions for specific Python versions, but I need
to support pip too.
It would also be great if there was a way of specifying "this distribution
is for Python 2.4 - 2.7", or even "any version of Python 2 after 2.4".
All the best,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Distutils-SIG