@@ -10,9 +10,11 @@ into a macOS, iOS, tvOS or watchOS project.
10
10
11
11
It works by downloading, patching, and building a fat binary of Python and
12
12
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.
14
16
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:
16
18
* dbm.gnu
17
19
* tkinter
18
20
* readline
@@ -23,7 +25,11 @@ It exposed *almost* all the modules in the Python standard library except for:
23
25
The following standard library modules are available on macOS, but not the other
24
26
Apple platforms:
25
27
* curses
28
+ * grp
29
+ * multiprocessing
26
30
* posixshmem
31
+ * posixsubprocess
32
+ * syslog
27
33
28
34
The binaries support x86_64 and arm64 for macOS; arm64 for iOS and appleTV
29
35
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:
35
41
* Mac Mini (including M1 Apple Silicon Mac minis)
36
42
* Mac Studio (all models)
37
43
* Mac Pro (all models)
38
- * iOS 13 .0 or later, on:
44
+ * iOS 12 .0 or later, on:
39
45
* iPhone (6s or later)
40
46
* iPad (5th gen or later)
41
47
* iPad Air (all models)
@@ -48,6 +54,11 @@ x86_64 and M1 hardware. This should enable the code to run on:
48
54
Quickstart
49
55
----------
50
56
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
+
51
62
Pre-built versions of the frameworks can be downloaded `for macOS `_, `for
52
63
iOS `_, `for tvOS `_, and `for watchOS `_, and added to your project.
53
64
@@ -66,8 +77,47 @@ This should:
66
77
2. Patch them as required for compatibility with the selected OS
67
78
3. Build the packages as XCode-compatible XCFrameworks.
68
79
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.
71
121
72
122
.. _for macOS : https://briefcase-support.org/python?platform=macOS&version=3.11
73
123
.. _for iOS : https://briefcase-support.org/python?platform=iOS&version=3.11
0 commit comments