[Distutils] Finishing PEP 345

Tarek Ziadé ziade.tarek at gmail.com
Fri Dec 25 13:12:12 CET 2009


2009/12/24 "Martin v. Löwis" <martin at v.loewis.de>:
[..]
>>> Requires-Python: 3
>>>
>>> means any 3.x, then we have 3==3.1, 3==3.2, 3.1==3.1.3, 3.2==3.2.4,
>>> and, transitively, 3.1.3==3.2.4. This is undesirable.
>>
>> Why this is undesirable ?
>
> I find it undesirable if 3.1.3==3.2.4. Then, if I specify
>
> Requires-Python: 3.1.3
>
> and I have 3.2.4 installed, it would accept that (because the
> version numbers are "equal", i.e. "==").
>

This looks quite complex to me. How do you translate in that case

   "My project is compatible with Python 3.1" ?

You can't do this:

  Requires-Python: 3.1.1, 3.1.2, 3.1.3, etc...

You could do this:

   Requires-Python: >=3.1,<3.2

But I find this *way* simpler:

   Requires-Python: 3.1

And from a reader point of view, it easily translates to : "This
project requires Python 3.1"
(without detailing the micro release)

And if you want to say that your project requires Python 3.1.4 and up:

     Requires-Python: >=3.1.4


>> You'll have to convince me otherwise by explaining why it's a mistake
>> to apply wildcarding when the full version is not provided.
>
> See above: is == transitive or not?
>
> I think it is counter-intuitive if the == operator on versions does
> anything else than comparing version strings for string equality.
> If you think that a range matching operator is needed, perhaps
> a different symbol could be used (such as ~=)?


Ok maybe that would be the solution indeed: if we add a ~= symbol
that compares ranges, we could make it the default operator. e.g.:

    Requires-Python: 3.1

would mean

   Requires-Python: ~=3.1

wich would be equal to:

   Requires-Python: >=3.1,<3.2


Then == would compare precise versions.


How does that sounds ?

>
>>>> 3.6 would include all 3.6.x releases as well. So 3.6b4 is excluded
>>>> since it does not belong to the 3.6 series, but 3.6.1b4 is included.
>>> Please define "belongs to the 3.6 series". In PEP 386 terminology,
>>> I would expect that this means "the 'version' part is 3.6", so
>>> 3.6b4 *does* belong to the 3.6 series.
>>
>> Sorry, here's the definition I've put behind the word belong:
>>
>> A version belongs to the 3.6 series if : 3.6 <= VERSION < 3.7
>>
>> 3.6b4 is the fourth beta release, so :
>>
>> 3.6b4 < 3.6 <= VERSION < 3.7
>>
>> So obviously, if the developer ask for 3.6, he doesn't want a preview of that
>> version, he wants that version
>
> Where is that specified? I can't find it in the PEP.

It is not specified like this, but the examples in PEP 386 indicates
that b4 is a marker for a beta pre-release. And that "a" , "b" , "c"
are post-release markers.

We could add a section to explain it more precisely;


>
> If you really want this == operator, please add a Discussion section to
> the PEP discussing that there was objection to this operator, proposing
> that it should do string== instead, and that this specific semantics was
> chosen because <insert reason>.
>
> Regards,
> Martin
>
> P.S. I notice that your == definition and my explicit rewrite of it have
> the same flaw: in your example, "3.7b1" would also match a version
> specification of "3.6". I.e. prereleases of the next releases still fall
> into the previous range.

Yes. That's quite a problem. I am wondering if we should introduce
a specific operator to include/exclude pre and post releases.

The use case I can see would be to be able :
- to exclude pre-releases and post-releases (defaut behaviour)
- to include one of them, or both

Regards,
Tarek

-- 
Tarek Ziadé | http://ziade.org


More information about the Distutils-SIG mailing list