Portable coding in Python is possible, thanks to the Pydroid 3 integrated development environment (IDE). Pydroid is a minimalist Python 3 interpreter that lets you execute minor projects and do minimal coding on your Android device.
If you also want to learn Python programming anywhere without a PC, while replicating the PC platform for Python on Android, Pydroid 3 is the right app to try out.
Whether you're new to Python programming or you're an expert, let's see some of the ways you can use Pydroid 3 to its full potential on your Android device.
Get Pydroid 3 and its Plugins Set-up
The Pydroid 3 IDE is available on the Play Store. However, to make the app more useful and easy to work with, you need to download the Pydroid repository plugin from the Play Store. While installing this plugin might not be compulsory, it makes automatic pip installation of packages much easier.
By default, Pydroid 3 doesn't have permission to access your device storage. This makes the creation of project folders difficult or impossible without some technical manipulation. To solve that problem, download the Pydroid permissions plugin from the Play Store, which allows Pydroid to create folders and files on your device.
Download: Pydroid 3 - IDE for Python 3 (Free, in-app purchases available)
Download: Pydroid repository plugin (Free)
Download: Pydroid permissions plugin (Free)
Pip Install Packages
Once you have everything set-up, you can start using pip to install packages for your projects, just like on a PC. Pydroid 3 comes with an interface that allows you to install packages without writing your commands in the terminal.
There are several ways to install pip packages on Pydroid 3. To access that feature, tap on the menu icon (which looks like three lines) at the top-left corner of the app. Next, go to Pip. At the top of the Pip menu, select SEARCH LIBRARIES to get more options about the module you want to install. Or you can tap the QUICK INSTALL option to install the packages listed by default.
However, a better and free-hand option is to tap on INSTALL and check the Use prebuilt libraries repository box. Next, type your preferred package name in the search bar and tap the INSTALL button to get the named package.
To check if the package was installed successfully, tap the LIBRARIES option. That menu gives you access to a list of all currently installed libraries.
Use the Inbuilt Pydroid 3 Command Line Interface
Pydroid 3 offers a minimal Linux command-line interface (CLI) as well. To access it, tap on the menu icon at the top-left corner of the app, and select Terminal.
Although running the pip install packages command via its inbuilt terminal takes some time to load, it still lets you navigate easily between folders and create new ones wherever writing permission is allowed on your device. However, while the slow loading of pip installing packages via the terminal is a minor issue with the Pydroid IDE, its Pip menu solves it.
If you want to use the provided command line for any other purpose, the Android OS is built on Linux, so you need to have a basic understanding of how to use the Linux command line.
Use the Python Shell
The blank page that appears when you open Pydroid 3 is its inbuilt Python shell. Just like the Python shell on your PC, it sees any command written on it as a Python code by default.
To use the shell, type any Python command and click the big play button at the editor's lower-left corner. This opens a Python interpreter that displays the output of your code.
However, you can also access the Python shell from the command line. To do that, go to Terminal by clicking on the three menu icon at the app's top-left corner. Next, type python and tap the enter arrow on your soft keyboard to open the command line Python interpreter. Type exit() to leave the command line Python shell.
Save Folders and Files on your Device
Just like any other code editor, Pydroid 3 has an interface that lets you save your file in any named folder on your device. If you want to create a project folder, you also get to make new folders with its file saving options.
To use the folder option, tap the folder sign at the top-right corner of the editing shell. Tap Save and select InternalStorage. Next, tap on a preferred destination folder and tap SELECT FOLDER at the top of the screen. On the next menu, enter a preferred file name and click on SAVE.
However, if you like to create a new project folder, repeat the process above, but tap on the NEW FOLDER option instead of SELECT FOLDER. Give your new folder a preferred name and tap CREATE to save the folder. Next, click on the SELECT FOLDER option. Name your new file and tap SAVE to save your new file in the folder you just created.
Note that the newly created file doesn't need a file extension if it's a Python file. But in case you need to use another language file to serve your project, ensure that you include the file extension that applies to that language while saving such a file. For instance, a CSS file should be saved as Name.css, replacing Name with your preferred file name.
To update the changes you've made to an existing file, tap the folder sign at the top-right corner of the editor, and select Save.
To create a new file entirely, tap the folder sign. Select New and follow the steps highlighted earlier to save your file in a folder. If you want your new file to be in the same directory as the existing one, ensure that you select the same folder that contains the existing one.
Publish your Source Code on Pastebin
You can share your knowledge and progress with others on the Pastebin platform if you like. To do that, tap the three menu icon at the top-left corner of the app. Next, select Pastebin and tap Yes. On the next menu that pops up, tap COPY URL to copy the link to your source code.