Skip to content

Commit fc332d9

Browse files
authored
Merge pull request #1340 from jeanas/pep440
Import PEP 440
2 parents 68b8370 + 367e5e8 commit fc332d9

9 files changed

+1294
-41
lines changed

source/glossary.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,10 @@ Glossary
252252
Version Specifier
253253

254254
The version component of a :term:`Requirement Specifier`. For example,
255-
the ">=1.3" portion of "foo>=1.3". :pep:`440` contains
256-
a :pep:`full specification
257-
<440#version-specifiers>` of the
258-
specifiers that Python packaging currently supports. Support for PEP440
259-
was implemented in :ref:`setuptools` v8.0 and :ref:`pip` v6.0.
255+
the ">=1.3" portion of "foo>=1.3". Read the :ref:`Version specifier specification
256+
<version-specifiers>` for a full description of the
257+
specifiers that Python packaging currently supports. Support for this
258+
specification was implemented in :ref:`setuptools` v8.0 and :ref:`pip` v6.0.
260259

261260
Virtual Environment
262261

source/specifications/binary-distribution-format.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ this character cannot appear within any component. This is handled as follows:
182182
Tools consuming wheels must be prepared to accept ``.`` (FULL STOP) and
183183
uppercase letters, however, as these were allowed by an earlier version of
184184
this specification.
185-
- Version numbers should be normalised according to :pep:`440`. Normalised
186-
version numbers cannot contain ``-``.
185+
- Version numbers should be normalised according to the :ref:`Version specifier
186+
specification <version-specifiers>`. Normalised version numbers cannot contain ``-``.
187187
- The remaining components may not contain ``-`` characters, so no escaping
188188
is necessary.
189189

source/specifications/core-metadata.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ Version of the file format; legal values are "1.0", "1.1", "1.2", "2.1",
5151
Automated tools consuming metadata SHOULD warn if ``metadata_version`` is
5252
greater than the highest version they support, and MUST fail if
5353
``metadata_version`` has a greater major version than the highest
54-
version they support (as described in :pep:`440`, the major version is the
55-
value before the first dot).
54+
version they support (as described in the
55+
:ref:`Version specifier specification <version-specifiers>`,
56+
the major version is the value before the first dot).
5657

5758
For broader compatibility, build tools MAY choose to produce
5859
distribution metadata using the lowest metadata version that includes
@@ -94,7 +95,8 @@ Version
9495
.. versionadded:: 1.0
9596

9697
A string containing the distribution's version number. This
97-
field must be in the format specified in :pep:`440`.
98+
field must be in the format specified in the
99+
:ref:`Version specifier specification <version-specifiers>`.
98100

99101
Example::
100102

@@ -585,8 +587,8 @@ This field may be followed by an environment marker after a semicolon.
585587

586588
Because they refer to non-Python software releases, version numbers
587589
for this field are **not** required to conform to the format
588-
specified in :pep:`440`: they should correspond to the
589-
version scheme used by the external dependency.
590+
specified in the :ref:`Version specifier specification <version-specifiers>`:
591+
they should correspond to the version scheme used by the external dependency.
590592

591593
Notice that there is no particular rule on the strings to be used.
592594

source/specifications/declaring-project-metadata.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ as it is read for internal consistency.
8787
- Corresponding :ref:`core metadata <core-metadata>` field:
8888
:ref:`Version <core-metadata-version>`
8989

90-
The version of the project as supported by :pep:`440`.
90+
The version of the project, as defined in the
91+
:ref:`Version specifier specification <version-specifiers>`.
9192

9293
Users SHOULD prefer to specify already-normalized versions.
9394

source/specifications/dependency-specifiers.rst

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ acceptable, so the language permits describing all these cases.
1616
The language defined is a compact line based format which is already in
1717
widespread use in pip requirements files, though we do not specify the command
1818
line option handling that those files permit. There is one caveat - the
19-
URL reference form, specified in :pep:`440` is not actually
20-
implemented in pip, but since :pep:`440` is accepted, we use that format rather
19+
URL reference form, specified in :ref:`Versioning specifier specification <version-specifiers>`
20+
is not actually implemented in pip, but we use that format rather
2121
than pip's current native format.
2222

