Rob Cook


Home | Donate

Python on the go


2023-12-29

I love to dabble with Python. It's a simple language that embraces low ceremony. As such I find it doesn't suit big IDEs (like Visual Studio), and instead plays nicely with simple editors and a Unix-like workflow. I also like to turn to it when I think about coding, much like a programming notebook. Due to this, a regular laptop isn't the ideal piece of hosting hardware. Android devices though, are always with me. Can you develop in Python on Android?

As it turns out, yes you can. I found two ways to do this: one uses an app - Pydroid3, and one an online service - Python Anywhere. As it's coding, I strongly suggest pairing a decent bluetooth keyboard with your device before you embark on anything other than the simplest of scripts.

Pydroid3

Pydroid3 is excellent. It provides a simple code editor and a terminal window. It's free, but I highly recommend paying the unlock fee for it. With a companion app - Pydroid repository plugin - you can download and install a large number of regular Python packages. It supports GUI development with Kivy and TKinter, as well as game development with Pygame.

For development on the go, it's hard to fault this app. I'll not be building anything big with it, but for small scale stuff I can see it working really well. The code editor supports a decent level of auto complete, and a small list of preferences can be tinkered with.

There are code samples included for basic Python and the included packages - the aforementioned Kivy, TKinter, PyGame, and others. These can be a unzipped and run on directly on your device to play around with.

Python Anywhere

Python Anywhere is available online as a free or paid for service. If you can afford it, I recommend the $5 a month hacker account, but the free tier is a good starting point too.

You get terminal support for various versions of Python, and bash. You can upload files, edit online, and host a website. On the paid tier you get a MySql database as well. In fact you could run a pretty decently trafficked website for your $5 a month.

The online editing and console experience is pretty decent. Sometimes I encounter glitches while using them, which can make seeing what you are typing difficult. That aside, for a browser based environment it does the job.

There's a good amount of supporting documentation for the various features, and templates to get you started with web app hosting using the popular Python frameworks.

Conclusion

With the ever increasing power of Android devices, it makes sense that they should be capable of light development tasks. Pydroid3 is my preferred way of writing and running Python code on the go. It is lightweight and capable, supporting a wide variety of packages.

For hosting a Python website, Python Anywhere is tough to beat. The online editing experience might be glitchy on Android, but it is still a useful way of writing and running Python through a browser. The bonus is you can access your files from any device, not just Android.

I was pleasantly surprised to find a mature solution to the coding on the go problem. One that didn't cost a fortune, or require any jailbreaking.

end