Using Atom as a Python editor


The most basic way to create and run a Python program is to create an empty file with a .py extension, and point to that file from the command line with python filename.py. Alternatively, you can use the default Python IDLE which comes installed with Python. You can write and execute your code inside IDLE. However, if you want to be productive, the first two options would not be the best ones. You would want to use something such as the Atom editor.

Atom was built by GitHub with the slogan “A hackable text editor for the 21st century”. And it is really flexible and has a great support of external packages which make it a powerful Interactive Development Environment (IDE).

Here are the steps that will get you up and running with Atom:

Download and install Atom from https://atom.io/
Once you install atom, you can launch it by typing atom in the command line. If that doesn’t work, make sure atom has been added to you search path/environment variables. Atom should look like this:

New Bitmap Image (5)

A more convenient way though to open Atom could be to right click on a folder where your files are and then go to Open with Atom. That will add all the files of that folder to the tree view just like you see in the above screenshot. This is great when the program or the web app you’re developing consists of multiple files. You can just jump from file to file and edit them from inside Atom.

But, how to execute a Python file in Atom?

Well, you can open the command line and point to the file paths or you can use a great Atom package called platform-ide-terminal. which integrates with Atom so you can execute the files from within Atom.

To install a package, go to File -> Settings and then to Install and search for the name of the package (i.e. platformio-ide-terminal). Once you have installed the terminal-plus package you can find the tool and open a terminal instance by going the Packages. A quicker way though to open a terminal is to click on the plus sign that has been added at the bottom of the Atom window. That should open the terminal:

New Bitmap Image (5)

As you see the terminal points to the main directory of your files. You can now execute Python scripts from there as shown in the screenshot above.

You can split the editor into several windows.  

When you have more than a file opened inside Atom, you can go to View -> Panes -> Split Right to send the current file to the right half of the window. This can boost your productivity when working with multiple files.