Skip to content

Commit 5e2acc0

Browse files
committed
Updated README, including details on how to use the support packages.
1 parent 873a134 commit 5e2acc0

File tree

1 file changed

+55
-5
lines changed

1 file changed

+55
-5
lines changed

README.rst

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ into a macOS, iOS, tvOS or watchOS project.
1010

1111
It works by downloading, patching, and building a fat binary of Python and
1212
selected pre-requisites, and packaging them as static libraries that can be
13-
incorporated into an XCode project.
13+
incorporated into an XCode project. The binary modules in the Python standard
14+
library are statically compiled, but are distribted as ``.so`` objects that
15+
can be dynamically loaded at runtime.
1416

15-
It exposed *almost* all the modules in the Python standard library except for:
17+
It exposes *almost* all the modules in the Python standard library except for:
1618
* dbm.gnu
1719
* tkinter
1820
* readline
@@ -23,7 +25,11 @@ It exposed *almost* all the modules in the Python standard library except for:
2325
The following standard library modules are available on macOS, but not the other
2426
Apple platforms:
2527
* curses
28+
* grp
29+
* multiprocessing
2630
* posixshmem
31+
* posixsubprocess
32+
* syslog
2733

2834
The binaries support x86_64 and arm64 for macOS; arm64 for iOS and appleTV
2935
devices; and arm64_32 for watchOS. It also supports device simulators on both
@@ -35,7 +41,7 @@ x86_64 and M1 hardware. This should enable the code to run on:
3541
* Mac Mini (including M1 Apple Silicon Mac minis)
3642
* Mac Studio (all models)
3743
* Mac Pro (all models)
38-
* iOS 13.0 or later, on:
44+
* iOS 12.0 or later, on:
3945
* iPhone (6s or later)
4046
* iPad (5th gen or later)
4147
* iPad Air (all models)
@@ -48,6 +54,11 @@ x86_64 and M1 hardware. This should enable the code to run on:
4854
Quickstart
4955
----------
5056

57+
The easist way to use these packages is by creating a project with `Briefcase
58+
<https://github.com/beeware/briefcase>`__. Briefcase will download pre-compiled
59+
versions of these support packages, and add them to an XCode project (or
60+
pre-build stub application, in the case of macOS).
61+
5162
Pre-built versions of the frameworks can be downloaded `for macOS`_, `for
5263
iOS`_, `for tvOS`_, and `for watchOS`_, and added to your project.
5364

@@ -66,8 +77,47 @@ This should:
6677
2. Patch them as required for compatibility with the selected OS
6778
3. Build the packages as XCode-compatible XCFrameworks.
6879

69-
The build products will be in the `build` directory; the compiled frameworks
70-
will be in the `dist` directory.
80+
The resulting support packages will be packaged as a ``.tar.gz`` file
81+
in the ``dist`` folder.
82+
83+
Each support package contains:
84+
85+
* ``VERSIONS``, a text file describing the specific versions of code used to
86+
build the support package;
87+
* ``Python.xcframework``, a multi-architecture build of libPython3.11.a
88+
* ``python-stdlib``, the code and binary modules comprising the Python standard
89+
library. On iOS, tvOS and watchOS, there are 2 copies of every binary module -
90+
one for physical devices, and one for the simulator. The simulator binaries
91+
are "fat", containing code for both x86_64 and arm64.
92+
93+
To add a support package to your own Xcode project:
94+
95+
1. Drag ``Python.xcframework`` and ``python-stdlib`` into your Xcode project
96+
tree.
97+
2. Ensure that these two objects are added to any targets that need to use
98+
them;
99+
3. Add a custom build phase to purge any binary modules for the platform you are
100+
*not* targetting; and
101+
4. Add a custom build phase to sign any of the binary modules in your app.
102+
5. Add CPython API code to your app to create an instance of the Python
103+
interpreter.
104+
105+
For examples of the scripts needed for steps 3 and 4, and the code needed for
106+
step 5, compare with a project generated with Briefcase.
107+
108+
On macOS, you must also either:
109+
1. Enable the "Disable Library Validation" entitlement (found on the "Signing
110+
& Capabilities" tab in XCode); or
111+
2. Sign your app with a Development or Distribution certificate. This will
112+
require a paid Apple Developer subscription.
113+
114+
It is not possible to use an ad-hoc signing certificate with the "Disable
115+
Library Validation" entitlement disabled.
116+
117+
On iOS/tvOS/watchOS, you can use the default developer certificate for deploying
118+
to a device simulator. However, to deploy to a physical device (including your
119+
own), you will require a Development or Distribution certificate, which requires
120+
a paid Apple Developer subscription.
71121

72122
.. _for macOS: https://briefcase-support.org/python?platform=macOS&version=3.11
73123
.. _for iOS: https://briefcase-support.org/python?platform=iOS&version=3.11

0 commit comments

Comments
 (0)