@@ -25,21 +25,16 @@ platform tag
25
25
For example, the tag ``py27-none-any `` indicates compatibility with Python 2.7
26
26
(any Python 2.7 implementation) with no abi requirement, on any platform.
27
27
28
- Use
29
- ===
30
-
31
28
The ``wheel `` built package format includes these tags in its filenames,
32
29
of the form
33
30
``{distribution}-{version}(-{build tag})?-{python tag}-{abitag}-{platform tag}.whl ``.
34
31
Other package formats may have their own conventions.
35
32
36
33
Any potential spaces in any tag should be replaced with ``_ ``.
37
34
38
- Details
39
- =======
40
35
41
36
Python Tag
42
- ----------
37
+ ==========
43
38
44
39
The Python tag indicates the implementation and version required by
45
40
a distribution. Major implementations have abbreviated codes, initially:
@@ -66,8 +61,9 @@ intentionally released a cross-version-compatible distribution.
66
61
A single-source Python 2/3 compatible distribution can use the compound
67
62
tag ``py2.py3 ``. See `Compressed Tag Sets `_, below.
68
63
64
+
69
65
ABI Tag
70
- -------
66
+ =======
71
67
72
68
The ABI tag indicates which Python ABI is required by any included
73
69
extension modules. For implementation-specific ABIs, the implementation
@@ -82,50 +78,49 @@ revision and compiler flags, etc, but will probably not have a great need
82
78
to distribute binary distributions. Each implementation's community may
83
79
decide how to best use the ABI tag.
84
80
81
+
85
82
Platform Tag
86
- ------------
83
+ ============
84
+
85
+ Basic platform tags
86
+ -------------------
87
87
88
- The platform tag is simply ``sysconfig.get_platform() `` with all
89
- hyphens ``- `` and periods ``. `` replaced with underscore ``_ ``.
88
+ In its simplest form, the platform tag is ``sysconfig.get_platform() `` with
89
+ all hyphens ``- `` and periods ``. `` replaced with underscore ``_ ``.
90
90
Until the removal of :ref: `distutils ` in Python 3.12, this
91
- was ``distutils.util.get_platform() ``.
91
+ was ``distutils.util.get_platform() ``. For example:
92
92
93
93
* win32
94
94
* linux_i386
95
95
* linux_x86_64
96
96
97
97
98
- -------------
98
+ .. _manylinux :
99
+
99
100
``manylinux ``
100
101
-------------
101
- .. _manylinux :
102
102
103
- The scheme defined in :pep: ` 425 ` was insufficient for public distribution of
104
- wheel files (and \* nix wheel files in general) to Linux platforms, due to the
105
- large ecosystem of Linux platforms and subtle differences between them.
103
+ The simple scheme above is insufficient for public distribution of wheel files
104
+ to Linux platforms, due to the large ecosystem of Linux platforms and subtle
105
+ differences between them.
106
106
107
- Instead, :pep: ` 600 ` defines the ``manylinux `` standard, which represents a
108
- common subset of Linux platforms, and allows building wheels tagged with the
107
+ Instead, for those platforms, the ``manylinux `` standard represents a common
108
+ subset of Linux platforms, and allows building wheels tagged with the
109
109
``manylinux `` platform tag which can be used across most common Linux
110
110
distributions.
111
111
112
- There were multiple iterations of the ``manylinux `` specification, each
113
- representing the common subset of Linux platforms at a given point in time:
112
+ The current standard is the future-proof ``manylinux_x_y `` standard. It defines
113
+ tags of the form ``manylinux_x_y_arch ``, where ``x `` and ``y `` are glibc major
114
+ and minor versions supported (e.g. ``manylinux_2_24_xxx `` should work on any
115
+ distro using glibc 2.24+), and ``arch `` is the architecture, matching the value
116
+ of ``sysconfig.get_platform() `` on the system as in the "simple" form above.
114
117
115
- * ``manylinux1 `` (:pep: `513 `) supports ``x86_64 `` and ``i686 ``
116
- architectures, and is based on a compatible Linux platform from 2007.
117
- * ``manylinux2010 `` (:pep: `571 `) supports ``x86_64 `` and ``i686 ``
118
- architectures. and updates the previous specification to be based on a
119
- compatible Linux platform from 2010 instead.
120
- * ``manylinux2014 `` (:pep: `599 `) adds support for a number of
121
- additional architectures (``aarch64 ``, ``armv7l ``, ``ppc64 ``, ``ppc64le ``,
122
- and ``s390x ``) and updates the base platform to a compatible Linux platform
123
- from 2014.
118
+ The following older tags are still supported for backward compatibility:
124
119
125
- `` manylinux_x_y `` ( :pep: ` 600 `) supersedes all previous PEPs to define a
126
- future-proof standard. It defines `` x `` and ``y `` as glibc major an minor
127
- versions supported (e.g. `` manylinux_2_24 `` should work on any distro using
128
- glibc 2.24+). Previous tags are still supported for backward compatibility .
120
+ * `` manylinux1 `` supports glibc 2.5 on `` x86_64 `` and `` i686 `` architectures.
121
+ * `` manylinux2010 `` supports glibc 2.12 on `` x86_64 `` and ``i686 ``.
122
+ * `` manylinux2014 `` supports glibc 2.17 on `` x86_64 ``, `` i686 ``, `` aarch64 ``,
123
+ `` armv7l ``, `` ppc64 ``, `` ppc64le ``, and `` s390x `` .
129
124
130
125
In general, distributions built for older versions of the specification are
131
126
forwards-compatible (meaning that ``manylinux1 `` distributions should continue
@@ -138,15 +133,6 @@ possible, with the caveat that the provided build environment for
138
133
``manylinux1 `` and ``manylinux2010 `` have reached end-of-life meaning that
139
134
these images will no longer receive security updates.
140
135
141
- Manylinux compatibility support
142
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
143
-
144
- .. Note ::
145
- * The ``manylinux2014 `` specification is relatively new and is not yet widely
146
- recognised by install tools.
147
- * The ``manylinux_x_y `` specification is relatively new and is not yet widely
148
- recognised by install tools.
149
-
150
136
The following table shows the minimum versions of relevant projects to support
151
137
the various ``manylinux `` standards:
152
138
@@ -159,6 +145,51 @@ auditwheel ``>=1.0.0`` ``>=2.0.0`` ``>=3.0.0`` ``>=3.3.0`` [#
159
145
160
146
.. [# ] Only support for ``manylinux_2_24 `` has been added in auditwheel 3.3.0
161
147
148
+
149
+ ``musllinux ``
150
+ -------------
151
+
152
+ The ``musllinux `` family of tags is similar to ``manylinux ``, but for Linux
153
+ platforms that use the musl _ libc rather than glibc (a prime example being Alpine
154
+ Linux). The schema is ``musllinux_x_y_arch ``, supporting musl ``x.y `` and higher
155
+ on the architecture ``arch ``.
156
+
157
+ The musl version values can be obtained by executing the musl libc shared
158
+ library the Python interpreter is currently running on, and parsing the output:
159
+
160
+ .. code-block :: python
161
+
162
+ import re
163
+ import subprocess
164
+
165
+ def get_musl_major_minor (so : str ) -> tuple[int , int ] | None :
166
+ """ Detect musl runtime version.
167
+
168
+ Returns a two-tuple ``(major, minor)`` that indicates musl
169
+ library's version, or ``None`` if the given libc .so does not
170
+ output expected information.
171
+
172
+ The libc library should output something like this to stderr::
173
+
174
+ musl libc (x86_64)
175
+ Version 1.2.2
176
+ Dynamic Program Loader
177
+ """
178
+ proc = subprocess.run([so], stderr = subprocess.PIPE , text = True )
179
+ lines = (line.strip() for line in proc.stderr.splitlines())
180
+ lines = [line for line in lines if line]
181
+ if len (lines) < 2 or lines[0 ][:4 ] != " musl" :
182
+ return None
183
+ match = re.match(r " Version ( \d + ) \. ( \d + ) " , lines[1 ])
184
+ if match:
185
+ return (int (match.group(1 )), int (match.group(2 )))
186
+ return None
187
+
188
+ There are currently two possible ways to find the musl library’s location that a
189
+ Python interpreter is running on, either with the system ldd _ command, or by
190
+ parsing the ``PT_INTERP `` section’s value from the executable’s ELF _ header.
191
+
192
+
162
193
Use
163
194
===
164
195
@@ -307,3 +338,10 @@ History
307
338
- July 2019: The ``manylinux2014 `` tag was approved through :pep: `599 `.
308
339
- November 2019: The ``manylinux_x_y `` perennial tag was approved through
309
340
:pep: `600 `.
341
+ - April 2021: The ``musllinux_x_y `` tag was approved through :pep: `656 `.
342
+
343
+
344
+
345
+ .. _musl : https://musl.libc.org
346
+ .. _ldd : https://www.unix.com/man-page/posix/1/ldd/
347
+ .. _elf : https://refspecs.linuxfoundation.org/elf/elf.pdf
0 commit comments