Since Linux is the most used OS for development, I also have chosen Linux as my main OS (not just for development, but also for day to day use).
So, naturally, all future posts here will with Linux in mind, if not specified otherwise.
For my needs I chose a derive from Arch Linux known as ArcoLinux (https://arcolinux.info/), which makes installation, maintenance and usage of the OS so much simpler, but it also teaches you how to get to the point of using native Arch, if that is your target.
But this article is not about Arch/Arco Linux, it is about python, and my journey into learning python at a higher level.
As with everything else in live, a journey starts with the first step, and in my case, the first step was to install python and the rest of the required dependencies into my system.
In Linux, especially, but not limited to, Arch Linux, the process is very simple and straight forward:
- open a command line and type the following to install python:
sudo pacman -S python
You will be prompted to input your root password and then asked to proceed with the installation, by typing Y or pressing Enter key.
And now, the latest version of python available of Arch’s repositories is installed on you system. To quickly check, just open a terminal and type:
and you will have an output similar to the one below:
With the last step completed you are basically done, no further steps are required for you, just start coding … unless you want to learn a few more tricks.
I know this is not mandatory, but for me at least, I discovered that this console really helps new developers, so I a suggesting to everyone to install bpython. In essence bpython is python CLI (command line interface) client on steroids (the good ones, if such a thing exists), and I will explain why.
But first let’s see how can we install it on our machine. Same as previously, we can use pacman package manager to install the package for us:
sudo pacman -S bpython
or we can go with yay, for more options (which might not be available in pacman):
yay -S bpython
Off course we need to make sure our version of bpython is compatible with our actual python version, so if you are using python 3, you can go with bpython, if you use python2, you will need to install bpython2 which might be confusing, but that’s the way the packages are named in arch repositories. NOTE: python2 will be deprecated (support and security patches will continue for a while, but no further development will be done for this version) at the beginning of 2021, so you might go straight to python 3 (latest version available at the time of writing this article is 3.9.1).
Bpython is an interactive CLI client for python and is mostly used when you do not want to open an editor, because you are just quickly scanning for an info (let’s say you need to check the methods for a module, or something similar). You would not open a full fledged editor to write a line or two of code to get your info as is counter-productive, instead you can launch python or bpython and get the info faster that way:
The main differences between the original python CLI and bpython are:
- dynamic suggestion (text is filtered while you type)
- suggestions (bpython gives you suggestions based on what you type and filters the results shown)
- syntax highlight
As this article is getting too long already I will stop here, as I believe the above are enough to get you started with python development. One thing you might do is to install a text editor (it really does not matter which one, you can use the one build into your OS). If you need an editor with extended capabilities, like syntax highlight, auto-completion and suggestions, I would recommend you to look for Visual Studio Code, PyCharm Community Edition, Kate/Kwrite (specific for Linux), Notepad++ (specific for Windows).
I hope you find these info useful and they get you motivated to start writing code.
KEEP ON CODING!