My Experience with Coding Python on Phone!

My Experience with Coding Python on Phone!

Introduction

You can read About Me here

Wait, Is it even possible?

Now the title already sounds pretty interesting, but the main question is, is it actually possible? My answer: Yes! (At least with python. There are tools for Js and HTML too, but personally, I didn't try them, so I can't give an honest opinion about them).

Git that Bread

Guess what? You can pull AND push your code to Github, RIGHT FROM YOUR PHONE! I was pretty amazed when I learnt that this was actually possible! You use an app called Termux to use Git. Termux provides you with a Linux Shell right on your phone!

SIde Note:

This article is NOT going to explain setting up Github on termux (Linux command shell on your phone). Instead, take a look at this article. It explains a lot of stuff about Github, as well as some useful tips for using termux

SIde Note #2

If you don't want to use SSH, you can directly push or pull from Github, but every time you do so, you will have to enter your email and password.


Setting Up

First Steps

Ok, I installed git on termux, but now what? I started first by creating a folder in my internal storage through my file manager. That was straight forward enough. I named it programming and was ready to start coding. But the problem was I couldn't access the folder directly through termux.

Know your roots!

A little bit of searching on the internet and fiddling around myself, I found that I could continually keep going higher in the folder hierarchy by using cd.. until I reached the very root. From there, I accessed storage/emulated/0 and voila, there it was, my phone's internal storage! I was truly ecstatic!

Now, I was ready to move onto actual Coding. Enter - Pydroid 3

Pydroid 3

Now, there were a few options for coding in python on phone, but the best and the most feature-rich of them all was Pydroid. It has a LOT of Built-In Features, such as a terminal, a fully working pip install, working on multiple files at the same time, and a lot more! This was a dream come true! (okay, maybe I'm exaggerating a little bit :P).

Featureful

The pip install module requires you to download additional stuff from the play store, and it uses quite a hefty chunk of storage so be careful. (Around 200-300 Mb base and the size grows with more modules, of course)


My Experience

Starting off

Now that everything was set-up and ready to go, I started off by cd'ing into my programming folder and pulling the (private) RPG game I had been working on in pure python. It WORKED and I let out a sigh of relief (I was really sceptical). After that, I started Pydroid and opened the folder. After that, it was pretty much smooth sailing.

Major Note:

Pydroid doesn't internally support tabs (spacing), so whenever you do use a tab, it converts to spaces. If you code in python, you know how big of a pain tabs and spaces are. So keep that in mind, if you use tabs instead of spaces because it was VERY annoying for me!

Being Pushy

So I coded a small module for my game, and tested it thoroughly as well. So, I was ready to push the code to my Repository. I saved all the changes I made, closed Pydroid, and started Termux again. It was already running in the background, so I didn't have to reopen the directory. A simple git commit -am"blah blah", then a git push repo master then entering my email and password (I don't use SSH), and I was DONE! This was truly an experience for me, and a fun one at that!

Would I recommend?

As just an experience - DEFINITELY. You HAVE to try it at least once, as it quite an experience. As for a normal developer? Only if you don't have a laptop or a desktop. (which is pretty unlikely), or if you want to just test something out really quickly on python.

Termux, the Almighty!

Still, Termux is a powerful application (I originally came to know of it because I wanted to try out hacking on phone. For those wondering, YES, you can hack on phone. There are a lot of tools that you can directly install on Termux. One of them being MetaSploit)

BONUS

This was a really cool github repo I found. It shows you how powerful Termux can be, and some tips to customize and use Termux to it's fullest potential.

Thanks for reading!

This was my experience about coding on my Phone! I hope you learned something out of it! If you have any questions, let me know in the comment section below, and I'll try my best to answer them!