[Distutils] Comparison semantics for alphanumeric components of a version number
Ben Finney
ben+python at benfinney.id.au
Fri Jun 5 15:41:14 CEST 2009
Tarek Ziadé <ziade.tarek at gmail.com> writes:
> On Fri, Jun 5, 2009 at 2:43 PM, Paul Moore<p.f.moore at gmail.com> wrote:
> > I'd rather the PEP said "This is how version numbers work (simple,
> > non-controversial spec here), and this is the standard API for
> > manipulating them", and then projects that want to conform to the
> > standard migrate if needed.
>
> That's exactly the goal.
If so, that goal is being missed with all the attempts to wedge in
complicated semantics for pre-, post-, “devpost”, and so on. Without
all that special treatment requiring long explanation, the specification
becomes much more simple, and the comparisons obvious:
N.N[.X]+
where ‘N’ is the set [0-9], and ‘X’ is the set [0-9A-Za-z].
>>> from verlib import RationalVersion as V
>>> (V('1.0')
... < V('1.0.a1')
... < V('1.0.a2')
... < V('1.0.a2.1')
... < V('1.0.b2')
... < V('1.0.c1')
... < V('1.0.dev456post623')
... < V('1.0.post456'))
True
Are there many packages out there that don't follow this scheme? Of
course; that's trivially true whatever scheme is picked, which is
precisely the problem being addressed by choosing a simple, obvious
standard.
Choose anything *but* simple alphanumeric comparison for each component,
and you've expressly chosen something less obvious and more complicated
to describe.
To depart from simplicity of specification and obvious semantics, there
has to be something pretty big to gain — big enough to convince the
mass of packages out there that it's worth switching from a home-brew
version scheme to something still complicated and non-obvious. What is
that? I haven't seen it demonstrated, hence this thread.
> Well if the specification is difficult to understand or
> overcomplicated it'll fail for sure.
Not only that, but I think the level of acceptance will be inversely
proportional to how non-obvious and complicated the specification is.
> But so far, besides that very specific case for the post-release dev
> tag, I don't find it complicated at all.
Then why not drop that part and stick to simple alphanumeric comparison
of each component?
--
\ “Ubi dubium, ibi libertas.” (“Where there is doubt, there is |
`\ freedom.”) |
_o__) |
Ben Finney
More information about the Distutils-SIG
mailing list