[Distutils] unparseable sdist filenames

Paul Moore p.f.moore at gmail.com
Mon Sep 30 20:23:18 CEST 2013


On 30 September 2013 18:55, Marcus Smith <qwcode at gmail.com> wrote:
> so, take a case like so  "pytest-xdist-dev.tar.gz" (or any sdist with "-" in
> the project name, and a version starting with a string)
>
> I think it's like so:
> - pkg_resources.Distribution.from_location will treat "xdist-dev" as the
> version.
> - distlib.util.split_filename won't parse it because versions have to start
> with [0-9].
> - pip will accept this as a "pytest" archive and install it potentially if
> no other version matches greater.
>
> what's the right answer?
>
> The historical-compatible answer is to be confused when projects have "-".
> so stay confused? or get rigid like distlib?

tl;dr Let's have a strict standard and then tools should go for the
usual "be lenient in what you accept, but strict in what you produce"
principle.

To expand on that, IMO, we should specify in one of the metadata-type
PEPs a set of precise, parseable rules (I avoid the word "rigid" here
because of the negative connotations, but that's what I mean).
Projects that need to may or may not change to conform to the spec, so
there may still be cases where tools have to be confused for backward
compatibility reasons, but at least we then make those cases into
clearly expressed "undefined behaviour" cases.

Whether tools converge on a common understanding for those cases, or
remain confused as now, is less of an issue to me, as the clear
message is that the project has a means to get consistent behaviour by
changing to match the standard, and if they choose not to they can
accept the consequences with no worse impact than we currently have.

But I'd also agree with Donald that stats on the scale of the problem
would help to better inform a decision here.

Paul.


More information about the Distutils-SIG mailing list