Text of peps.python.org › pep-0730 as Styx crawled it on Oct 13, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

PEP 730 – Adding iOS as a supported platform | peps.python.org

PEP 730 – Adding iOS as a supported platform PEP 730 – Adding iOS as a supported platform Author : Russell Keith-Magee <russell at keith-magee.com> Sponsor : Ned Deily <nad at python.org> Discussions-To : Discourse thread Status : Final Type : Standards Track Created : 09-Oct-2023 Python-Version : 3.13 Resolution : Discourse message Table of Contents Abstract Motivation Rationale Development landscape POSIX compliance Dynamic libraries Console and interactive usage Specification Platform identification sys platform os sysconfig Subprocess support Dynamic module loading Compilation Distribution CI resources Packaging PEP 11 Update Backwards Compatibility Security Implications How to Teach This Reference Implementation Rejected Ideas Simulator identification GNU compiler triples “Universal” wheel format Supporting static builds Interactive/REPL mode x86_64 simulator support On-device testing Ordering of _multiarch tags Values returned by platform.ios_ver() Copyright Important This PEP is a historical document.

The up-to-date, canonical documentation can now be found at Using Python on iOS . × See PEP 1 for how to propose changes. Abstract This PEP proposes adding iOS as a supported platform in CPython. The initial goal is to achieve Tier 3 support for Python 3.13. This PEP describes the technical aspects of the changes that are required to support iOS. It also describes the project management concerns related to adoption of iOS as a Tier 3 platform.

Motivation Over the last 15 years, mobile platforms have become increasingly important parts of the computing landscape. iOS is one of two operating systems that control the vast majority of these devices. However, there is no official support for iOS in CPython. The BeeWare Project and Kivy have both supported iOS for almost 10 years. This support has been able to generate applications that have been accepted for publication in the iOS App Store.

This demonstrates the technical feasibility of iOS support. It is important for the future of Python as a language that it is able to be used on any hardware or OS that has widespread adoption. If Python cannot be used a on a platform that has widespread use, adoption of the language will be impacted as potential users will adopt other languages that do provide support for these platforms. Rationale Development landscape iOS provides a single API, but 2 distinct ABIs - iphoneos (physical devices), and iphonesimulator .

Each of these ABIs can be provided on multiple CPU architectures. At time of writing, Apple officially supports arm64 on the device ABI, and arm64 and x86_64 are supported on the simulator ABI. As with macOS, iOS supports the creation of “fat” binaries that contains multiple CPU architectures. However, fat binaries cannot span ABIs. That is, it is possible to have a fat simulator binary, and a fat device binary, but it is not possible to create a single fat “iOS” binary that covers both simulator and device needs.

To support distribution of a single development artefact, Apple uses an “XCframework” structure - a wrapper around multiple ABIs that implement a common API. iOS runs on a Darwin kernel, similar to macOS. However, there is a need to differentiate between macOS and iOS at an implementation level, as there are significant platform differences between iOS and macOS. iOS code is compiled for compatibility against a minimum iOS version.

Apple frequently refers to “iPadOS” in their marketing material. However, from a development perspective, there is no discernable difference between iPadOS and iOS. A binary that has been compiled for the iphoneos or iphonesimulator ABIs can be deployed on iPad. Other Apple platforms, such as tvOS, watchOS, and visionOS, use different ABIs, and are not covered by this PEP. POSIX compliance iOS is broadly a POSIX platform.

However, similar to WASI/Emscripten, there are POSIX APIs that exist on iOS, but cannot be used; and POSIX APIs that don’t exist at all. Most notable of these is the fact that iOS does not provide any form of multiprocess support. fork and spawn both exist in the iOS API; however, if they are invoked, the invoking iOS process stops, and the new process doesn’t start. Unlike WASI/Emscripten, threading is supported on iOS.

There are also significant limits to socket handling. Due to process sandboxing, there is no availability of interprocess communication via socket. However, sockets for network communication are available. Dynamic libraries The iOS App Store guidelines allow apps to be written in languages other than Objective C or Swift. However, they have very strict guidelines about the structure of apps that are submitted for distribution. iOS apps can use dynamically loaded libraries; however, there are very strict requirements on how dynamically loaded content is packaged for use on iOS: Dynamic binary content must be compiled as dynamic libraries, not shared objects or binary bundles.

They must be packaged in the app bundle as Frameworks. Each Framework can only contain a single dynamic library. The Framework must be contained in the iOS App’s Frameworks folder. A Framework may not contain any non-library content. This imposes some constraints on the operation of CPython. It is not possible store binary modules in the lib-dynload and/or site-packages folders; they must be stored in the app’s Frameworks folder, with each module wrapped in a Framework.

This also means that the common assumption that a Python module can construct the location of a binary module by using the __file__ attribute of the Python module no longer holds. As with macOS, compiling a binary module that is accessible from a statically-linked build of Python requires the use of the --undefined dynamic_lookup option to avoid linking libpython3.x into every binary module. However, on iOS, this compiler flag raises a deprecation warning when it is used.

A warning from this flag has been observed on macOS as well - however, responses from Apple staff suggest that they do not intend to break the CPython ecosystem by removing this option . As Python does not currently have a notable presence on iOS, it is difficult to judge whether iOS usage of this flag would fall under the same umbrella. Console and interactive usage Distribution of a traditional CPython REPL or interactive “python.exe” should not be considered a goal of this work.

Mobile devices (including iOS) do not provide a TTY-style console. They do not provide stdin , stdout or stderr . iOS provides a system log, and it is possible to install a redirection so that all stdout and stderr content is redirected to the system log; but there is no analog for stdin . In addition, iOS places restrictions on downloading additional code at runtime (as this behavior would be functionally indistinguishable from trying to work around App Store review).

As a result, a traditional “create a virtual environment and pip install” development experience will not be viable on iOS. It is possible to build an native iOS application that provides a REPL interface. This would be closer to an IDLE-style user experience; however, Tkinter cannot be used on iOS, so any app would require a ground-up rewrite. The iOS app store already contains several examples of apps in this category (e.g., Pythonista and Pyto ).

The focus of this work would be to provide an embedded distribution that IDE-style native interfaces could utilize, not a user-facing “app” interface to iOS on Python. Specification Platform identification sys sys.platform will identify as "ios" on both simulator and physical devices. sys.implementation._multiarch will describe the ABI and CPU architecture: "arm64-iphoneos" for ARM64 devices "arm64-iphonesimulator" for ARM64 simulators "x86_64-iphonesimulator" for x86_64 simulators platform platform will be modified to support returning iOS-specific details.

Most of the values returned by the platform module will match those returned by os.

The rest of this page is on the live site.