I was recently looking to set up an environment for Python development on a (new) Windows PC. Historically, when using Python I’ve either used Eclipse with PyDev or just used Linux. But, was this was a Windows PC, and I didn’t want to run Linux in a VM, I wanted a solution that would run native in Windows. However, I didn’t want to install something as “heavy” as Eclipse. After some investigation and some trial and error, I came up with a solution that is centered around the Atom.io editor.
The following is a guide on how to set up Atom.io for Python development:
Step 1: Install Python
The first step to setting up any Python development environment is setting up Python of course. I recommend using the latest version of Python 3 (3.6 at the time of writing). You can acquire the latest version of Python here.
With the installer downloaded, just follow the default options to complete installation.
Step 2: Install Atom
Just like Python, we need to install Atom. You can get it here.
Step 3: Install Script Package to Atom
The Script extension for Atom allows you to run Python code directly from Atom (the extension is also capable of running other languages as well). To install Script:
- Launch Atom Settings (CTRL + ,)
- Go to the Install tab
- Search for
More information on the Script extension can be found here: https://atom.io/packages/script
Step 4: Install flake8 Linter
A linter is a component of an editor that does syntax checking. The flake8 linter provides rigorous checks and enforces PEP8. We need to install the flake8 linter to our system before Atom can leverage it (through another package we will add in the next step). To install flake8:
- Launch a Windows Command Prompt as an administrator
- Run the following commands:
pip install flake8
pip install flake8-docstrings
Flake8 should now be installed.
Step 5: Install linter and linter-flake8
These are both Atom packages, linter-flake8 enables Atom to use flake8 and it depends on the linter package.
- Go to Atom Install Tab (under settings)
- Search for:
This will find the linter package. A search for linter returns too many results to quickly sort through.
- Install linter
- Search for:
Step 6: Write awesome Python Code
You should be completely setup and able to write and run Python code in Atom. Flake8 will constantly prompt you when you’ve made a syntax or formatting error. To run your code, use the CTRL+SHIFT+B hotkey combination