[Mobile-sig] Python3 + stdlib on iOS, Android

π sunfish7 at gmail.com
Mon Mar 23 16:39:48 CET 2015


Hello all,

I'm designing a multiplatform C++ application which embeds Python3.

So far I have it working on OS X. I've copied the libpython into my project directory and linked against it. I'm able to launch a Python interpreter, use the C-API, etc.
(Incidentally I've open-sourced my Python-C++ bridge here: https://github.com/p-i-/PiCxx <https://github.com/p-i-/PiCxx>)

I'm concerned about porting my project to iOS/Android in the future.

The Kivy developers have successfully built Python2.x + stdlib for iOS/Android.  They plan to eventually to also support 3.x, but it is not a priority for them at the moment.

And to my knowledge nobody else has successfully ported 3.x.

Does anyone know otherwise?

Using Python2 (from Kivy) would be awkward because my C++ Python Interface code targets Python 3.x, and it would take a lot of work to add 2.x support.

There was talk on here a while back regarding Python3 on iOS, but I don't remember any mention of stdlib.

>>> p(sys.path)
['',
 '/usr/local/Frameworks/Python.framework/Versions/3.4/lib/python34.zip',
 '/usr/local/Frameworks/Python.framework/Versions/3.4/lib/python3.4',
 '/usr/local/Frameworks/Python.framework/Versions/3.4/lib/python3.4/plat-darwin',
 '/usr/local/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload',
 '/usr/local/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages',
 '/usr/local/lib/python3.4/site-packages']
^ that is from an interactive Python prompt within my C++ app.

If I were to build on iOS, none of this would exist.

lib-dynload contains 50 or so .so files which are compiled Python extension objects.
If I understand correctly, this makes up much of Python's stdlib -- the remainder being .py files.

So it would be necessary to compile these for iOS/Android.

I'm told Python's compile process simultaneously compiles the libpython and these .so files.
So maybe whoever has got that working on iOS has successfully created these .so-s.
Or maybe they compiled with all modules turned off?

And as for Android, I have no idea whether this has been done.

Can anyone help me understand the work that is required here, and how to set about going at it?

π
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/mobile-sig/attachments/20150323/e003ad56/attachment.html>


More information about the Mobile-sig mailing list