Before starting, you will need to know what you want to do with Python. Are you creating script for processing files (batch jobs)? Are you creating scripts to enhance your website? Are you planning on building desktop apps (you can). Are you planning on building Mobile Apps (you CAN)? Database apps? You certainly can. However, before downloading and installing anything, please do some planning and read this article.
How Python Works
Very Basically, Python is an interpreted language. This means that your script files (written with good python code) are loaded into a compiler, along with the essential library files when the program is run. The actual compiler varies from operating system to operating system. Thus, your program will run on MacOS/OS X, Linux, iOS, Android and something else (I forget the name of that other OS). Thus, any UI elements that you use will be rendered to work on the destination OS. That means the dropdown list you added to your program will look slightly different on Windows (that’s it!), than on Linux, but they will behave the same way.
Basic Python and Idle for Learning
The natural inclination is just go to the Python website and download the basic Python files and Idle (if your flavor of Linux probably already has it installed). With some planning, you can have multiple versions of Python installed in various environments (sometimes called virtual environments). You should be aware that it can get a bit messy, so you may want to have your IDE (Integrated Development Environment) manage these environments for you, but you may not want to do this at this time.
Let’s check if you have python installed.
My system told me that I have Python 3.8.10. However, Python is currently on 3.10.1, and you can update it by typing
sudo apt-get update sudo apt-get install python3.10
Obviously, if you are going to do the minimalist approach, you will use Idle (the Python Editor that comes with Python) or a text editor and launch your programs manually with the Python command. But why? There are so many better ways to do this. I know so many dedicated people who say your not using Linux unless you do everything in the command line. I say the Nay. We want to use Linux to make our lives easier, not harder.
Integrated Development Environments for Python
Most IDE environments will support Python, and that should make your development process a little better. I am thinking of Eclipse (PyDev), CodeLobster and a multitude of others. They are good for getting started, but one of Python’s biggest advantages is also a millstone of sorts. These are the Libraries you can use. This is preexisting code containing Objects and methods (code). For example, let’s get back to the dropdown list. You don’t need to write the coded needed to design and create from scratch your dropdown list. You just import the library you need (from the very many available), and then create an object based upon the imported class.
This is a lot to manage, and a lot to remember. Fortunately, good IDE’s have something called code hinting. This means that when you start typing, suggested code based on your keystrokes will pop-up. This really, really helps. A Lot! Again, many people will say that if you cannot program in a Text Editor, you’re not really a programmer. Well, that may be true, but that doesn’t mean you cannot create a program.
The importance of Virtual Environments
Another feature that you may not think you need (but trust me you will) is your Virtual Environment. It is quite possible that you could have various installations and versions of Python. In addition, you may want to build some applications with one set of libraries (for example a connection to MySQL), but it would not be needed in a drawing program. Virtual environments allow for this. In addition, it is possible that an environment could be corrupt with various libraries being removed and added. You can experiment freely without doing damage to your computer’s configuration.
Available IDE’s for Linux
All three IDE’s are open source and free to download and use. Pycharm does have a paid version that allows for development in other languages.
I will start with Spyder because it is the most specialized. I have worked with many different IDE’s (Visual Studio, Dreamweaver, various flavors of Eclipse…) and I found this the most onerous to set up and work with. There are a lot of options, and it is somewhat complicated by its integration with the Anaconda framework (which is not essential for working with it). It describes itself as being more dedicated to scripting for scientific research and charting, but it is fine for most development needs. However, I found it to be a bit bloated and awkward. You may like it. It meets all of the basic needs, but it is not the most elegant of solutions.
I like Komodo. It was easy to install, supports virtual environments (although not the easiest implementation) and adding additional libraries is straight forward.
If you have every worked with Python, you know that indenting your code properly is important (albeit annoying). Komodo has several code cleaning options that make it easier to detect and fix errors.
I used Komodo a couple of years ago for other Non-Python projects, and it is a stable, very customizable environment. It works very well with python and is free. The only complaint that I have with it is that when working with external GUI files, sometimes they do not load properly. In addition, adding external libraries can be a bit awkward.
One Caveat with Komodo is that it is not the easiest to install, and requires you to create an account with Activestate, and on the Linux environment, there is integration with their cloud servers. This was not the case with the MacOS version, however.
However, they only reason I don’t use Komodo is because of…
PyCharm by Jetbrains is GREAT program and IDE. There is a reason why it is used with most of the Python video tutorials. It is very easy to use and configure, and setting up projects with a new virtual environment is very simple. However, the best feature is the management of virtual environments and libraries. Its basic code cleanup is very sound as well (not as good as Komodo’s).
Installation is much easier as well. Quite honestly, I always prefer to go to the Ubuntu Store. I do not always want to download a program from a site I do not know(and trust) and have to type commands into the terminal and answer 25 prompts. This process was much less painful. You could also download and use the Jetbrains Toolbox, which helps the process, but also is best utilized for managing multiple JetBrains applications.
Unless you really are opposed to it, you should embrace PyCharm as your IDE. The only reason you would choose another IDE is if you are a high end developer working with large teams and do not need a lot of overhead…but then you would not be reading this article.
Bonus Program – DB Browser for SQLite
At some point you are going to want to manage a database. Komodo has fairly decent support for databases built in, but if you want to persist user information (settings or selections), SQLite is the way to go.
DB Browser for SQLite is a great way to get started. It lets you design your database with a very familiar and friendly interface (albeit dated looking). And connecting to a SQLite database is python3 is very simple. Just three lines of code to get started.