Skip to content

Commit 0d2bcd8

Browse files
committed
Fix #3419. Update example versions to be PEP440-compliant
1 parent 2646233 commit 0d2bcd8

File tree

1 file changed

+28
-21
lines changed

1 file changed

+28
-21
lines changed

docs/userguide/distribution.rst

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ other tools can always tell what version of your package is newer than another
1111
version. Knowing these things will also help you correctly specify what
1212
versions of other projects your project depends on.
1313

14-
A version consists of an alternating series of release numbers and pre-release
15-
or post-release tags. A release number is a series of digits punctuated by
14+
A version consists of an alternating series of release numbers and
15+
`pre-release <https://peps.python.org/pep-0440/#pre-releases>`_
16+
or `post-release <https://peps.python.org/pep-0440/#post-releases>`_ tags. A
17+
release number is a series of digits punctuated by
1618
dots, such as ``2.4`` or ``0.5``. Each series of digits is treated
1719
numerically, so releases ``2.1`` and ``2.1.0`` are different ways to spell the
1820
same release number, denoting the first subrelease of release 2. But ``2.10``
@@ -22,43 +24,47 @@ ignored, so ``2.01`` is the same as ``2.1``, and different from ``2.0.1``.
2224

2325
Following a release number, you can have either a pre-release or post-release
2426
tag. Pre-release tags make a version be considered *older* than the version
25-
they are appended to. So, revision ``2.4`` is *newer* than revision ``2.4c1``,
26-
which in turn is newer than ``2.4b1`` or ``2.4a1``. Postrelease tags make
27+
they are appended to. So, revision ``2.4`` is *newer* than release candidate
28+
``2.4rc1``, which in turn is newer than beta release ``2.4b1`` or
29+
alpha release ``2.4a1``. Postrelease tags make
2730
a version be considered *newer* than the version they are appended to. So,
28-
revisions like ``2.4-1`` are newer than ``2.4``, but *older*
31+
revisions like ``2.4.post1`` are newer than ``2.4``, but *older*
2932
than ``2.4.1`` (which has a higher release number).
3033

3134
In the case of legacy versions (for example, ``2.4pl1``), they are considered
3235
older than non-legacy versions. Taking that in count, a revision ``2.4pl1``
33-
is *older* than ``2.4``
36+
is *older* than ``2.4``. Note that ``2.4pl1`` is not :pep:`440`-compliant.
3437

3538
A pre-release tag is a series of letters that are alphabetically before
3639
"final". Some examples of prerelease tags would include ``alpha``, ``beta``,
3740
``a``, ``c``, ``dev``, and so on. You do not have to place a dot or dash
3841
before the prerelease tag if it's immediately after a number, but it's okay to
3942
do so if you prefer. Thus, ``2.4c1`` and ``2.4.c1`` and ``2.4-c1`` all
4043
represent release candidate 1 of version ``2.4``, and are treated as identical
41-
by setuptools.
44+
by setuptools. Note that only ``a``, ``b``, and ``rc`` are :pep:`440`-compliant
45+
pre-release tags.
4246

4347
In addition, there are three special prerelease tags that are treated as if
4448
they were the letter ``c``: ``pre``, ``preview``, and ``rc``. So, version
4549
``2.4rc1``, ``2.4pre1`` and ``2.4preview1`` are all the exact same version as
4650
``2.4c1``, and are treated as identical by setuptools.
4751

48-
A post-release tag is either a series of letters that are alphabetically
49-
greater than or equal to "final", or a dash (``-``). Post-release tags are
50-
generally used to separate patch numbers, port numbers, build numbers, revision
51-
numbers, or date stamps from the release number. For example, the version
52-
``2.4-r1263`` might denote Subversion revision 1263 of a post-release patch of
53-
version ``2.4``. Or you might use ``2.4-20051127`` to denote a date-stamped
54-
post-release.
55-
56-
Notice that after each pre or post-release tag, you are free to place another
57-
release number, followed again by more pre- or post-release tags. For example,
58-
``0.6a9.dev-r41475`` could denote Subversion revision 41475 of the in-
52+
A post-release tag is the string ``.post``, followed by a non-negative integer
53+
value. Post-release tags are generally used to separate patch numbers, port
54+
numbers, build numbers, revision numbers, or date stamps from the release
55+
number. For example, the version ``2.4.post1263`` might denote Subversion
56+
revision 1263 of a post-release patch of version ``2.4``. Or you might use
57+
``2.4.post20051127`` to denote a date-stamped post-release. Legacy post-release
58+
tags could be either a series of letters that are alphabetically greater than or
59+
equal to "final", or a dash (``-``) - for example ``2.4-r1263`` or
60+
``2.4-20051127``.
61+
62+
Notice that after each legacy pre or post-release tag, you are free to place
63+
another release number, followed again by more pre- or post-release tags. For
64+
example, ``0.6a9.dev41475`` could denote Subversion revision 41475 of the in-
5965
development version of the ninth alpha of release 0.6. Notice that ``dev`` is
6066
a pre-release tag, so this version is a *lower* version number than ``0.6a9``,
61-
which would be the actual ninth alpha of release 0.6. But the ``-r41475`` is
67+
which would be the actual ninth alpha of release 0.6. But the ``41475`` is
6268
a post-release tag, so this version is *newer* than ``0.6a9.dev``.
6369

6470
For the most part, setuptools' interpretation of version numbers is intuitive,
@@ -68,9 +74,10 @@ but here are a few tips that will keep you out of trouble in the corner cases:
6874
between them. Version ``1.9adev`` is the ``adev`` prerelease of ``1.9``,
6975
*not* a development pre-release of ``1.9a``. Use ``.dev`` instead, as in
7076
``1.9a.dev``, or separate the prerelease tags with a number, as in
71-
``1.9a0dev``. ``1.9a.dev``, ``1.9a0dev``, and even ``1.9.a.dev`` are
77+
``1.9a0dev``. ``1.9a.dev``, ``1.9a0dev``, and even ``1.9a0.dev0`` are
7278
identical versions from setuptools' point of view, so you can use whatever
73-
scheme you prefer.
79+
scheme you prefer. Of these examples, only ``1.9a0.dev0`` is
80+
:pep:`440`-compliant.
7481

7582
* If you want to be certain that your chosen numbering scheme works the way
7683
you think it will, you can use the ``pkg_resources.parse_version()`` function

0 commit comments

Comments
 (0)