Skip to content

Commit c07b39a

Browse files
authored
Merge pull request #1804 from freakboy3742/mobile-tags
Document iOS, Android and macOS platform tag schemes.
2 parents fbe05df + 2d26d3a commit c07b39a

File tree

1 file changed

+107
-4
lines changed

1 file changed

+107
-4
lines changed

source/specifications/platform-compatibility-tags.rst

Lines changed: 107 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ subset of Linux platforms, and allows building wheels tagged with the
109109
``manylinux`` platform tag which can be used across most common Linux
110110
distributions.
111111

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
112+
The current standard is the future-proof :file:`manylinux_{x}_{y}` standard. It defines
113+
tags of the form :file:`manylinux_{x}_{y}_{arch}`, where ``x`` and ``y`` are glibc major
114114
and minor versions supported (e.g. ``manylinux_2_24_xxx`` should work on any
115115
distro using glibc 2.24+), and ``arch`` is the architecture, matching the value
116116
of :py:func:`sysconfig.get_platform()` on the system as in the "simple" form above.
@@ -151,7 +151,7 @@ auditwheel ``>=1.0.0`` ``>=2.0.0`` ``>=3.0.0`` ``>=3.3.0`` [#
151151

152152
The ``musllinux`` family of tags is similar to ``manylinux``, but for Linux
153153
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
154+
Linux). The schema is :file:`musllinux_{x}_{y}_{arch}``, supporting musl ``x.y`` and higher
155155
on the architecture ``arch``.
156156

157157
The musl version values can be obtained by executing the musl libc shared
@@ -189,6 +189,108 @@ There are currently two possible ways to find the musl library’s location that
189189
Python interpreter is running on, either with the system ldd_ command, or by
190190
parsing the ``PT_INTERP`` section’s value from the executable’s ELF_ header.
191191

192+
.. _macos:
193+
194+
macOS
195+
-----
196+
197+
macOS uses the ``macosx`` family of tags (the ``x`` suffix is a historical
198+
artefact of Apple's official macOS naming scheme). The schema for compatibility
199+
tags is :file:`macosx_{x}_{y}_{arch}`, indicating that the wheel is compatible
200+
with macOS ``x.y`` or later on the architecture ``arch``.
201+
202+
The values of ``x`` and ``y`` correspond to the major and minor version number of
203+
the macOS release, respectively. They must both be positive integers, with the
204+
``x`` value being ``>= 10``. The version number always includes a major *and*
205+
minor version, even if Apple's official version numbering only refers to
206+
the major value. For example, ``macosx_11_0_arm64`` indicates compatibility
207+
with macOS 11 or later.
208+
209+
macOS binaries can be compiled for a single architecture, or can include support
210+
for multiple architectures in the same binary (sometimes called "fat" binaries).
211+
To indicate support for a single architecture, the value of ``arch`` must match
212+
the value of :py:func:`platform.machine()` on the system. To indicate
213+
support multiple architectures, the ``arch`` tag should be an identifier from
214+
the following list that describes the set of supported architectures:
215+
216+
============== ========================================
217+
``arch`` Architectures supported
218+
============== ========================================
219+
``universal2`` ``arm64``, ``x86_64``
220+
``universal`` ``i386``, ``ppc``, ``ppc64``, ``x86_64``
221+
``intel`` ``i386``, ``x86_64``
222+
``fat`` ``i386``, ``ppc``
223+
``fat3`` ``i386``, ``ppc``, ``x86_64``
224+
``fat64`` ``ppc64``, ``x86_64``
225+
============== ========================================
226+
227+
The minimum supported macOS version may also be constrained by architecture. For
228+
example, macOS 11 (Big Sur) was the first release to support arm64. These
229+
additional constraints are enforced transparently by the macOS compilation
230+
toolchain when building binaries that support multiple architectures.
231+
232+
.. _android:
233+
234+
Android
235+
-------
236+
237+
Android uses the schema :file:`android_{apilevel}_{abi}`, indicating
238+
compatibility with the given Android API level or later, on the given ABI. For
239+
example, ``android_27_arm64_v8a`` indicates support for API level 27 or later,
240+
on ``arm64_v8a`` devices. Android makes no distinction between physical devices
241+
and emulated devices.
242+
243+
The API level should be a positive integer. This is *not* the same thing as
244+
the user-facing Android version. For example, the release known as Android
245+
12 (code named "Snow Cone") uses API level 31 or 32, depending on the specific
246+
Android version in use. Android's release documentation contains the `full list
247+
of Android versions and their corresponding API levels
248+
<https://developer.android.com/tools/releases/platforms>`__.
249+
250+
There are 4 `supported ABIs <https://developer.android.com/ndk/guides/abis>`__.
251+
Normalized according to the rules above, they are:
252+
253+
* ``armeabi_v7a``
254+
* ``arm64_v8a``
255+
* ``x86``
256+
* ``x86_64``
257+
258+
Virtually all current physical devices use one of the ARM architectures. ``x86``
259+
and ``x86_64`` are supported for use in the emulator. ``x86`` has not been
260+
supported as a development platform since 2020, and no new emulator images have
261+
been released since then.
262+
263+
.. _ios:
264+
265+
iOS
266+
---
267+
268+
iOS uses the schema :file:`ios_{x}_{y}_{arch}_{sdk}`, indicating compatibility with
269+
iOS ``x.y`` or later, on the ``arch`` architecture, using the ``sdk`` SDK.
270+
271+
The value of ``x`` and ``y`` correspond to the major and minor version number of
272+
the iOS release, respectively. They must both be positive integers. The version
273+
number always includes a major *and* minor version, even if Apple's official
274+
version numbering only refers to the major value. For example, a
275+
``ios_13_0_arm64_iphonesimulator`` indicates compatibility with iOS 13 or later.
276+
277+
The value of ``arch`` must match the value of :py:func:`platform.machine()` on
278+
the system.
279+
280+
The value of ``sdk`` must be either ``iphoneos`` (for physical devices), or
281+
``iphonesimulator`` (for device simulators). These SDKs have the same API
282+
surface, but are incompatible at the binary level, even if they are running on
283+
the same CPU architecture. Code compiled for an arm64 simulator will not run on
284+
an arm64 device.
285+
286+
The combination of :file:`{arch}_{sdk}` is referred to as the "multiarch". There
287+
are three possible values for multiarch:
288+
289+
* ``arm64_iphoneos``, for physical iPhone/iPad devices. This includes every
290+
iOS device manufactured since ~2015;
291+
* ``arm64_iphonesimulator``, for simulators running on Apple Silicon macOS
292+
hardware; and
293+
* ``x86_64_iphonesimulator``, for simulators running on x86_64 hardware.
192294

193295
Use
194296
===
@@ -339,7 +441,8 @@ History
339441
- November 2019: The ``manylinux_x_y`` perennial tag was approved through
340442
:pep:`600`.
341443
- April 2021: The ``musllinux_x_y`` tag was approved through :pep:`656`.
342-
444+
- December 2023: The tags for iOS were approved through :pep:`730`.
445+
- March 2024: The tags for Android were approved through :pep:`738`.
343446

344447

345448
.. _musl: https://musl.libc.org

0 commit comments

Comments
 (0)