[Distutils] Fwd: setuptools: Spelling < 3.1.0beta3 ?

Phillip J. Eby pje at telecommunity.com
Sun May 4 19:49:38 CEST 2008


At 12:48 PM 5/2/2008 -0400, Alexander Michael wrote:
>On Fri, May 2, 2008 at 12:30 PM, Pete <pfein at pobox.com> wrote:
>  > Hi-
>  >
>  >  What's the proper way to spell "any version in the 3.0.x series" if a
>  > project has a 3.1.0beta3 release?
>  >
>  >  Specifically, CherryPy has both 3.0.2 and 3.1.0beta3 
> releases.  I'd like to
>  > depend on any 3.0.x
>  >
>  >  I've tried both 'CherryPy < 3.1' and 'CherryPy < 3.1.0' in my
>  > install_requires, and both cause setuptools to pull 3.1.0beta3.
>  >
>  >  I realize I can use 'CherryPy == 3.0.2' but that defeats the "any 3.0.x"
>  > idea...
>
>  I find this surprising as well, but the answer is:
>
>  >>> import pkg_resources
>  >>> v = pkg_resources.parse_version
>  >>> v('3.1.0beta3') < v('3.1.0')
>  True
>  >>> v('3.1.0beta3') < v('3.1.0a0')
>  False

Leading zeros before an alpha component are dropped from comparisons, 
so you could equally say '<3.1a'.

However, what you really want is '<3.1dev', as 'dev' is the 
lowest-possible precedence pre-release tag.

So, to say "any 3.0.x", you would need to say '>=3.0.1dev, 
<3.1dev'  (assuming you wanted to include pre-release 3.0.x versions).



>  I wish it was "easier" to say "3.1.x" (as in any final sub-point
>  release in the 3 series) or "1.x" (as in any final version 1 release)
>  which didn't allow development, alpha, beta, candidate, etc. releases.
>  Is there?

Not at the moment, no.



More information about the Distutils-SIG mailing list