Skip to content

Commit 515625c

Browse files
authored
visionOS Support and Other Fixes (#276)
Add documentation for visionOS support.
1 parent 344aaf6 commit 515625c

File tree

2 files changed

+32
-25
lines changed

2 files changed

+32
-25
lines changed

README.rst

+25-19
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Python Apple Support
22
====================
33

44
This is a meta-package for building a version of Python that can be embedded
5-
into a macOS, iOS, tvOS or watchOS project.
5+
into a macOS, iOS, tvOS, watchOS, or visionOS project.
66

77
**This branch builds a packaged version of Python 3.14**.
88
Other Python versions are available by cloning other branches of the main
@@ -16,21 +16,24 @@ repository:
1616

1717
It works by downloading, patching, and building a fat binary of Python and
1818
selected pre-requisites, and packaging them as frameworks that can be
19-
incorporated into an XCode project. The binary modules in the Python standard
19+
incorporated into an Xcode project. The binary modules in the Python standard
2020
library are distributed as binaries that can be dynamically loaded at runtime.
2121

2222
The macOS package is a re-bundling of the official macOS binary, modified so that
2323
it is relocatable, with the IDLE, Tkinter and turtle packages removed, and the
2424
App Store compliance patch applied.
2525

26-
The iOS, tvOS and watchOS packages compiled by this project use the official
27-
`PEP 730 <https://peps.python.org/pep-0730/>`__ code that is part of Python 3.13
28-
to provide iOS support; the relevant patches have been backported to 3.9-3.12.
29-
Additional patches have been applied to add tvOS and watchOS support.
26+
The iOS, tvOS, watchOS, and visionOS packages compiled by this project use the
27+
official `PEP 730 <https://peps.python.org/pep-0730/>`__ code that is part of
28+
Python 3.13 to provide iOS support; the relevant patches have been backported
29+
to 3.9-3.12. Additional patches have been applied to add tvOS, watchOS, and
30+
visionOS support.
3031

3132
The binaries support x86_64 and arm64 for macOS; arm64 for iOS and appleTV
32-
devices; and arm64_32 for watchOS devices. It also supports device simulators on
33-
both x86_64 and M1 hardware. This should enable the code to run on:
33+
devices; arm64_32 for watchOS devices; and arm64 for visionOS devices. It also
34+
supports device simulators on both x86_64 and M1 hardware, except for visionOS,
35+
for which x86_64 simulators are officially unsupported. This should enable the
36+
code to run on:
3437

3538
* macOS 11 (Big Sur) or later, on:
3639
* MacBook (including MacBooks using Apple Silicon)
@@ -49,6 +52,8 @@ both x86_64 and M1 hardware. This should enable the code to run on:
4952
* Apple TV (4th gen or later)
5053
* watchOS 4.0 or later, on:
5154
* Apple Watch (4th gen or later)
55+
* visionOS 2.0 or later, on:
56+
* Apple Vision Pro
5257

5358
Quickstart
5459
----------
@@ -69,23 +74,24 @@ repository, and then in the root directory, and run:
6974
* ``make iOS`` to build everything for iOS.
7075
* ``make tvOS`` to build everything for tvOS.
7176
* ``make watchOS`` to build everything for watchOS.
77+
* ``make visionOS`` to build everything for visionOS.
7278

7379
This should:
7480

7581
1. Download the original source packages
7682
2. Patch them as required for compatibility with the selected OS
7783
3. Build the packages as Xcode-compatible XCFrameworks.
7884

79-
The resulting support packages will be packaged as a ``.tar.gz`` file
85+
The resulting support packages will be packaged as ``.tar.gz`` files
8086
in the ``dist`` folder.
8187

8288
Each support package contains:
8389

8490
* ``VERSIONS``, a text file describing the specific versions of code used to build the
8591
support package;
86-
* ``Python.xcframework``, a multi-architecture build of the Python runtime library
92+
* ``Python.xcframework``, a multi-architecture build of the Python runtime library.
8793

88-
On iOS/tvOS/watchOS, the ``Python.xcframework`` contains a
94+
On iOS/tvOS/watchOS/visionOS, the ``Python.xcframework`` contains a
8995
slice for each supported ABI (device and simulator). The folder containing the
9096
slice can also be used as a ``PYTHONHOME``, as it contains a ``bin``, ``include``
9197
and ``lib`` directory.
@@ -96,11 +102,11 @@ needed to build packages. This is required because Xcode uses the ``xcrun``
96102
alias to dynamically generate the name of binaries, but a lot of C tooling
97103
expects that ``CC`` will not contain spaces.
98104

99-
Each slice of an iOS/tvOS/watchOS XCframework also contains a
105+
Each slice of an iOS/tvOS/watchOS/visionOS XCframework also contains a
100106
``platform-config`` folder with a subfolder for each supported architecture in
101107
that slice. These subfolders can be used to make a macOS Python environment
102-
behave as if it were on an iOS/tvOS/watchOS device. This works in one of two
103-
ways:
108+
behave as if it were on an iOS/tvOS/watchOS/visionOS device. This works in one
109+
of two ways:
104110

105111
1. **A sitecustomize.py script**. If the ``platform-config`` subfolder is on
106112
your ``PYTHONPATH`` when a Python interpreter is started, a site
@@ -116,9 +122,9 @@ ways:
116122
environment to build a wheel, these patches will also be applied to the
117123
isolated build environment that is created.
118124

119-
iOS distributions also contain a copy of the iOS ``testbed`` project - an Xcode
120-
project that can be used to run test suites of Python code. See the `CPython
121-
documentation on testing packages
125+
iOS and visionOS distributions also contain a copy of the iOS or visionOS
126+
``testbed`` project - an Xcode project that can be used to run test suites of
127+
Python code. See the `CPython documentation on testing packages
122128
<https://docs.python.org/3/using/ios.html#testing-a-python-package>`__ for
123129
details on how to use this testbed.
124130

@@ -131,8 +137,8 @@ Building binary wheels
131137
This project packages the Python standard library, but does not address building
132138
binary wheels. Binary wheels for macOS can be obtained from PyPI. `Mobile Forge
133139
<https://github.com/beeware/mobile-forge>`__ is a project that provides the
134-
tooling to build build binary wheels for iOS (and potentially for tvOS and
135-
watchOS, although that hasn't been tested).
140+
tooling to build build binary wheels for iOS (and potentially for tvOS, watchOS,
141+
and visionOS, although that hasn't been tested).
136142

137143
Historical support
138144
------------------

USAGE.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
## The easy way
44

5-
The easist way to use these packages is by creating a project with `Briefcase
6-
<https://github.com/beeware/briefcase>`__. Briefcase will download pre-compiled
7-
versions of these support packages, and add them to an Xcode project (or
8-
pre-build stub application, in the case of macOS).
5+
The easist way to use these packages is by creating a project with
6+
(Briefcase)[https://github.com/beeware/briefcase]. Briefcase will download
7+
pre-compiled versions of these support packages, and add them to an Xcode project
8+
(or pre-build stub application, in the case of macOS).
99

1010
## The manual way
1111

@@ -22,8 +22,9 @@ guides:
2222
* [macOS](https://docs.python.org/3/using/mac.html)
2323
* [iOS](https://docs.python.org/3/using/ios.html#adding-python-to-an-ios-project)
2424

25-
For tvOS and watchOS, you should be able to broadly follow the instructions in
26-
the iOS guide.
25+
For tvOS, watchOS, and visionOS, you should be able to broadly follow the instructions
26+
in the iOS guide. The testbed projects generated on iOS and visionOS may be used as
27+
rough references as well.
2728

2829
### Using Objective C
2930

0 commit comments

Comments
 (0)