Created by GitHub and initially released back in 2014, Atom was one of the first supersonic editors made with coding in mind. It solved issues that Sublime, TextMate, Emacs, and Vim could not do at the time of its original release – that is, be an approachable and easy-to-use code editor that is also flexible to code with.
The idea is that anyone – new and old – to coding can easily download Atom and use it right out of the box. In addition to this, Atom was created with extensibility in mind. As one of the first editors with the ability for anyone to create extensions, there is an abundance of add-on tools available through packages.
What is Atom?
Python developers have an obsession with Atom. The text editor comes with a dedicated pluggable Python compiler and can be set up as a Python IDE. Python packages for Atom are mostly community-driven, meaning that it supports features and functionalities that aid the productivity workflow for Python development.
Why Choose Atom for Python Development?
Atom is designed to support and be multi-language. When it comes to Python, the language is lightweight and highly dynamic, which means that it can exist in hybrid projects that include HTML, CSS, Java, and other integrations. Atom streamlines the process of efficient Python workflows through plugins that extend the core functionality of being just a text editor out of the box.
In addition to this, Atom comes with pre-installed themes and syntax highlighting that’s optimized for Python. Due to its “hackability”, it’s easy to customize Atom for it to do whatever you want.
Atom’s IDE-python package also leverages the editor’s core features and adds features such as completions, definitions, references, symbols, renaming, error detection, styling checking via linting, and code formatting.
Setting up Atom for Python
Before we begin, you need to make sure that you have Python installed on your machine. Without it, Atom cannot run Python scripts because there is no interpreter available. To do this, go to python.org/downloads and select the installation package for your machine. By default, the site’s detection mechanism will give you what you need without having to search around for the right one.
Once installed, you should have access to Python commands.
To leverage Atom as a fully-fledged Python editor, you will also need to download Python language server. To do this, use the following command:
|python -m pip install ‘python-language-server[all]’|
To verify that Python is installed and available on your machine, use the following command:
|python -m pyls –help|
If Python language server is installed correctly, you should see something like this:
|usage: pyls [-h] [–tcp] [–host HOST] [–port PORT] [–log-config LOG_CONFIG | –log-file LOG_FILE] [-v]
Python Language Server
What then is a language server?
A language server is a diagnostic and linting tool that runs on the user’s code. For example, it can check inheritance, arguments, parameters in class methods, positional arguments, and various errors. Python language server is specific to the requirements of Python.
Once completed, you’ll need to download Atom. You can do this directly at atom.io. The browser will detect your system’s requirements and offer you the right installation package or instructions.
Follow the installation instructions and once you’ve got the base editor set up, you should have a screen that looks something like this:
Setting up Atom for Python IDE-Python
IDE-Python for Atom comes pre-packaged with a collection of other packages that turns your Atom editor into a fully integrated Python development setup.
The perks of using IDE-Python for Atom is that you don’t need to individually install every package extension to enhance and upgrade your workflow. This is because IDE-Python for Atom comes prepackaged with the following:
- Jedi for autocomplete, static analysis and refactoring
- Rope as another refactoring library to aide the process
- Pyflakes, a linter that also checks for errors
- McCabe, an extension that checks the complexity of your code
- Pycodestyle a check that puts your code up against Python’s language conventions
- Pylint analyses your code against coding standards, error detection and continuous integration
- Flake8 linter to detect various errors and coding standards violation
- pydocstyle linter for docstring style checking and code compliance
- autopep8 for code formatting
- YAPF for code formatting
Installing IDE-Python will install all the above package. To do this, you will need to install atom-ide-base – an Atom IDE package manager that coordinates the downloading and installation of all the different requirements.
To install atom-ide-base, run the following command:
|npm install –save-dev atom-ide-base|
Now you are ready to install IDE-Python by using the following command:
|apm install ide-python|
And that’s basically it. But is it really?
While IDE-Python sets up the general basics needed for effective and efficient Python workflow, there are three other main extensions you need to install. They are as follows:
It’s hard to navigate around your project folder quickly when everything looks the same. When pictures are worth a thousand words, icons are worth a thousand seconds every time you need to scan and look for something. Sure, Atom has default icons but it’s not extensive.
The Atom community has a file icons package that’s similar to vscode-icons for Visual Studio, with certain tweaks based on the icon needs and availability.
To install file icons in your Atom workspace, run the following command:
|apm install atom-file-icons|
There’s code autocomplete and then there’s Tabnine – an AI driven predictive code completion tool that works by analysing your repository and making suggestions based on past patterns.
What is coding with a minimap? The Minimap package does exactly what the name suggests and displays a minimap preview of your code on the right hand side of your editor. This is best used in conjunction with the minimap-git-diff and minimap-highlight-selected to leverage the full experience.
To do this, you can use the following commands:
|apm install minimap
apm install minimap-git-diff
apm install minimap-highlight-selected
Setting up for Python in Atom is super easy, especially when a majority of what you need is already pre-packaged in the IDE-Python. There is no need to install individual packages as the main ones have already been curated and pre-configured for you.
The only other main extensions you need as extras in addition to what IDE-Python provides are the icon files, Tabnine, and the minimap extensions. Once you’ve done that, you’re set to go on Atom and supercharge your Python code with a highly effective and efficient workspace.