Is it possible to use Python to write cross-platform apps for both iOS and Android?

PythonAndroidIosCross PlatformBeeware

Python Problem Overview


Is it possible to use Python to write cross-platform apps for both iOS and Android

Python Solutions


Solution 1 - Python

An option is kivy: a cool cross platform Python framework which works for Android, Win7, Linux, MacOSX and iOS.

Update: kivy project is growing daily, now supports also Raspberry Pi

Solution 2 - Python

For Android Google provides something called ASE (Android Scripting Environment) which allows scripting languages (Python included) to run on Android. More details here

For iOS, it might be quite a bit more complicated (and I'd advise to check the latest version of iOS SDK agreement to check the current state of the law - apple tends to allow & disallow such apps periodically). For the technical part you might need to interface between Python & Objective C as well as do some wizardry to statically link all the libraries Python requires; full details are available here. Another approach for iOS Python development would be to embed a Python interpreter into you app and distribute your Python script with it (so to play nicely with Apple rules). In this case your Python application would be a Python interpreter which is packaged with your script and runs it automatically.

Second option is to use Kivy framework(kivy.org) - it's a framework to write touch-friendly applications in Python and package them for different platforms. It's had Android support for a while, and recently added iOS support

Solution 3 - Python

For writing a GUI applicaion you can use the Toga library,then package it with briefcase into a Android and/or iOS app (or Windows, Linux, macOS etc).

Note: the project is still in alpha state but under rapid development.

Solution 4 - Python

You can try and combine [tag:brython] and [tag:cordova]. The Brython wiki describes how to write an Android app using Brython, which might provide the necessary information to do this also using Cordova. I haven't tested this yet, but it sounds promising. You should however be aware that due to its nature, Brython cannot support x86-compiled packages such as OpenCV (see e.g. here). On the other hand, if you know a bit about JavaScript / HTML5, you can use the WebView native functions, e.g. http://www.brython.info/gallery/three.html.

Solution 5 - Python

As @piertoni mentioned, BeeWare enables native iOS & Android apps to be written in Python.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser1404932View Question on Stackoverflow
Solution 1 - PythonpiertoniView Answer on Stackoverflow
Solution 2 - PythonRaheelView Answer on Stackoverflow
Solution 3 - PythonocupeView Answer on Stackoverflow
Solution 4 - PythonTobias KienzlerView Answer on Stackoverflow
Solution 5 - PythonmichaelView Answer on Stackoverflow