I developed in Python an algorithm library (+ usage of e.g. pandas and numpy) and I search a way to deploy those algorithms on Android and iOS without rewritting the code native or in any other language.
After exploring several options, I see four major possibilities how to solve the Python migration:
- Translate the Python code into native code (Java or Swift/Objective-C) for each platform (which I do not prefer as keeping the same code in line seems a lot of redundant work)
- Translate the Python code into C or C++ which is executable by both OS (unfortunately, I am not fluent in C/C++ and I think I won't be ;)) But there are tools or interpreters as Cypthon or Nuikta which can maybe translate the Python code into executable C or C++ versions?
- Use Kivy to create a Python based app for both OS, however I do not want a complete .apk instead just a AAR or library that can I use as a module by other apps (I am not sure if this works)
- With the help of Chaquopy run Python code in Android via an Python interpreter. However, I do not see any comparable solution for iOS...
Spanning around these four options, I have several questions:
- Is it possible with Cython, Nuitka, or any other tool to translate Python code with all dependencies into executable C/C++ code that can be used by Android and iOS?
- Can I use Kivy to create a library (e.g. like this on Android or a library package on iOS)
- Is there any obvious option I miss?
I know that using native code will be probably the fastest solution whereas automatic generated code may have flaws and is kind of inefficient (and one has always to rely on the maintainer). Nevertheless, I would now prefer the way to keep the Python code as my core as long as I am still in a prototype phase, would be great to hear the community's view!