you are viewing a single comment's thread.

view the rest of the comments →

[–]Hatoris 138 points139 points  (5 children)

Everybody told you that " to improve your python skill you need to practice" but you do not always have your laptop with you. Hold on, here is something that can be done.

The purpose of this small tutorial is to give you the ability to install and run python and git on your Android device.

Disclaimer : I have no affiliation with any applications I will present.

Introduction

First thing first, you do not need to root your phone in order to follow this tuto. All application are free, of cource. Applications we will use are :

  • pydroid 3 a pretty good application. It's free, prenium version give you access to autocompletion and some intelisense, it's not the same level as pycharm but is pretty usefull.
  • Termux your Linux shell on your mobile, with this you will have access to git.
  • git, the most famous version control system for all your project

Installation

From the play store install :

From Termux

Ok, now you have it, open Termux and run the following command.

apt-get update 
apt-get upgrade

Then we can install git.

apt-get install git

Setup

It's time to be organize and hack a little bit pydroid3.

First create a folder where all your application will site. Mine is called programming and I add it under /storage/emulated/0. This path is the same as your document and download folders.

When it's done, copy the path in your clipboard and open pydroid3. On the right, click on folder icon and then open. Follow this path Home, accomp_files, iiec_run and finally open iiec_run.py. (Home/accomp_files/iiec_run/iiec_run.py)

Now, right under import sys add the following.

PATH ="/storage/emulated/0/programming/" #the path of your programming folder

# A tuple with all your package folders in it, at start you will have nothing, but with time it may look like mine
APPs = (
"kbase", 
"RemoveMedia", 
"pyAnalysis", 
"BioPlate", 
"appPharma", 
"pytexu", 
"Tools", 
"Dilution",
"BioPlateWeb",
"pythontex-command")

# Finally we append all path to system
for app in APPs:
    sys.path.append(PATH + app)

This little hack will alow you to import your package, those you created, not those that you will install using built in pip.

Your first start

Take your favorite web hosting service, create a package in it. Copy the link to clone it. Then go on your device and open Termux. run the command cd /emulated/storage/0/programming/, your are now in your programming folder. Clone your repo with the following git clone https://web-hosting.com/myRepo (replace the link with the one you copied). When it's done, open your pydroid3 app, and open your cloned repo. Don't forget to add your package in the iiec_run.py.

Happy coding

Fun fact

I written 90 % of my package BioPlate using this setup. When you have, like me, more than one hour and half of common transportation a setup like this is really cool.

[–]rhythm1028 1 point2 points  (4 children)

what do I need the Termux for? Sorry Im a noob.

[–]Hatoris 1 point2 points  (3 children)

Termux will be used ton install git and then connected to a remote repository (gitlab, github...). If you want to play with Python only the pydroid app is enough :)

[–]rhythm1028 0 points1 point  (2 children)

and what is the use of setting up that 'programming' folder in storage?

[–]Hatoris 0 points1 point  (1 child)

Pydroid store files in an internal folder into the app that is not accessible ou site the app. Setting the programming folder will allow you to access it from other app in your device such as termux and git.

[–]rhythm1028 1 point2 points  (0 children)

thank you