Skip to content

Commit 207110a

Browse files
authored
convert README from .rst to .md (#306)
1 parent 162523d commit 207110a

File tree

2 files changed

+168
-154
lines changed

2 files changed

+168
-154
lines changed

README.md

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
# Python Apple Support
2+
3+
This is a meta-package for building a version of Python that can be
4+
embedded into a macOS, iOS, tvOS, watchOS, or visionOS project.
5+
6+
**This branch builds a packaged version of Python 3.14**. Other Python
7+
versions are available by cloning other branches of the main repository:
8+
9+
- [Python 3.9](https://github.com/beeware/Python-Apple-support/tree/3.9)
10+
- [Python
11+
3.10](https://github.com/beeware/Python-Apple-support/tree/3.10)
12+
- [Python
13+
3.11](https://github.com/beeware/Python-Apple-support/tree/3.11)
14+
- [Python
15+
3.12](https://github.com/beeware/Python-Apple-support/tree/3.12)
16+
- [Python
17+
3.13](https://github.com/beeware/Python-Apple-support/tree/3.13)
18+
19+
It works by downloading, patching, and building a fat binary of Python
20+
and selected pre-requisites, and packaging them as frameworks that can
21+
be incorporated into an Xcode project. The binary modules in the Python
22+
standard library are distributed as binaries that can be dynamically
23+
loaded at runtime.
24+
25+
The macOS package is a re-bundling of the official macOS binary,
26+
modified so that it is relocatable, with the IDLE, Tkinter and turtle
27+
packages removed, and the App Store compliance patch applied.
28+
29+
The iOS, tvOS, watchOS, and visionOS packages compiled by this project
30+
use the official [PEP 730](https://peps.python.org/pep-0730/) code that
31+
is part of Python 3.13 to provide iOS support; the relevant patches have
32+
been backported to 3.9-3.12. Additional patches have been applied to add
33+
tvOS, watchOS, and visionOS support.
34+
35+
The binaries support x86_64 and arm64 for macOS; arm64 for iOS and
36+
appleTV devices; arm64_32 for watchOS devices; and arm64 for visionOS
37+
devices. It also supports device simulators on both x86_64 and M1
38+
hardware, except for visionOS, for which x86_64 simulators are
39+
officially unsupported. This should enable the code to run on:
40+
41+
- macOS 11 (Big Sur) or later, on:
42+
- MacBook (including MacBooks using Apple Silicon)
43+
- iMac (including iMacs using Apple Silicon)
44+
- Mac Mini (including Apple Silicon Mac minis)
45+
- Mac Studio (all models)
46+
- Mac Pro (all models)
47+
48+
- iOS 13.0 or later, on:
49+
- iPhone (6s or later)
50+
- iPad (5th gen or later)
51+
- iPad Air (all models)
52+
- iPad Mini (2 or later)
53+
- iPad Pro (all models)
54+
- iPod Touch (7th gen or later)
55+
56+
- tvOS 12.0 or later, on:
57+
- Apple TV (4th gen or later)
58+
59+
- watchOS 4.0 or later, on:
60+
- Apple Watch (4th gen or later)
61+
62+
- visionOS 2.0 or later, on:
63+
- Apple Vision Pro
64+
65+
## Quickstart
66+
67+
The easist way to use these packages is by creating a project with
68+
[Briefcase](https://github.com/beeware/briefcase). Briefcase will
69+
download pre-compiled versions of these support packages, and add them
70+
to an Xcode project (or pre-build stub application, in the case of
71+
macOS).
72+
73+
Pre-built versions of the frameworks can be downloaded from the [Github
74+
releases page](https://github.com/beeware/Python-Apple-support/releases)
75+
and added to your project.
76+
77+
Alternatively, to build the frameworks on your own, download/clone this
78+
repository, and then in the root directory, and run:
79+
80+
- `make` (or `make all`) to build everything.
81+
- `make macOS` to build everything for macOS.
82+
- `make iOS` to build everything for iOS.
83+
- `make tvOS` to build everything for tvOS.
84+
- `make watchOS` to build everything for watchOS.
85+
- `make visionOS` to build everything for visionOS.
86+
87+
This should:
88+
89+
1. Download the original source packages
90+
2. Patch them as required for compatibility with the selected OS
91+
3. Build the packages as Xcode-compatible XCFrameworks.
92+
93+
The resulting support packages will be packaged as `.tar.gz` files in
94+
the `dist` folder.
95+
96+
Each support package contains:
97+
98+
- `VERSIONS`, a text file describing the specific versions of code used
99+
to build the support package;
100+
- `Python.xcframework`, a multi-architecture build of the Python runtime
101+
library.
102+
103+
On iOS/tvOS/watchOS/visionOS, the `Python.xcframework` contains a slice
104+
for each supported ABI (device and simulator). The folder containing the
105+
slice can also be used as a `PYTHONHOME`, as it contains a `bin`,
106+
`include` and `lib` directory.
107+
108+
The `bin` folder does not contain Python executables (as they can't be
109+
invoked). However, it *does* contain shell aliases for the compilers
110+
that are needed to build packages. This is required because Xcode uses
111+
the `xcrun` alias to dynamically generate the name of binaries, but a
112+
lot of C tooling expects that `CC` will not contain spaces.
113+
114+
Each slice of an iOS/tvOS/watchOS/visionOS XCframework also contains a
115+
`platform-config` folder with a subfolder for each supported
116+
architecture in that slice. These subfolders can be used to make a macOS
117+
Python environment behave as if it were on an iOS/tvOS/watchOS/visionOS
118+
device. This works in one of two ways:
119+
120+
1. **A sitecustomize.py script**. If the `platform-config` subfolder is
121+
on your `PYTHONPATH` when a Python interpreter is started, a site
122+
customization will be applied that patches methods in `sys`,
123+
`sysconfig` and `platform` that are used to identify the system.
124+
2. **A make_cross_venv.py script**. If you call `make_cross_venv.py`,
125+
providing the location of a virtual environment, the script will add
126+
some files to the `site-packages` folder of that environment that
127+
will automatically apply the same set of patches as the
128+
`sitecustomize.py` script whenever the environment is activated,
129+
without any need to modify `PYTHONPATH`. If you use `build` to
130+
create an isolated PEP 517 environment to build a wheel, these
131+
patches will also be applied to the isolated build environment that
132+
is created.
133+
134+
iOS and visionOS distributions also contain a copy of the iOS or
135+
visionOS `testbed` project - an Xcode project that can be used to run
136+
test suites of Python code. See the [CPython documentation on testing
137+
packages](https://docs.python.org/3/using/ios.html#testing-a-python-package)
138+
for details on how to use this testbed.
139+
140+
For a detailed instructions on using the support package in your own
141+
project, see the [usage guide](./USAGE.md)
142+
143+
## Building binary wheels
144+
145+
This project packages the Python standard library, but does not address
146+
building binary wheels. Binary wheels for macOS can be obtained from
147+
PyPI. [Mobile Forge](https://github.com/beeware/mobile-forge) is a
148+
project that provides the tooling to build build binary wheels for iOS
149+
(and potentially for tvOS, watchOS, and visionOS, although that hasn't
150+
been tested).
151+
152+
## Historical support
153+
154+
The following versions were supported in the past, but are no longer
155+
maintained:
156+
157+
- [Python 2.7](https://github.com/beeware/Python-Apple-support/tree/2.7)
158+
(EOL January 2020)
159+
- [Python 3.4](https://github.com/beeware/Python-Apple-support/tree/3.4)
160+
(EOL March 2019)
161+
- [Python 3.5](https://github.com/beeware/Python-Apple-support/tree/3.5)
162+
(EOL February 2021)
163+
- [Python 3.6](https://github.com/beeware/Python-Apple-support/tree/3.6)
164+
(EOL December 2021)
165+
- [Python 3.7](https://github.com/beeware/Python-Apple-support/tree/3.7)
166+
(EOL September 2022)
167+
- [Python 3.8](https://github.com/beeware/Python-Apple-support/tree/3.8)
168+
(EOL October 2024)

README.rst

Lines changed: 0 additions & 154 deletions
This file was deleted.

0 commit comments

Comments
 (0)