[Distutils] Setuptools feature request: simplified version specification

Jim Fulton jim at zope.com
Fri Jul 6 20:54:44 CEST 2007

On Jul 6, 2007, at 2:38 PM, Phillip J. Eby wrote:

> At 02:09 PM 7/6/2007 -0400, 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 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.
>> Thoughts?
> I'm not sure what I think of ' ' as the operator.

I wasn't suggesting adding '' as an operator. :)

> This change would also have to be an 0.7 feature, as any package  
> that uses it will be dependent on having a setuptools version that  
> understands it, at least in order to build an egg.


>   (We could have egg_info write the expanded forms, so that the  
> built eggs' dependencies would be comprehensible to older versions.)

That makes sense.

Hm. That's interesting.  I hadn't thought through the implication of  
that.  I guess there are all sorts of things that can be done in a  
setup script to make this work now without changing setuptools.  In  
the long term, I'd like to setuptools support this syntax, however, I  
suppose there are lots of opportunities to support it in the short  
term.  I'll have to see what I can think of.

> I'm also not sure that '1a' can't/shouldn't be a valid specifier,  
> although I suppose it would mean being equal to either ">= 1a.dev,  
> <1b.dev" or ">= 1a0dev, <1a1dev", both of which are a little  
> weird.  :)

As I mentioned in my response to Dave, I'm OK with anything since I  
think this is an extreme edge case, however I think it's best not to  


Jim Fulton			mailto:jim at zope.com		Python Powered!
CTO 				(540) 361-1714			http://www.python.org
Zope Corporation	http://www.zope.com		http://www.zope.org

More information about the Distutils-SIG mailing list