2323
Specification
@@ -57,7 +57,8 @@ as comments, multiple line support via continuations, or other such features.
5757
The full grammar including annotations to build a useful parse tree is
5858
included at the end of this document.
5959

60-
Versions may be specified according to the :pep:`440` rules. (Note:
60+
Versions may be specified according to the rules of the
61+
:ref:`Version specifier specification <version-specifiers>`. (Note:
6162
URI is defined in :rfc:`std-66 <3986>`)::
6263

6364
version_cmp = wsp* '<' | '<=' | '!=' | '==' | '>=' | '>' | '~=' | '==='
@@ -159,12 +160,13 @@ If multiple extras are listed, all the dependencies are unioned together.
159160
Versions
160161
--------
161162

162-
See :pep:`440` for more detail on both version numbers and version
163-
comparisons. Version specifications limit the versions of a distribution that
164-
can be used. They only apply to distributions looked up by name, rather than
163+
See the :ref:`Version specifier specification <version-specifiers>` for
164+
more detail on both version numbers and version comparisons. Version
165+
specifications limit the versions of a distribution that can be
166+
used. They only apply to distributions looked up by name, rather than
165167
via a URL. Version comparison are also used in the markers feature. The
166-
optional brackets around a version are present for compatibility with :pep:`345`
167-
but should not be generated, only accepted.
168+
optional brackets around a version are present for compatibility with
169+
:pep:`345` but should not be generated, only accepted.
168170

169171
Environment Markers
170172
-------------------
@@ -186,10 +188,11 @@ fixes some issues that were observed in the design described in :pep:`426`.
186188

187189
Comparisons in marker expressions are typed by the comparison operator. The
188190
<marker_op> operators that are not in <version_cmp> perform the same as they
189-
do for strings in Python. The <version_cmp> operators use the :pep:`440`
190-
version comparison rules when those are defined (that is when both
191-
sides have a valid version specifier). If there is no defined :pep:`440`
192-
behaviour and the operator exists in Python, then the operator falls back to
191+
do for strings in Python. The <version_cmp> operators use the version comparison
192+
rules of the :ref:`Version specifier specification <version-specifiers>`
193+
when those are defined (that is when both sides have a valid
194+
version specifier). If there is no defined behaviour of this specification
195+
and the operator exists in Python, then the operator falls back to
193196
the Python behaviour. Otherwise an error should be raised. e.g. the following
194197
will result in errors::
195198

source/specifications/direct-url-data-structure.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ source trees, source distributions and wheels.
1111

1212
The representation of the components of this data structure as a :rfc:`1738` URL
1313
is not formally specified at time of writing. A common representation is the pip URL
14-
format. Other examples are provided in :pep:`440`.
14+
format. Other examples are provided in the :ref:`Version specifier specification <version-specifiers>`.
1515

1616

1717
Specification

source/specifications/recording-installed-packages.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,11 @@ packages (commonly, the ``site-packages`` directory).
4242

4343
This directory is named as ``{name}-{version}.dist-info``, with ``name`` and
4444
``version`` fields corresponding to :ref:`core-metadata`. Both fields must be
45-
normalized (see :ref:`name-normalization` and
46-
:pep:`PEP 440 <440#normalization>` for the definition of normalization for
47-
each field respectively), and replace dash (``-``) characters with
48-
underscore (``_``) characters, so the ``.dist-info`` directory always has
49-
exactly one dash (``-``) character in its stem, separating the ``name`` and
50-
``version`` fields.
45+
normalized (see the :ref:`name normalization specification <name-normalization>`
46+
and the :ref:`version normalization specification <version-specifiers-normalization>`),
47+
and replace dash (``-``) characters with underscore (``_``) characters,
48+
so the ``.dist-info`` directory always has exactly one dash (``-``) character in
49+
its stem, separating the ``name`` and ``version`` fields.
5150

5251
Historically, tools have failed to replace dot characters or normalize case in
5352
the ``name`` field, or not perform normalization in the ``version`` field.

0 commit comments

Comments
 (0)