• Stars
    star
    1,088
  • Rank 42,244 (Top 0.9 %)
  • Language Makefile
  • License
    MIT License
  • Created about 8 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A meta-package for building a version of Python that can be embedded into a macOS, iOS, tvOS or watchOS project.

Python Apple Support

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

This branch builds a packaged version of Python 3.11.0. Other Python versions are available by cloning other branches of the main repository:

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

It exposes almost all the modules in the Python standard library except for:
  • dbm.gnu
  • tkinter
  • readline
  • nis (Deprecated by PEP594)
  • ossaudiodev (Deprecated by PEP594)
  • spwd (Deprecated by PEP594)

The following standard library modules are available on macOS, but not the other Apple platforms:

  • curses
  • grp
  • multiprocessing
  • posixshmem
  • posixsubprocess
  • syslog

The binaries support x86_64 and arm64 for macOS; arm64 for iOS and appleTV devices; and arm64_32 for watchOS. It also supports device simulators on both x86_64 and M1 hardware. This should enable the code to run on:

  • macOS 10.15 (Catalina) or later, on:
    • MacBook (including MacBooks using Apple Silicon)
    • iMac (including iMacs using Apple Silicon)
    • Mac Mini (including M1 Apple Silicon Mac minis)
    • Mac Studio (all models)
    • Mac Pro (all models)
  • iOS 12.0 or later, on:
    • iPhone (6s or later)
    • iPad (5th gen or later)
    • iPad Air (all models)
    • iPad Mini (2 or later)
    • iPad Pro (all models)
    • iPod Touch (7th gen or later)
  • tvOS 9.0 or later, on Apple TV (4th gen or later)
  • watchOS 4.0 or later, on Apple Watch (4th gen or later)

Quickstart

The easist way to use these packages is by creating a project with Briefcase. Briefcase will download pre-compiled versions of these support packages, and add them to an XCode project (or pre-build stub application, in the case of macOS).

Pre-built versions of the frameworks can be downloaded for macOS, for iOS, for tvOS, and for watchOS, and added to your project.

Alternatively, to build the frameworks on your own, download/clone this repository, and then in the root directory, and run:

  • make (or make all) to build everything.
  • make macOS to build everything for macOS.
  • make iOS to build everything for iOS.
  • make tvOS to build everything for tvOS.
  • make watchOS to build everything for watchOS.

This should:

  1. Download the original source packages
  2. Patch them as required for compatibility with the selected OS
  3. Build the packages as XCode-compatible XCFrameworks.

The resulting support packages will be packaged as a .tar.gz file in the dist folder.

Each support package contains:

  • VERSIONS, a text file describing the specific versions of code used to build the support package;
  • Python.xcframework, a multi-architecture build of libPython3.11.a
  • python-stdlib, the code and binary modules comprising the Python standard library. On iOS, tvOS and watchOS, there are 2 copies of every binary module - one for physical devices, and one for the simulator. The simulator binaries are "fat", containing code for both x86_64 and arm64.

Non-macOS platforms also contain a platform-site folder. This contains a site customization script that can be used to make your local Python install look like it is an on-device install. This is needed because when you run pip you'll be on a macOS machine; if pip tries to install a binary package, it will install a macOS binary wheel (which won't work on iOS/tvOS/watchOS). However, if you add the platform-site folder to your PYTHONPATH when invoking pip, the site customization will make your Python install return platform and sysconfig responses consistent with on-device behavior, which will cause pip to install platform-appropriate packages.

For a detailed instructions on using the support package in your own project, see the usage guide

Building binary wheels

When building binary wheels, you may need to use the libraries built by this project as inputs (e.g., the cffi module uses libffi). To support this, this project is able to package these dependencies as "wheels" that can be added to the server/pypi/dist directory of the binary dependency builder project.

To build these wheels, run:

  • make wheels to make all wheels for all mobile platforms
  • make wheels-iOS to build all the iOS wheels
  • make wheels-tvOS to build all the tvOS wheels
  • make wheels-watchOS to build all the watchOS wheels

Historical support

The following versions were supported in the past, but are no longer maintained:

More Repositories

1

toga

A Python native, OS native GUI toolkit.
Python
4,236
star
2

briefcase

Tools to support converting a Python project into a standalone native application.
Python
2,536
star
3

batavia

A JavaScript implementation of the Python virtual machine.
JavaScript
1,394
star
4

voc

A transpiler that converts Python code into Java bytecode
Python
865
star
5

beeware

A meta-package simplifying the installation of the BeeWare suite of tools
832
star
6

beeware.github.io

🐍🐝
JavaScript
530
star
7

paying-the-piper

A project for discussing ways to fund open source development.
342
star
8

Python-iOS-template

A cookiecutter template for creating an iOS project running Python code.
301
star
9

ouroboros

A standalone, pure Python implementation of the Python Standard Library.
Python
292
star
10

rubicon-objc

A bridge interface between Python and Objective-C.
Python
263
star
11

bugjar

A interactive graphical debugger for Python code.
Python
247
star
12

cricket

A GUI tool for running Python test suites.
Python
209
star
13

