Eric S. Bullington

Data Visualizations and Software Engineering

A Python Framework for a New Mobile Era

I’ve spend the last few weeks looking for a good framework for mobile development. I’ve got an idea for a mobile application that I want to move on as quickly as possible. However, I wasn’t thrilled with the idea of using the native development tools for Android and iOS for several reasons,mostly because I don’t want to use Java and XML or Objective C. I wanted a framework that would allow me to develop for Android without using Java, and preferably use the same foundation to create an iOS application.

I found the perfect framework. It’s fast, easy-to-use, and extremely flexible.

The framework I decided on is Kivy, a relatively-new framework programmed in Python.

Before settling on Kivy, I took a close look at Corona SDK, Gideros, and Titanium Appcelerator. I also looked briefly at Phonegap and Sencha Touch before discounting them for the purposes of my app. Corona and Gideros are both appealing because they are relatively compact, perform well, and programmed using Lua – a language I’ve come to appreciate over the past few months. However, both of these frameworks are primarily directed at game developers,particularly Gideros. Corona SDK has started marketing their take on business apps to enterprise clients, but this option is quite expensive. Most importantly for me, Corona SDK only runs on Windows and OSX, and I’m developing on Linux. Gideros appears to be well-designed, but is even more oriented toward game developers than Corona. So both the Lua-based frameworks were out.

Sample Kivy app on Android (courtesy of

I took a very serious look at Titanium Appcelerator. I know JavaScript relatively well, and enjoy using CoffeeScript to write Javascript. I have a strong background in web development, so Titanium seemed like a good fit. Furthermore, Titanium now appears to have a relatively mature development environment. They have their own IDE, based on Aptana, and have some good command line tools available for developers who prefer to use vim/tmux/bash as their IDE.

Unfortunately, Titanium Appcelerator is beset with implementation problems. Even using the fast V8 JavaScript interpreter, Titanium Appcelerator has significant performance issues on Android. Their showcase app, called the Kitchen Sink, suffers from significant performance problems and feels very laggy and unresponsive on Android. So Titanium was out.

Luckily, I soon found Kivy. It’s not as mature as some of the other frameworks I’ve looked at, but its performance is quite fast after start-up. It’s also programmed using Python, which is my preferred development language.

Kivy was built on the foundation of PyMT, a multitouch library for Python. So it’s not surprising that it’s multitouch support is very strong. It supports a range of multitouches out of the box, and it’s quite easy to program your own gestures.

My Work-in-Progress on Kivy

Like other graphics frameworks such as QT and wxWidgets, Kivy app layouts are programmed using widgets. If you are a web developer and not used to using a widget tree for layout, it will take some time to get used to the concept. However, once you learn how to manipulate widgets, you can create layouts with ease. Kivy makes this even easier by providing a DSL (confusingly also called Kivy) for programming layout. The Kivy language is very similar to QML, so those developers who use QT will immediately feel comfortable. If you are new to this type of markup language (it’s actually much more than just markup), then it will take a few days to fully grasp, at which point you’ll realize why the language was created and how easy it is to implement your app’s layout. Honestly, once you learn the Kivy language, designing layouts feels more like wireframing than true programming. It’s just that easy.

Kivy is an extremely active community project, and each day the core developers (Mathieu Virbel, Thomas Hansen, Gabriel Pettier, Akshay Arora, Brian Knapp, and Edwin Marshall) commit new features. Just yesterday, Mathieu committed a new pilot project for Java-Kivy interop on Android, which appears to be working remarkably well. If I’m not mistaken, the Kivy devs hope to soon have an abstracted API for native access on both Android and iOS. For the moment, device-specific development is taking place on Kivy’s sister projects of python-for-android (not to be confused with Google’s python framework for Android) and kivy-ios.

In short, if you are looking for a way to create cross-platform mobile apps using Python, look no further. Try out Kivy, and watch it grow into one of the mobile world’s premiere application frameworks.