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.
Open up any browser on your Android device and paste the copied link on the search bar to see your source code on Pastebin. You can also share this link with the people you like to give access to your code.
Customize the IDE
You can also customize the development environment if you like. To change the appearance of your editor, tap the three menu icon at the top-left corner of the screen and go to Settings > Appearance to switch to your preferred theme, or select other available appearance options.
To get more customization features, tap the Editor option and select your preferences. You can also tap the other options within the settings menu to see the options available to you.
However, when you click on the three menu dropdown icon, the Terminal settings option offers some terminal configurations as well.
Pydroid 3 Is a Python Virtual Environment on Android
Installing the Pydroid 3 IDLE on your Android device automatically downloads and installs Python 3 on it as well. However, the installed Pydroid 3 IDLE for Python functions as a virtual environment on Android.
That’s because trying to run the Python shell outside the command line of the Pydroid IDLE throws an error.
If you care to play around and try that out, you need to install a dedicated third-party Android CMD app, preferably Termux from the Play Store.
Once you install Termux, open it, ensuring that you’ve installed Pydroid 3 as well. Then type python on the Termux CMD. It throws a file directory error, indicating that Python doesn’t exist in the global Android space until installing it with the pkg install python command via Termux.
However, running python on Pydroid 3 inbuilt terminal successfully enters the Python shell.
Download: Termux (Free)
Can you Use Pydroid for Any Project?
While coding on Android might be interesting, using Pydroid to manage a big project isn’t advisable. However, it’s another way to embark on minor projects, especially when they’re not for long-term real-life purposes.
Beyond managing small projects, Pydroid 3 is also a great tool to play around with to improve your Python coding skills, especially if you don’t have a PC to run your Python programs.
We explain an important fundamental of code reusability in Python: modules.
About The Author