Skip to content

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

License

Notifications You must be signed in to change notification settings

beeware/Python-Apple-support

 
 

Repository files navigation

Python Apple Support

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

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

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.

It exposed 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
  • posixshmem
  • posixsubprocess

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

  • macOS 10.8 (Catalina) or later, on:
    • MacBook (MacBooks using Apple Silicon will run under Rosetta emulation)
    • iMac (iMacs using Apple Silicon will run under Rosetta emulation)
    • Mac Mini (Mac Minis using Apple Silicon will run under Rosetta emulation)
    • Mac Studio (using Rosetta emulation)
    • Mac Pro (all models)
  • iOS 8.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 (1st-3rd gen)

Quickstart

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 in an XCode-compatible form.

The build products will be in the build directory; the compiled frameworks will be in the dist directory.

About

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

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks