Skip to content

Commit eb229aa

Browse files
Clarify wheel compatibility tag matching and preference
Refs #1663 Assisted-by: OpenAI Codex
1 parent 5ecbc0d commit eb229aa

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

‎source/specifications/platform-compatibility-tags.rst‎

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,10 @@ Use
303303

304304
The tags are used by installers to decide which built distribution
305305
(if any) to download from a list of potential built distributions.
306-
The installer maintains a list of (pyver, abi, arch) tuples that it
307-
will support. If the built distribution's tag is ``in`` the list, then
308-
it can be installed.
306+
The installer maintains an ordered list of tags supported by the target
307+
environment. A wheel is tag-compatible if at least one of its tags appears in
308+
that list. A matching tag does not by itself guarantee installation: the
309+
installer can also consider metadata such as ``Requires-Python``.
309310

310311
It is recommended that installers try to choose the most feature complete
311312
built distribution available (the one most specific to the installation
@@ -348,9 +349,24 @@ Sometimes there will be more than one supported built distribution for a
348349
particular version of a package. For example, a packager could release
349350
a package tagged ``cp33-abi3-linux_x86_64`` that contains an optional C
350351
extension and the same distribution tagged ``py3-none-any`` that does not.
351-
The index of the tag in the supported tags list breaks the tie, and the
352-
package with the C extension is installed in preference to the package
353-
without because that tag appears first in the list.
352+
When otherwise equivalent wheels both match, the wheel with the earliest
353+
matching tag in the supported list is preferred. This compares each wheel's
354+
best match, not the order of the tags in its filename.
355+
356+
The CPython 3.3 list above is historical. To see the first few supported
357+
tags for the interpreter you are running, use
358+
`packaging.tags.sys_tags() <https://packaging.pypa.io/en/stable/tags.html#packaging.tags.sys_tags>`_:
359+
360+
.. code-block:: python
361+
362+
from itertools import islice
363+
364+
from packaging.tags import sys_tags
365+
366+
for tag in islice(sys_tags(), 5):
367+
print(tag)
368+
369+
The output depends on the Python implementation, ABI, and platform.
354370

355371
Compressed Tag Sets
356372
===================

0 commit comments

Comments
 (0)