[Distutils] Differences in PEP386 and setuptools

Donald Stufft donald.stufft at gmail.com
Wed Sep 26 21:09:19 CEST 2012


I've been comparing how PEP386/distutils2.version treats versions
and how pkg_resources from setuptools treats versions and it
confirmed a worry of me with the way that dev is treated in PEP386.

In PEP386 you have several kinds of "top level" releases, these 
are alpha, beta, candidate, and final and they are sorted as you
would expect. On top of that it has pre and post releases for
any of those top level releases. The pre releases are tagged
with a ".dev" and post releases are tagged with a ".post". They
are sorted immediately before/after the "main" release that they
are pre/post for.

In pkg_resources dev is treated as it's own "main" release and
sorts it in front of an alpha.

This means that given the versions:

    ["0.1.dev1", "0.1a1", "0.1b1", "0.1c1", "0.1"]

PEP386 will sort them as:
    
    ["0.1a1", "0.1b1", "0.1c1", "0.1.dev1", "0.1"]

and pkg_resources will sort them as:

    ["0.1.dev1", "0.1a1", "0.1b1", "0.1c1", "0.1"]


To further complicate things the most common usage I've personally seen
in the wild is that of "0.1dev" or "0.1dev1" which the author expects to sort
before an alpha (In this case distutils2.version throws an error, but the suggest
function is able to turn it into 0.1.dev1).

I think this difference is going to cause confusion, especially during the the
transition period when you're going to have people using both pkg_resources
and the new PEP386 functions.

Since PEP386 is only in the "Accepted" stage, and isn't part of the official
implementation yet, is it at all possible to revise it? Ideally I think to follow
with the prior art, and people's expectations "dev" should be moved to a "main"
release type sorted before an alpha, and to take it's place as a pre release modifier
perhaps something like "pre" can be used instead (e.g. "0.1.pre1").

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20120926/698356df/attachment.html>


More information about the Distutils-SIG mailing list