Executing Python Scripts in Android - python

This link says that Android support Python, Lua and BeanShell Scripts, subsequently for Perl too. If it is so, is it possible for developers to write python scripts and call them in their standard Java based android applications?

I remember reading about this awhile back as well.
It's not on the android dev site.
It's a separate project, android-scripting.
Python API:
API Reference
SL4A API Help

I think I have read somewhere that ASE with Python was a huge library ( several Mo), and so was completely unpractical for a public application.
But you can still use it for development...

Related

create android, iOS libraries from python, including dependencies

We working on a project which involves ML/AI integration to the native mobile application. We are programing our ML/AI code in python. Python code has dependencies, that we need to include in our mobile application.
We have tried with kivy but they only create .apk files and apk files can't be called from other apks. So, we need to create libraries that can be included in the android and ios projects.
Also, we tried chequopy but that doesn't support mediapipe which is in heart of our implementation.
Any guidance in that direction will go long way for us.
If your app was entirely self-contained in python including dependencies using recipes should be possible. If rewriting the native app is not an option maybe one idea is to serve the ML over an HTTP API running on a local server (eg flask). Quite cumbersome as users would need to install two apps

I need to integrate python script along with libraries to spring-boot application

I am developing a spring boot application, where it needs to call a python script with few arguments and get back the results from python. I need to develop the application as a single unit that is portable. I have an idea of using maven jpython/python integration (making jar file of python + libraries for python stuff). Is this possible? If it is how to do that? Or another way to do maven python integration?
it needs to call a python script with few arguments and get back the results from python
Not sure if you really are familiar with Spring Integration, but since you mention that tag, I'm going to share with you a scripting support in that project when Python language is one of those which you can use for such an integration: https://docs.spring.io/spring-integration/reference/html/messaging-endpoints.html#scripting
Here is also some sample project with scripting support: https://github.com/spring-projects/spring-integration-samples/tree/master/applications/cafe-scripted

Implementing Python functionality in Android application

I have created one project which has machine learning and Signal processing functionality.
This project is running on server without any issue. My android device making API call to server and getting response.
I want this functionality to be run offline (Without Internet) without calling to remote API.
What are the possible way to run to Python functionality in the Android application?
Writing entire application in Java is not feasible because it depends on many python libraries like numpy, scipy, pandas, sklearn etc.
Maybe you can use Termux which is an Android terminal emulator and Linux environment app.
It comes with a package manager pkg which can be used to install Python.
pkg install python # or python2
It installs python and the pip package manager.
You can also find some useful information in wiki.python.org/moin/Android.
You can try Chaquopy, it allows intermixing of Python, Java and Kotlin. Furthermore it allows the use of cheeseshop (PyPi) packages such as the one you described.
You should be able to integrate your existing code with a Java application for Android.
https://chaquo.com/chaquopy/
It requires a commercial license if you don't want to opensource your code.
It is possible to use python for android project https://github.com/kivy/python-for-android. For rooted device or system app it is possible to launch python interpreter (compiled binaries) as a separate process with script as a parameter

Can PiCloud hold FORTRAN code? (website hosted by GAE)

I have a some old Fortran77 codes, which does some calculations. Now I build a website hosted by Google App Engine, and need to call those models' calculation results. Since I am new to both GAE and PiCloud, my basic questions are:
Should I first compile those Fortran77 code using a windows compiler?
Then, publish those models to PiCloud
Call from GAE?
Does my approach make sense? or Does PiCloud has Fortran77 environment, which can directly do the calculation without compiling first? If so, is there any example about this topic?
Thanks!
Picloud claim "install any library or binary written in any language", so it's safe to say you can run fortran programs on it. In fact, their homepage even says:
You can deploy any software written in any programming language
including C, C++, Java, R, Fortran, Ruby, etc.
You shouldn't compile it with a windows compiler, because picloud runs linux - compile it using a linux compiler, such as GCC.
Regarding using it from App Engine, see this page, where it says:
[...] use PiCloud from Google AppEngine, since our cloud client library is not supported on GAE.

Start creating websites by using Python

I am basically a PHP guy. now moving towards python. I am starting to learn python.
How do I install it and start working it, and develop websites .
I got totally confused with the alternative implementations in the download section of the Python site. Can you tell me what "alternative implementations" means?.
I mean to say: I can create a .php file in my server and then access it from browser like http://example.com/index.php, so I was wondering whether I can do the same with python, like creating a .py file and accessing from browser http://example.com/index.py.
Just as a disclaimer, I interpret you saying "run Python in a browser" as "making a website with Python."
If you want to start writing web applications in Python, you can either use CGI or use one of its many web app frameworks. Python is not like PHP in the sense that you can't just embed it in HTML. Many of those frameworks come with development servers that you can use to test your web app (by looking at it in a browser).
A particularly good Python web framework is Django.
I really do recommend that you do the Python tutorial before you dive into any of those frameworks, though. Python is not only for writing web applications, so you'll have to get some fundamentals down first before any of that makes sense to you.
As for installing Python, I recommend you take the version you got with your OS if you use Mac or Linux, or installing the Python 2.7.1 32-bit binary from python.org if you use Windows. The alternative implementations include a Python that runs on the Java virtual machine and one that runs on the .NET Common Language Runtime, but for your purposes the reference implementation, CPython, should work fine.
Python by default is a general purpose scripting language and is not meant specifically for web application development (like PHP is primarily). So, you'll first need to download and install Python (choose the version that's appropriate for your OS) from www.python.org I'd recommend v2.7.1 but you can try out v3.2 if you'd like.
The other versions (IronPython, Jython, etc) are Python implementations on other platforms (.NET and JVM respectively), and in all likelihood you don't need to bother with them unless you really want to.
To start working with Python and create web applications you will also need to download and install a Python-based web framework. There are many of them, too many in fact to list here. However, there is a page on the Python Wiki that has a list of useful frameworks for web development.
You don't "run it from a browser". You don't run PHP from a browser, either.
The way to use Python for web development is to use a framework like Django or Pyramid.
Sage or CodeNode let you run Python in a browser.
You can get a limited Python experience by pointing your browser to http://shell.appspot.com/ . You will be running Python 2.5.2 on Google's site.

Categories