I'm new to Flutter and trying it for the first time (I'm not an experienced mobile developer either) and was wondering how to go about running a Python interpreter within my app.
What I'd actually like to create is an app with Python katas or challenges so that when the user solves a challenge it will tell them if it passed some tests (I assume I'd write those as unit tests).
Not sure where to start with all of that, though... I'm not even sure Flutter is the best choice, but since it sounds so promising and I can compile my app for both Android and iOS, I decided to give it a go. So any guidance on how to start building this app would be very welcome.
TL;DR: Yes, it is possible.
As there are a number of Python related apps on the Play Store, to include a full port of Python 3, I believe it is definitely possible to run Python on an Android app. The difficulty is in making it happen.
Actually creating that integration is something I am also researching. Resources I have run across so far:
Flutter packages - This is the route I am currently attempting,
so I cannot help much yet past this list
VSCode - Integration here has a learning curve (just like Android Studio) but development seems a little smoother than AS
QPython - runs Python on Android devices; no personal experience on this yet
BeeWare - again, no personal experience with this
Kivy - not an easy integration
from my experience; graphics creation is much more involved than native Android development
Chaquopy - per the developer, this is still maintained. Supports Java and Python on Android. It does have a supported chaquopy plugin, which is easier to use while integrating with flutter app.
#Floella, I have created chaquopy plugin, by using this plugin, you can use chaquopy sdk in your flutter android app. This is the video I have made that demonstrate the chaquopy plugin in action.
Related
Ok I was doing some data science in python over the weekend and I got to looking at python for mobile development. I was curious as to if it's possible to use both Python (back-end) and use Kotlin (front-end) together?
I know python is a non GUI unless you use kivy or flask. However I was thinking if it's possible can you cross python and Kotlin together.
There is a lot apps that use python as the backend, and another language for the front end. I have done some research and found that Kivy (unstable from my research) can be used for mobile development. However for Android Kotlin is the preferred choice by Google.
Which throws me off because Google uses python for the backend. So when you look at the Google Apps on the Play Store, are they using python and java in mobile apps?
The app I am planning which will be released to Google Play on my developer page will be a Data Driven app. So things would go much smoother if I could combine the two.
Has anyone tried using python and Kotlin? However, would I be stuck with Python and Kivy?
The language used to program frontend vs backend don't matter, the only thing that matters is how the two communicate (assuming when you say backend you mean like a server and not like a game engine). Traditionally, applications will communicate with a backend using a REST API. So long as both sides abide by the same rules for talking to each other, it doesn't matter what language they were programmed in, known as a communication protocol.
The situation that you presented of a Kotlin frontend with a Python backend is definitely being used in production environments, and you shouldn't be afraid to do so either.
See also this related question, though I personally wouldn't recommend using Python to write an Android application because I believe natively supported first-class languages are going to produce more performant, reliable apps than non-native second/third-class languages (I haven't done more than find that SO question, so take my opinion with a grain of salt)
Good morning I wanted to know if it would be possible to convert or run a script in python by converting it into an Android application, the script in question performs webscraping using selenium.
Is this possible?
They are apps like Pydroid 3 that let you run python code on an android device in more of an IDE fashion.
More to your question:
They are projects out there such as python-for-android that do as you described, however, it always recommended to use officially supported development methods for the device you want to target. (For android: Android Studio (Java/kotlin) , Flutter (Dart) etc)
I have developed an android application using java on an android studio. And now I need to implement the python script for a part of the backend functionalities. I want to access the data from our android SQLite DB to process the python scripts and return back to us some values. And on my research, I recovered a plugin named Chaquopy, but it's a paid plugin. so that I need an alternative for the same. Please suggest a tool for the same. Thanks in Advance
Is it possible to use Python to write cross-platform apps for both iOS and Android
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
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
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.
You can try and combine brython and 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.
As #piertoni mentioned, BeeWare enables native iOS & Android apps to be written in Python.
I have developed a few python programs that I want to make available online.
I am new to web services, and I am not sure what I need to do in order to create a service where somebody makes a request to an URL (for example), and the URL triggers a Python program that displays something in the user's browser, or a set of inputs are given to the program via browser, and then python does whatver it is supposed to do.
I was playing with the google app engine, which runs fine with the tutorial, and was planning to use it becuase it looks easy, but the problem with GAE is that it does not work well (or does not work at all) with some libraries that I plan to use.
I guess what I am trying to do is some sort of API using my WebFaction account.
Can anybody point me in the right directions? What choices do I have in WebFaction? What are the easiest tools available?
Thank you very much for your help in advance.
Cheers
Well, your question is a little bit generic, but here are a few pointers/tips:
Webfaction allows you to install pretty much anything you want (you need to compile it / or ask the admins to install some CentOS package for you).
They provide some default Apache server with mod_wsgi, so you can run web2py, Django or any other wsgi frameworks.
Most popular Python web frameworks have available installers in Webfaction (web2py, django...), so I would recommend you to go with one of them.
I would also install supervisord to keep your service running after some reboot/crash/problem.
I would be glad to help you if you have any specific question...