Skip to content

Instantly share code, notes, and snippets.

@freakboy3742
Created December 20, 2015 04:43
Show Gist options
  • Save freakboy3742/4a6675aea6d5269852bc to your computer and use it in GitHub Desktop.
Save freakboy3742/4a6675aea6d5269852bc to your computer and use it in GitHub Desktop.
A tale of two mobiles: the state of Python on Android and iOS

Description

It was the best of times, it was the worst of times, it was the age of foolishness, it was the epoch of belief, it was the season of Python popularity, it was the season of Python not being available on an important platform.

So reads the history of the last 5 years of Python. Python is enjoying a surge in popularity due to it's features as a language; but "desktop/server" split that dominated the 80s, 90s and 2000s has been joined by a third player - mobile devices such as phones and tablets - and Python doesn't have a good story for those devices.

Although there hasn't been much to say in the past, the good news is that over the last year, there's been some signficant changes in the landscape, and Python on Mobile is now teetering on the brink of being a genuine reality.

In this talk, Russell Keith-Magee will survey the current state of using Python on mobile devices, the work that is currently being done, areas where more work is requried, and the prospects for the future.

Python Level

Intermediate

Objectives

To give a summary of the current state of the art of Python on Mobile, and an introduction to the technologies and approaches that make this possible.

Detailed Abstract

The Kivy project has been supporting Python on mobile for a couple of years; there have been various iOS and Android applications 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 - and for me, this is a major challenge for Python as a language.

For the last 2 years, I've been trying to the point where it would be possible to develop mobile applications in Python with the same ease as it is used for web and data analysis purposes. This has involved some very 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 dig into what I've been doing over this 2 year period. Along the way, it will hopefully inspire some people to see the possibilities for Python on Mobile as a platform, and expose people to some interesting edge features of Python, 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
      • How the Rubicon bridging library works
      • The libffi library
      • What about Swift?
      • Outstanding challenges for Python on iOS
  • Python on Android - 8 minutes
    • General challenges to using Python on Android
    • Why the iOS approach doesn't work for Android
    • 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
    • A mobile standard library?
    • Work that still needs to be done

Additional Notes

I'm the maintainer of Toga, a cross platform GUI toolkit with pre-alpha support for iOS and Android, as well as a number of projects that provide platform support for Python on mobile devices (including VOC, Rubicon, and Briefcase). 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.

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 Rubicon and VOC work. As stated in the detailed abstrct, 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