[Distutils] Setuptools feature request: simplified version specification

Dave Peterson dpeterson at enthought.com
Fri Jul 6 20:17:18 CEST 2007


Jim Fulton wrote:
> We (me and a bunch of my Zope friends) find that we'll often want  
> version specifications of the form:
>
>    project_name >=Vdev, <V+1dev  (e.g.  "foo >=1dev, <2dev")
>
> We think this is so common that we'd like a short-hand way of  
> spelling it.
>
> I'll note that I'm not even sure I got the spelling above right. The  
> intent is to request version 1, meaning any release of version 1.  I  
> think that's what I spelled above, although I'm not sure.  If I got  
> it wrong, maybe someone will correct me.  Aside from the verbosity of  
> the spelling above, I think the difficulty in spelling it is a strike  
> against it.  Note that a naive spelling: "foo >=1, <2" is wrong  
> because it excludes pre-releases of 1 and includes pre-releases of 2.
>
>   
I hope you got it right because that's exactly the syntax we're using 
here at Enthought.   Well, except that we use a '.dev' instead of a 
'dev' :-)  And I agree with you that getting it right isn't trivial.  It 
tooks us a couple of attempts and exploring a couple of usecases to 
figure it out.


> I propose that a valid version that ends in a number and that isn't  
> preceded by an operator be a valid version specifier and be  
> interpreted as a range. So, assuming that I know how to spell the  
> range, a specification of:
>
>    project_name V  (e.g. "foo 1")
>
> would be equivalent to:
>
>    project_name >=Vdev, <V+1  (e.g. "foo >=1dev, <2dev")
>
> This would work with multi-part versions, so "foo 1.2" would be  
> equivalent to "foo >=1.2dev <1.3dev".
>
> Note that this could be combined with other version specifiers.  For  
> example, to require any version 1 or 2 of foo or versions 3.2 final  
> or later:
>
>    foo 1, 2, >=3.2
>
> Also note that any version will do, so:
>
>    foo 1.2a1
>
> would be equivalent to:
>
>    foo >=1.2a1dev <1.2a2dev
>
> And note that versions that don't end in numbers wouldn't be valid  
> version specifiers, so:
>
>    foo 1a
>
> would not be a valid specifier.
>   

I think this all sounds great, except that I'd made the last example 
valid by assuming it ended with a 0.  i.e.

    foo 1a ==>   foo >=1adev,  <1a1dev

This would be somewhat inline with the current pattern of expanding with 
zeros to say version 1 is equivalent to 1.0.0.0....0.


-- Dave


More information about the Distutils-SIG mailing list