[Distutils] unparseable sdist filenames

PJ Eby pje at telecommunity.com
Tue Oct 1 02:15:00 CEST 2013

On Mon, Sep 30, 2013 at 6:06 PM, Marcus Smith <qwcode at gmail.com> wrote:
>> > how will context decide between the version being "dev" or "xdist-dev"?
>> By whether you asked to install "pytest-xdist" or "pytest", and by
>> whether "dev" or "xdist-dev" match your version requirements.  In
>> practice this tends to only be a problem if you are:
>> 1. Installing the two packages during the same run, and
>> 2. Aren't using version specifiers.
> #2 is a big deal.  the pip issue (#1192) that motivated this was a #2. local
> find-links with non-versioned requirements.

I should probably add a #3 to that list: it's also rarely a problem
because usually there's at least one *numbered* version of the desired
package available, which will always prioritize newer than an
arbitrary alphabetic version like "xdist", even if you haven't
requested a specific version.

IOW, you need to not only not request a version and come across the
other package in the same run, but you *also* need for there not to be
any valid versions of your intended target present.

> so, suppose you have "pytest-xdist-dev.tar.gz" in a find-links location.
> whether you're trying to install "pytest" or "pytest-xdist" doesn't help the
> installer determine how to parse that archive.

In easy_install's case, it will take the one with the highest version
number, which means it'll try to install pytest-xdist-dev.tar.gz, on
the theory that 'xdist-dev' is a newer version than 'dev'.  This is
kind of silly, but it was the Simplest Possible Thing That Could Work,
and I figured I'd change it when there was enough feedback/field
experience to decide what to change it to.  ;-)

Probably the "right" thing to do would be to warn or decline on
ambiguous filenames in the future, since it is quite possible to
detect if a filename has more than one possible interpretation.
Another possibility would be to treat them analagously to
stable/unstable versions, prioritize them below regular matches, etc.

More information about the Distutils-SIG mailing list