[Distutils] PEP440 Version Specifier Syntax

Nick Coghlan ncoghlan at gmail.com
Tue May 20 01:15:20 CEST 2014


On 19 May 2014 23:44, "Donald Stufft" <donald at stufft.io> wrote:
>
> Currently PEP440 has a version specifier syntax like
> ``foo (2,~=2,==2,!=2,>=2,<=2,>2,<2)``. This is a hold over from PEP 345 of
> which I cannot locate a rationale for this change.

It's at least in part to reduce ambiguity when listing multiple
dependencies as a list, rather than as line separated:

foo(~=2,!=2.3.x), bar(~=3,!=3.5.4.x)

That's why my initial reaction to the various aspects of the proposal was:

+1 to dropping the default comparison operator now we have "~=" as an
explicit spelling
+1 for dropping the space between the package name and the opening
parenthesis (to be honest, I thought it was already at least optional , but
the PEP may not make that clear)
+0 for making the parentheses optional when only using a single comparison
operator
-0.5 for making the parentheses optional when using multiple comparison
operators

On reflection, however, I'm switching back to "-1" for the latter two
points. That's a UI issue for user facing formats that has no place in the
data interchange specification. By contrast, the space is entirely
redundant given the parentheses, so it makes sense to me to drop it from
the interchange format. Allowing users to optionally include whitespace in
version specifiers then joins the ability to omit the parentheses as a
tooling UI decision that doesn't apply to the interchange standards.

Remember, the metadata PEPs are about specifying the *normalised* forms
that are exchanged between automated tools. User facing tools are free to
be more liberal in what they accept and handle the normalisation on their
users' behalf.

Cheers,
Nick.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20140520/d294b632/attachment.html>


More information about the Distutils-SIG mailing list