Skip to content

Instantly share code, notes, and snippets.

@freakboy3742
Last active January 1, 2016 05:40
Show Gist options
  • Save freakboy3742/973d1e79e6523c7de097 to your computer and use it in GitHub Desktop.
Save freakboy3742/973d1e79e6523c7de097 to your computer and use it in GitHub Desktop.
A tale of two mobiles: Python on Android and iOS

A tale of two cellphones: Python on Android and iOS

Python is enjoying a surge in popularity due to it's features as a language. However, over the last 10 years, mobile platforms have increased in importance, and Python doesn't have a good story on these platforms.

In this talk, Dr Russell Keith-Magee will give a technical dive into the work the BeeWare project has been doing to make Python as simple to use on Mobile as it is on other platforms.

Python Level

Intermediate

Objectives

To summarize the current state of support for Python on mobile platforms, and provide technical details on the technologies and approaches that make this support possible. It should also expose them to some features of Python as a language that they might not be aware of - or be aware how they can be used.

Detailed Abstract

It has been possible to write mobile applications in Python for a couple of years; there have been various iOS and Android libraries and apps that allow you to run and write Python on your mobile device. However, the idea of writing mobile applications in Python has never really gone mainstream. This is a major challenge for Python as a language; if Python isn't able to service this major new platform, it risks obsolescence in favour of languages that can.

Over the last two years, the BeeWare project has been developing tools that allow developers to write mobile applications in Python. The goal of this work is to make it as easy to develop a mobile application as it is to develop web applications or data analysis tools. The process of developing these tools requires some deep diving into the internals of Python and it's implementations, a lot of dead ends, and (unfortuantely) writing a lot of code in languages other than Python.

This talk will be an "under the hood", deep technical dive into the tools and techniques that are needed to achieve support for Python on iOS and Android (as well as looking at a few techniques that don't work).

Along the way, it will hopefully inspire you to see the possibilities for Python on Mobile as a platform, and expose you to some interesting features of Python that you may not have encountered previously, like descriptors, metaclasses, bytecode manipulation, and type annotations.

Talk outline:

  • Intro (2 minutes)
    • Who am I?
    • What "Mobile python" means
  • Python on iOS (8 minutes)
    • General challenges to using Python on iOS
    • Bridging the Objective C environment to Python
      • The libffi library
    • What about Swift?
    • Outstanding challenges for Python on iOS
  • Python on Android (8 minutes)
    • General challenges to using Python on Android
    • Problems with the CPython embedding approach
    • Why you can't just use Jython
    • Another approach: how the VOC transpiler works
  • Packaging (3 minutes)
    • Dealing with app stores
    • Making it easy to build mobile apps
      • What is Briefcase?
  • The GUI layer (5 minutes)
    • How to build a platform-specfic GUI
      • A simple Android example
      • A simple Python example
    • How to build a cross-platform GUI
      • Toga
      • Kivy
  • The future (2 mins)
    • Performance considerations
    • A mobile standard library?
    • Work that still needs to be done

Additional Notes

I'm the maintainer of many of the tools being demonstrated in this talk. I'm the co-maintainer of the Python Mobile-SIG, and I was invited to give a presentation to the Python language summit about mobile Python at PyCon US 2015. I was unable to attend that summit, but I did present via pre-recorded video.

I'm also a 10 year veteran of the Django core team, and the past President of the Django Software Foundation.

I'm an experienced speaker; I've keynoted PyCon PH and PyCon RU, I've spoken many times at DjangoCon US, EU and AU, at PyCon AU, and at Django Under the Hood.

This is proposed as a 30 minute talk; however, I'd be able to extend this to a 45 minute slot by expanding on the details of how ObjC bridging and VOC work. As stated in the detailed abstract, both projects involve some very deep concepts in Python usage, and the details might be of interest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment