I work on projects in the area of intelligent user interfaces. This involves building UI prototypes that run on devices of different shapes, sizes and forms.
I think most of you would agree when I say that Python is one of the best languages for prototyping anything as a CS student.
More often I have found myself switching back and forth between using Python on my desktop for doing the core part of the project and using mobile specific frameworks for the making the user facing components. For example, I would create partially complete apps on the phone to collect the data on the phone and do all the processing on my desktop. Unfortunately with this approach, you have to dive into understanding the API of the platform you are building for in its “favorite” programming language. It’s even more of a mess when you target your studies on more than one such platform.
What if I tell you that you could do everything in Python and enjoy all of it benefits (read modules 🙂 ) while building cross-platform applications?
Recenty, I was introduced to this library called Kivy:
… an open source Python library for rapid development of applications
that make use of innovative user interfaces
The best part about using Kivy is that your same code runs on Linux, Windows, OS X, Android and iOS.
It also takes care of most of the input devices and has native support for things like multi-touch.
If this sounds interesting, you can check out a couple of kivy examples, talking to people on freenode #Kivy (testified by many as one of the friendliest communities on IRC :D) and following these wonderful introductory videos:
Kivy crash course 1: making a simple app http://t.co/d7VD1H49Yv great introduction 🙂
— Kivy (@kivyframework) December 1, 2013
You can also find apps with a variety of innovative user interfaces built by independent developers in the Kivy gallery.
While Kivy provides you with a framework for building apps, it is supported by complementary projects such as PyJnius, PyObjus and Plyer.
PyJnius is a library for accessing Java classes from Python. So instead of trying to build communication layers for each of the API feature of a device, PyJnius on Android (and PyObjus on iOS) lets you access all the device specific APIs on mobile devices. This python code is converted to C using Cython and can be then interfaced with the Android OS using the native development kit (NDK).
But this still needs you to know about different platform APIs and mind the differences between them when you build cross-platform applications.
To solve this problem, we have the Plyer project which gives you a set of common APIs for accessing things like Camera, GPS, Accelerometer and other other sensors; and takes care of making the appropriate PyJnius and PyObjus calls in the background.
This summer, I’ll be working to contribute towards the development of this library. Hopefully as the support for these libraries grows, I would be able to manage my own projects with more ease and also help others in the community who were looking for a solution like this.