Tutorials
r programming
+2

Overview of Atom IDE

In this tutorial, you'll learn the importance of IDEs, how to set-up Atom, and download packages.

Getting started with data science? Can't decide what language is best for you: R, Python or both? Well, the best solution is to jump right into it and get your hands dirty with code. But wait, code where?

First thing first, you will need to download and setup R and Python on your machine. DataCamp has you covered: check out the Setup Data Science Environment tutorial that walks you through the steps to do just this. Once you've got the environment set, you can start coding. The tutorial guides you through RStudio, an integrated development environment (IDE) which is excellent for working with R. The tutorial also introduces you to Jupyter Notebook that lets you create and share documents which contain live code, equations, visualizations as well as text and can be used with both Python and R. However, Jupyter Notebook is not the best option for deploying real-world projects. So then what? What IDE or code editor should you use?

In this tutorial, you shall learn about Atom - a free and open-source text and source code editor for macOS, Linux, and Microsoft Windows. You shall see why Atom is cool and the IDE right for you. Let's get started...

Why IDEs and Code Editors

Why do you need an IDE or a code editor? You can always push commands on a terminal and execute your programs, whether R or Python. However, doing this for large programming projects can be pretty frustrating - especially if you aren't used to the command line interpreter applications. Using an IDE or a good code editor can make coding easier and fun. They are coding tools that allow you to write, test, and also debug your code in an easier way. So if you want to be productive, IDEs and code editors are the way to go! They can handle code graciously - providing code auto-completion, syntax highlighting, resource management, debugging tools, etc.

What and why Atom?

Atom is a free and open-source text and source code editor developed by GitHub (Atom – A Hackable Text and Source Code Editor for Linux). Its developers call it a "hackable text editor for the 21st Century" (Atom 1.0). Atom enables users to install third-party packages and themes to customize the features and looks of the editor, so you can set it up according to your preferences and with ease (Atom). It is as welcoming to a newbie as it is for an experienced developer.

But what makes Atom so great for data science is that it allows you to work with R and Python in a consistent manner. And these two languages are not the only supported languages, Atom's default packages can apply syntax highlighting for the following programming languages and file formats: C, C++, C#, COBOL, CSS, CoffeeScript, Go, HTML, Java, JavaScript, JSON, Perl, PHP, Ruby, Scala, SQL and many others as well (Atom).

However, in this tutorial, we shall focus more on Atom for Python.

Installing Atom

To get started with Atom and get in on your system, head over to their official website. At the top of the page you should see a download button as shown here:

The download button should be specific to your platform, and the download package should be easily installable.

Fire it up

Once you have Atom installed on your system, let's get busy. When you launch Atom for the first time, you will get this screen:

Source: Atom Basics

This is the welcome page and gives you a good starting point on how to get started with the editor.

Setting up Atom

You can go to the 'Settings View', that gives you a number of settings and preferences you can modify. To open the 'Settings View':

macOS: Atom > Preferences menu item in the menu bar > Search for settings-view: openin the Command Palette

Windows: File > Settings menu item in the menu bar > Search for settings-view:open in the Command Palette

Linux: Edit > Preferences menu item in the menu bar > Search for settings-view:open in the Command Palette

In the 'Settings View', you can change the theme - the way Atom looks, you can choose a color scheme that makes the code easier for you to read at a glance. You can also specify your whitespace and wrapping preferences, change font settings, the tab size, adjust the scroll speed, etc. "You can also use this screen to install new packages and themes" (Atom Basics). You shall see later, how you can install new packages.

Working with files

An easy way to fire up Atom and when you already have a file or a folder of files that you want to edit using Atom is to right click on the folder and then choose Open with Atom. This will add all the files in that path and open it in a tree-like hierarchical view in Atom. This comes handy when dealing with a project containing multiple files. You can switch from one file to another and edit them, all within Atom.

You can also open a file in Atom using the command line. Use the command atom for this. "You can run the atom command with one or more file paths to open up those files in Atom" (Atom Basics). Type the command atom --help to learn more about the atom command. This is great if you are used to working with the terminal. Just run the command, and you're ready to start editing your file.

To save a file you can simply choose File > Save from the menu bar or use the shortcut Cmd+S or Ctrl+S (depending on your platform) to save the file. Also, you can save your file with a different file name, choose the File > Save As (Cmd+Shift+S or Ctrl+Shift+S).

You can have two files opened simultaneously next to each other (appearing together on the screen). Go to View > Panes > Split Right to send the current file to the right half of the window. You will find this to be a beneficial feature when coding and is sure to boost your productivity.

Atom Packages

Atom in itself comes with fundamental functionalities, but you can use a number of useful packages that add new features. Packages are incredibly powerful and can change everything from looks to the feel of Atom's interface and even the basic operation of even core functionality in Atom.

To install a new package, use the Install tab in the previously seen 'Settings View': open up the Settings View > click on the Install tab > type the package name you are searching for into the box under Install Packages.

This is the official registry for Atom packages, and you will find the listed packages here. Searching on the 'Settings View' will go to the Atom package registry and pull anything that matches your search terms.

Some handy packages

Here are some of the packages that can come in handy when starting off...

  • Autocomplete If you’re just starting out in Python, it can be beneficial to have the auto-complete feature. "The autocomplete system lets you view and insert possible completions in the editor using Tab or Enter. The Autocomplete functionality is implemented in the autocomplete-plus package" (Autocomplete).
  • platform-ide-terminal This package is useful to execute a Python file in Atom. It integrates with Atom and allows you to execute the files from within Atom itself. Once you have installed the terminal-plus package, click on the plus sign that has been added at the bottom of the Atom window and this should open the terminal.

Go Atom!

Hopefully, this tutorial helped you get started with Atom. This is one of the steps in choosing your flavor when coding with Python or R, an essential step for any data scientist. If you would like to learn more about data science tools, take DataCamp's Introduction to Git for Data Science course.

Want to leave a comment?