podium

A Markdown-based native presentation tool
JavaScript
178
star
14

Python-Android-template

A cookiecutter template for creating an Android project running Python code.
159
star
15

colosseum

An implementation of the CSS layout algorithm.
Python
127
star
16

Python-Android-support

A meta-package for building a version of Python that can be embedded into an Android project.
Dockerfile
83
star
17

rubicon-java

A bridge interface between Python and Java.
Python
71
star
18

gbulb

GLib implementation of PEP 3156
Python
64
star
19

duvet

A GUI tool for visualizing coverage data.
Python
53
star
20

vscode-beeware

A Visual Studio Code extension with support for BeeWare development
TypeScript
47
star
21

briefcase-template

A cookiecutter template for a starter Briefcase project.
Python
42
star
22

rubicon

A collection of tools to bridge between Python and other language environments.
Python
40
star
23

yorkshire4

The classic Usborne computer programming books - now in Python!
Python
38
star
24

beekeeper

A Website to manage test and deploy processes
Python
30
star
25

beefore

Tools to run pre-merge checks on a pull request or commit.
Python
28
star
26

Python-macOS-template

A cookiecutter template for creating a standalone macOS project running Python code.
Shell
26
star
27

galley

A GUI tool for reviewing ReST/Sphinx documentation
Python
25
star
28

toga-chart

A matplotlib charting widget for Toga.
Python
24
star
29

briefcase-macOS-app-template

A template for generating macOS app projects with Briefcase
Python
23
star
30

slick

A native web-based client for Slack.
Python
22
star
31

briefcase-iOS-Xcode-template

A template for generating iOS Xcode projects with Briefcase
Objective-C
21
star
32

briefcase-linux-appimage-template

A template for generating Linux AppImage projects with Briefcase
Dockerfile
20
star
33

briefcase-android-gradle-template

A template for generating Android Gradle projects with Briefcase
Python
19
star
34

Python-Linux-support

A meta-package for building a version of Python that can be embedded into a Linux AppImage project.
Makefile
18
star
35

Python-tvOS-template

A cookiecutter template for creating a tvOS project running Python code.
Objective-C
16
star
36

mobile-forge

A tool to manage building cross-platform binary wheels for mobile devices
Python
15
star
37

travertino

A set of constants and utilities for describing user interfaces
Python
15
star
38

briefcase-macOS-Xcode-template

A template for generating an Xcode project for a macOS app using Briefcase
Objective-C
10
star
39

liquid-demo

A demonstration of a "standalone web app", written in Toga.
Python
9
star
40

briefcase-windows-msi-template

A template for generating Windows MSI projects with Briefcase
9
star
41

Python-Windows-template

A cookiecutter template for creating a Windows project running Python code.
Python
7
star
42

Python-OSX-template

A cookiecutter template for creating an OS/X app running Python code.
Shell
7
star
43

trebuchet

A tool to deploy websites.
7
star
44

std-nslog

A shim that redirects stderr/stdout to the Apple System Log (NSLog)
Python
7
star
45

Python-Linux-template

A cookiecutter template for creating a Linux project running Python code.
6
star
46

Python-support-testbed

A testbed app that can be used to validate BeeWare support packages.
Python
4
star
47

briefcase-windows-app-template

A template for generating Windows application projects with Briefcase
4
star
48

Python-Django-template

A cookiecutter template for creating a briefcase-Django project
3
star
49

.github

Community Health files for the BeeWare Project
Python
3
star
50

cpython-apple-source-deps

A meta-project for building the binary packages for iOS, tvOS and watchOS that a CPython build requires
Makefile
3
star
51

cpython-android-source-deps

Libraries that are needed to compile CPython for Android
Shell
3
star
52

briefcase-windows-VisualStudio-template

A template for generating Visual Studio projects for building Windows apps with Briefcase
C++
3
star
53

cookiecutter-website

A cookiecutter template for new pybee project websites.
CSS
2
star
54

legless-lizard

A setuptools mock of pythonnet.
Python
2
star
55

briefcase-linux-system-template

A template for generating Linux system packages with Briefcase
C
2
star
56

briefcase-linux-flatpak-template

A template for generating Linux Flatpak projects with Briefcase.
C
2
star
57

cpython-macOS-source-deps

A meta-project for building the binary packages for macOS that a CPython build requires
Makefile
2
star
58

pytest-briefcase

A pytest plugin for running tests of a Briefcase project.
Python
2
star
59

comb

A repository of BeeKeeper task configurations.
2
star
60

briefcase-linux-deb-template

A template for generating Linux .deb projects with Briefcase
C
1
star
61

lektor-gravatar

A Lektor plugin for generating gravatars
Python
1
star
62

skep

A proxy for finding and serving the latest Briefcase support packages
Python
1
star
63

setuptools_dynamic_dependencies

A setuptools plugin that allows for dependencies that are dependent on the package's version number.
Python
1
star
64

briefcase-web-static-template

A template for generating static web projects with Briefcase.
HTML
1
star
65

actions

Reusable Github Action templates for BeeWare
1
star