Skip to main content
EuroPythonCode of ConductBuy tickets

How to embed a Python interpreter in an iOS app

Room:
Liffey A
Start:
09:30 on 15 July 2022
Duration:
45 minutes

Abstract

Come see how you can make a native mobile app that embeds Python 3.10 to allow users to script app behavior. It's allowed by Apple but is currently underutilized by the app makers. Add superpowers to your iPhone app with Python!

Native mobile applications have many advantages over mobile websites or apps made with cross-platform toolkits. They will use less battery, allow for richer graphics, more consistent UI behavior, and enable more functionality through device-specific APIs. Wouldn't it be great to have access to all this from Python?

In this talk, we'll marry a native iOS app written in Swift with an embedded Python 3.10 interpreter to allow users to customize what the application is doing. We'll go through the entire process of:

  • embedding Python from source;
  • building it into the Swift mobile app in Xcode;
  • adding a few pre-compiled third-party libraries like numpy and Pillow to broaden the scope of what the user can do;
  • running the resulting app on an iPhone 13;
  • modifying the app behavior at runtime thanks to our new Python superpowers!

Knowledge of Swift is not required for attendees of this talk. However, it will be needed later if you're willing to embed Python in an iPhone app. Embedding Python doesn't really let you make an app without knowing Swift. Don't fret though! It's pretty easy to get a hang of Swift when you're fluent in Python.

TalkSoftware Engineering & Architecture


The speaker

Łukasz Langa

CPython Developer in Residence, Python 3.8 and 3.9 release manager, creator of Black, pianist, dad.

Equally interested in music and software engineering, as a classically-trained pianist and a long-time contributor to the Python programming language. Loves to build software for musical instruments. Makes music under the RPLKTR moniker.



← Back to schedule