Skip to content

Commit 5feac32

Browse files
authored
Finalize PEP 730, and add iOS to PEP 11 (#3761)
1 parent 8d09efe commit 5feac32

File tree

2 files changed

+59
-32
lines changed

2 files changed

+59
-32
lines changed

peps/pep-0011.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ Tier 3
122122
Target Triple Notes Contacts
123123
================================ =========================== ========
124124
aarch64-pc-windows-msvc Steve Dower
125+
arm64-apple-ios iOS on device Ned Deily
126+
arm64-apple-ios-simulator iOS on M1 macOS simulator Ned Deily
125127
armv7l-unknown-linux-gnueabihf Raspberry Pi OS, glibc, gcc Gregory P. Smith
126128
powerpc64le-unknown-linux-gnu glibc, clang Victor Stinner
127129

peps/pep-0730.rst

Lines changed: 57 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Title: Adding iOS as a supported platform
33
Author: Russell Keith-Magee <[email protected]>
44
Sponsor: Ned Deily <[email protected]>
55
Discussions-To: https://discuss.python.org/t/pep730-adding-ios-as-a-supported-platform/35854
6-
Status: Accepted
6+
Status: Final
77
Type: Standards Track
88
Content-Type: text/x-rst
99
Created: 09-Oct-2023
@@ -170,9 +170,9 @@ devices.
170170

171171
``sys.implementation._multiarch`` will describe the ABI and CPU architecture:
172172

173-
* ``"iphoneos-arm64"`` for ARM64 devices
174-
* ``"iphonesimulator-arm64"`` for ARM64 simulators
175-
* ``"iphonesimulator-x86_64"`` for x86_64 simulators
173+
* ``"arm64-iphoneos"`` for ARM64 devices
174+
* ``"arm64-iphonesimulator"`` for ARM64 simulators
175+
* ``"x86_64-iphonesimulator"`` for x86_64 simulators
176176

177177
``platform``
178178
''''''''''''
@@ -181,7 +181,8 @@ devices.
181181
the values returned by the ``platform`` module will match those returned by
182182
``os.uname()``, with the exception of:
183183

184-
* ``platform.system()`` - ``"iOS"``, instead of the default ``"Darwin"``
184+
* ``platform.system()`` - ``"iOS"`` or ``iPadOS`` (depending on the hardware in
185+
use), instead of ``"Darwin"``
185186

186187
* ``platform.release()`` - the iOS version number, as a string (e.g.,
187188
``"16.6.1"``), instead of the Darwin kernel version.
@@ -190,11 +191,11 @@ In addition, a ``platform.ios_ver()`` method will be added. This mirrors
190191
``platform.mac_ver()``, which can be used to provide macOS version information.
191192
``ios_ver()`` will return a namedtuple that contains the following:
192193

194+
* ``system`` - the OS name (``iOS`` or ``iPadOS``, depending on hardware)
193195
* ``release`` - the iOS version, as a string (e.g., ``"16.6.1"``).
194-
* ``min_release`` - the minimum supported iOS version, as a string (e.g.,
195-
``"12.0"``)
196196
* ``model`` - the model identifier of the device, as a string (e.g.,
197-
``"iPhone13,2"``). On simulators, this will return ``"iPhoneSimulator"``.
197+
``"iPhone13,2"``). On simulators, this will return ``"iPhone"`` or ``"iPad"``,
198+
depending on the simulator device.
198199
* ``is_simulator`` - a boolean indicating if the device is a simulator.
199200

200201
``os``
@@ -214,7 +215,7 @@ This approach treats the ``os`` module as a "raw" interface to system APIs, and
214215
'''''''''''''
215216

216217
The ``sysconfig`` module will use the minimum iOS version as part of
217-
``sysconfig.get_platform()`` (e.g., ``"ios-12.0-iphoneos-arm64"``). The
218+
``sysconfig.get_platform()`` (e.g., ``"ios-12.0-arm64-iphoneos"``). The
218219
``sysconfigdata_name`` and Config makefile will follow the same patterns as
219220
existing platforms (using ``sys.platform``, ``sys.implementation._multiarch``
220221
etc.) to construct identifiers.
@@ -238,7 +239,7 @@ into a Framework location. This finder will only be installed if ``sys.platform
238239
This finder will convert a Python module name (e.g., ``foo.bar._whiz``) into a
239240
unique Framework name by using the full module name as the framework name (i.e.,
240241
``foo.bar._whiz.framework``). A framework is a directory; the finder will look
241-
for ``_whiz.dylib`` in that directory.
242+
for a binary named ``foo.bar._whiz`` in that directory.
242243

243244
Compilation
244245
-----------
@@ -302,16 +303,16 @@ provided for each ABI-arch combination.
302303

303304
iOS wheels will use tags:
304305

305-
* ``ios_12_0_iphoneos_arm64``
306-
* ``ios_12_0_iphonesimulator_arm64``
307-
* ``ios_12_0_iphonesimulator_x86_64``
306+
* ``ios_12_0_arm64_iphoneos``
307+
* ``ios_12_0_arm64_iphonesimulator``
308+
* ``ios_12_0_x86_64_iphonesimulator``
308309

309310
In these tags, "12.0" is the minimum supported iOS version. As with macOS, the
310311
tag will incorporate the minimum iOS version that is selected when the wheel is
311312
compiled; a wheel compiled with a minimum iOS version of 15.0 would use the
312-
``ios_15_0_iphone*`` tags. At time of writing, iOS 12.0 exposes most significant
313-
iOS features, while reaching near 100% of devices; this will be used as a floor
314-
for iOS version matching.
313+
``ios_15_0_*`` tags. At time of writing, iOS 12.0 exposes most significant iOS
314+
features, while reaching near 100% of devices; this will be used as a floor for
315+
iOS version matching.
315316

316317
These wheels can include binary modules in-situ (i.e., co-located with the
317318
Python source, in the same way as wheels for a desktop platform); however, they
@@ -322,14 +323,18 @@ build step.
322323
PEP 11 Update
323324
-------------
324325

325-
:pep:`11` will be updated to include the three iOS ABIs:
326+
:pep:`11` will be updated to include two of the iOS ABIs:
326327

327-
* ``aarch64-apple-ios``
328-
* ``aarch64-apple-ios-simulator``
329-
* ``x86_64-apple-ios-simulator``
328+
* ``arm64-apple-ios``
329+
* ``arm64-apple-ios-simulator``
330330

331331
Ned Deily will serve as the initial core team contact for these ABIs.
332332

333+
The ``x86_64-apple-ios-simulator`` target will be supported on a best-effort
334+
basis, but will not be targeted for tier 3 support. This is due to the impending
335+
deprecation of x86_64 as a simulation platform, combined with the difficulty of
336+
commissioning x86_64 macOS hardware at this time.
337+
333338
Backwards Compatibility
334339
=======================
335340

@@ -436,6 +441,8 @@ The decision was made to use ``arm64-apple-ios`` and
436441
5. While *some* iOS packages will use Rust, *all* iOS packages will use Apple's
437442
tooling.
438443

444+
The initially accepted version of this document used the ``aarch64`` form as the PEP 11 identifier; this was corrected during finalization.
445+
439446
"Universal" wheel format
440447
------------------------
441448

@@ -523,21 +530,16 @@ involve building a very specific user-facing app that would be closer to an
523530
IDLE-style IDE experience. Therefore, the decision was made to only focus on
524531
"embedded mode" as a target for mobile distribution.
525532

526-
Open Issues
527-
===========
528-
529-
x86_64 buildbot availability
530-
----------------------------
533+
x86_64 simulator support
534+
------------------------
531535

532536
Apple no longer sells x86_64 hardware. As a result, commissioning an x86_64
533-
buildbot may not be possible. It is possible to run macOS binaries in x86_64
537+
buildbot can be difficult. It is possible to run macOS binaries in x86_64
534538
compatibility mode on ARM64 hardware; however, this isn't ideal for testing
535-
purposes.
536-
537-
If native x86_64 Mac hardware cannot be sourced for buildbot purposes, it may be
538-
necessary to exclude the x86_64 simulator platform in Tier 3. Given the
539-
anticipated deprecation of x86_64 as a macOS development platform, this doesn't
540-
pose a significant impediment to adoption or long term maintenance.
539+
purposes. Therefore, the x86_64 Simulator (``x86_64-apple-ios-simulator``) will
540+
not be added as a Tier 3 target. It is highly likely that iOS support will work
541+
on the x86_64 without any modification; this only impacts on the *official* Tier
542+
3 status.
541543

542544
On-device testing
543545
-----------------
@@ -551,6 +553,29 @@ Cloud solution doesn't provide on-device testing. They rely on the fact that the
551553
API is consistent between device and simulator, and ARM64 simulator testing is
552554
sufficient to reveal CPU-specific issues.
553555

556+
Ordering of ``_multiarch`` tags
557+
-------------------------------
558+
559+
The initially accepted version of this document used ``<platform>-<arch>``
560+
ordering (e.g., ``iphoneos-arm64``) for ``sys.implementation._multiarch`` (and
561+
related values, such as wheel tags). The final merged version uses the
562+
``<arch>-<platform>`` ordering (e.g., ``arm64-iphoneos``). This is for
563+
consistency with compiler triples on other platforms (especially Linux), which
564+
specify the architecture before the operating system.
565+
566+
Values returned by ``platform.ios_ver()``
567+
-----------------------------------------
568+
569+
The initially accepted version of this document didn't include a ``system``
570+
identifier. This was added during the implementation phase to support the implementation of ``platform.system()``.
571+
572+
The initially accepted version of this document also described that
573+
``min_release`` would be returned in the ``ios_ver()`` result. The final version
574+
omits the ``min_release`` value, as it is not significant at runtime; it only
575+
impacts on binary compatibility. The minimum version *is* included in the value
576+
returned by ``sysconfig.get_platform()``, as this is used to define wheel (and
577+
other binary) compatibility.
578+
554579
Copyright
555580
=========
556581

0 commit comments

Comments
 (0)