Running a Python program in Linux is as simple as executing the Python file in the terminal.
But that’s not very convenient for everyone and it doesn’t help you debug your programs. Too raw.
There are several IDEs and text editors that can be used for Python development. The PyCharm community edition is available for Linux users.
I recently came across another IDE specifically crafted for Python beginners. I liked the idea of this application and hence I am sharing it with you here.
Thonny is a cross-platform, open source Python IDE for beginners
Thonny feels like the Python version of Eclipse in terms of UI and UX. And that’s not entirely a bad thing considering most C++ and Java beginners start with Eclipse and many stay with it afterward.
It’s not a new tool. It has been on the horizon for some years now. I don’t code in Python so I never discovered it until recently.
Dedicated to Python, Thonny has features that help Python beginners understand how their program behaves. Let’s take a look at those features.
Plug and play
Thonny comes with Python so you don’t need to do additional effort for installing Python. That’s not a big deal for Linux users as most distributions have Python installed by default.
The interface is simple. It gives you an editor where you can write your Python program and hit the Run button or use F5 key to play the program. The output is displayed at the bottom.
See variables
From the View->Variables, you can see the values of all the variables. No need to print them all.
Built-in debugger
Run your program step by step by using the debugger. You can access it from the top menu or use the Ctrl+F5 keys. You don’t even need the breakpoints here. You can go into big steps with F6 or in small steps with F7.
In small steps, you can see how Python sees your expressions. This is very helpful for new programmers to understand why their program is behaving in a certain manner.
That’s not it. For function calls, it opens a new window with separate local variables table and code pointer. Super cool!
Syntax error highlighter
Beginners often make simple syntax errors like missing paranthesis, quotes etc. Thonny is points it out immediately in the editor itself.
Local variables are also visually distinguished from globals.
Auto completion
You don’t have to type everything. Thonny supports auto code completion which helps in coding faster.
Access to system shell
From the Tools, you can access the system shell. From here you can install new Python package or learn to handle Python from the command line.
Please note that if you use Flatpak or Snap, Thonny may not be able to access the system shell.
Manage Pip from GUI
Go to Tools and Manage packages. It opens a window and you can install Pip packages from this GUI.
Good enough features for learning Python, right? Let’s see how to install it.
Installing Thonny on Linux
Thonny is a cross-platform application. It is available for Windows, macOS and Linux.
It’s a popular application and you can find it in the repositories of most Linux distributions. Just look for it in your system’s software center.
Alternatively, you can always use the package manager of your Linux distribution.
On Debian and Ubuntu-based distributions, you can use the apt command to install it.
sudo apt install thonny
It downloads a bunch of dependencies and around 300 MB of packages.
Once installed, you can search for it in the menu and install it from there.
Conclusion
There are plenty of other Python IDEs available for Linux.
Thonny is a decent tool for beginner Python programmers. Not that experts cannot use it but it’s more suited to be used in schools and colleges.
Students will find it helpful in learning Python and understanding how their code behaves in a certain manner. In fact, it was originally developed in the University of Tartu, Estonia.
Overall, good software for Python learners.