[Mobile-sig] python on android

Russell Keith-Magee russell at keith-magee.com
Thu Jan 29 02:07:57 CET 2015

On Thu, Jan 29, 2015 at 2:01 AM, Bill Janssen <janssen at parc.com> wrote:

> Jacob Kruger <jacob at blindza.co.za> wrote:
> > ---original message---
> > >  What I'd like to see is a python distribution for android (I'm aware
> > >  of the fact that this is mobile-sig and not android-sig, but for me
> > >  personally android matters a lot more than other mobile platforms)
> >
> > I agree, and android is my smartphone platform of choice, and while
> > have played around with SL4A - TTS output calls it slang for android -
> > in past, among a few others, would like something relatively
> > stable/reliable, and best would be to be able to generate .apk files,
> > which would include something like python interpreter wrappers around
> > the code, or something.
> To me, this is a solved problem.  I'm running several apps completely
> written in Python on my Android phone.  I used Kivy (http://kivy.org/,
> but https://github.com/kivy is more useful if you're a coder), for the
> UI, the API to Android services, and for the packaging into an APK.
> The UI is the Kivy set of widgets: http://kivy.org/docs/api-kivy.html
> The generic OS API is "plyer": http://plyer.readthedocs.org/en/latest/
> The packager is buildozer: http://buildozer.readthedocs.org/en/latest/
> I'm amazed at how well it all works.

I'm glad that you find Kivy good enough for your purposes, but I don't.

 a) I don't like the Kivy widget set. It might be fine for games, but if
I'm using a platform, I want native widgets, and if I'm using native
widgets, I don't want to carry the overhead of a customised widget toolkit
I'm not using.

 b) I don't like the Kivy build tools. They're a lot more complex than they
need to be. I'm going to guess the Kivy people are all Linux users, because
they don't appear to have worked out that binary compatibility is a thing.
You don't need to have every user compile Python and the rest of the Kivy
stack - you can just ship a binary library, and it will work on every phone
with the same hardware (I know, because Toga does this. The Toga
bootstrapping process is "clone this repo, and copy this file". You could
reduce this to "clone this repo" if you were happy putting binary artefacts
into version control.)

 c) Kivy's build tools are Python 2.7.1 only on iOS, and 2.7.2 on Android;
and if you build them on OSX, when you're on the device, they report
sys.platform as "darwin".

Going back to my post - I agree with Kivy on layer 1, and I was able to use
their build tools to bootstrap my own. However, I have very different
opinions on layers 2-4. Kivy is *a* solution for Python on mobile; it isn't
the *only* possible solution.

On top of that, Kivy still has a lot of work to do on point (c). If effort
is going to be spent fixing libPython for mobile, I'd like to see it done
in Python's core - this isn't something that should need to be duplicated
by every project that has an interest in this space. I also like to see
this in core as a formal recognition that mobile platforms matter in the
landscape of modern computing.

And once a mobile libPython exists, Kivy can use it however they want; I
can use it however I want; and SL4A can use it however they want.
Hopefully, we'll be able to share effort along the way on other parts of
the project - but as I detailed in my original response, I don't think that
necessarily needs to be part of Python core.

Russ Magee %-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/mobile-sig/attachments/20150129/3909d630/attachment-0001.html>

More information about the Mobile-sig mailing list