[Python-Dev] Proposing PEP 345 : Metadata for Python Software Packages 1.2

Lennart Regebro regebro at gmail.com
Mon Dec 28 11:21:05 CET 2009


Another penny dropped when it comes to version specs.

Should 2.5 mean 2.5.0 only, or 2.5.*. Well... why would you ever need
to specify 2.5.0 only. That's a nonsense specification.

"My project requires Python 2.5.0, but doesn't work with 2.5.1". Huh!?
Well, then fix it, goofball. :)

2.5 can mean 2.5.* without any problems. And 3 should mean 3.*.*.


New suggested spec:

versionrequirements ::= 'Requires-Python: ' specificationlist
specificationlist   ::= specification (; specification)*
specification       ::= version | "[" [version] ":" [version] "]"
version             ::= lc_number ["." lc_number [ "." lc_number ] ]

With examples being:

    Requires-Python: [2.5.2:3]; [3.1:]

Or on several rows:

    Requires-Python: [2.5.2:3];
                    [3.1.2];
                    [3.2:]


Meaning 2.5.2 or later, but not Python 3. *or*
Python 3.1.2. *or*
Python 3.2 or later.

Or if slicing syntax is not wanted:

versionrequirements ::= 'Requires-Python: ' specificationlist
specificationlist   ::= specification (; specification)*
specification       ::= version | minimum | maximum | miniumum " " maximum
minimum             ::= ('>' | '>=') version
maximum             ::= ('<' | '<=') version
version             ::= lc_number ["." lc_number [ "." lc_number ] ]

That would mean something like the following:

    Requires-Python: >= 2.5.2 < 3; >= 3.1

or more clearer if it's split up in lines:

    Requires-Python: >= 2.5.2 < 3;
                    >= 3.1

The following would be illegal:

    Requires-Python: >= 2.5.2 > 3
    Requires-Python: <= 2.5.2 < 3
    Requires-Python: <= 2.5.2 < 3 > 3.1


More information about the Python-Dev mailing list