Making Atom first class Python IDE with help of Nuclide

@mlesyk   2018-11-02 21:04   Development  
ide python

First of all, you need Python 3 installed in your system, otherwise, install it.
Before we actually start set up Atom, we need install few dependencies of our environment.
I recommend install them in dedicated Python virtual environment, so it will be easy to port or back it up.
I’ll use Python 3 built-in module venv, but you can pick any other alternative.

python3 -m venv ~/.devenv
source ~/.devenv/bin/activate
python3 -m pip install wheel

Then we need to install following packages:

  • black - used for auto formatting of code
  • flake8 - used for static analysis of source code and checking for symantec discrepancies
  • flake8-mypy - flake8’s plugin for integrating of mypy - used for type checking
  • isort - used for automatic sorting of imports
  • jedi - used for autocompletion
source ~/.devenv/bin/activate
python3 -m pip install black flake8 flake8-mypy isort jedi

Then, at last, install Atom for your operating system and let’s start hacking it!

After installation of Atom, let’s install following packages:

  • atom-beautify - auto formatting, cleaning, beautify of code
  • atom-jinja2 - jinja2 templating language syntax support
  • file-icons - unnique icons for every file type
  • file-watcher - notify if file changed on disk and optinally reloads it
  • git-plus - adds all possibilities of git to Atom
  • hidpi - useful if you have big monitor and decide interface too small
  • highlight-selected - highlight occurrences of a selection within the open editor
  • nuclide - primary part of turning Atom into IDE
  • python-isort - sorting items in Atom, soon will be replaced with isort support in atom-beautify + black
  • set-syntax - easy selection of syntax for file
  • sort-lines - sort selected lines in one action
  • tool-bar - adds empty toolbar. To fill, needs additional plugins.
  • tool-bar-main - adds basic buttons to tool bar
apm install atom-beautify atom-jinja2 file-icons file-watcher git-plus hidpi highlight-selected nuclide python-isort set-syntax sort-lines tool-bar tool-bar-main

Configuration of Atom is stored in ~/atom/config.cson. By default it is empty.
I’ll post my config here with comments - you could just paste it as-is or remove/delete some sections.
All config options are available through UI, but copying of file will save some time.

    # allow formatting files on save for particular languages - disabled by default
      beautify_on_save: true
      showLoadingView: false
      beautify_on_save: true
      beautify_on_save: true
      beautify_on_save: true
      beautify_on_save: true
      beautify_on_save: true
      beautify_on_save: true
      # select black formatter
      default_beautifier: "black"
      # Not working yet, waiting for
      sort_imports: true
      beautify_on_save: true
    # do not update Atom autmatically - I prefer doing it manually
    automaticallyUpdate: false
    # if file is deleted outside Atom - close appropriate tab
    closeDeletedFileTabs: true
    # do not close Atom if last tab is closed and "close tab" signal is sent to Atom
    closeEmptyWindows: false
    # changed by nuclide
      "source.ini": [
      "source.json": [
      "source.python": [
    # tree-view, image-view, language-gfm are disabled by nuclide
    # welcome - disable welcome screen, metrics - do not send metrics
    disabledPackages: [
    # do not send telemetry
    telemetryConsent: "no"
    fontSize: 12
    userId: "0a55fa38-92d9-44bd-83a7-6f763c9f73e1"
    # I prefer monochrome icons
    coloured: false
    # do not format code on type - it is formatted by save in atom-beautify
      formatOnType: false
    # by default datatips are too annoying - if I need some info about it, I'll wait 3 seconds
      datatipDebounceDelay: 3000
      datatipInteractedWithDebounceDelay: 100
      analyticsTimeout: 60
      viewTimeout: 60
      # disable home screen
      showHome: false
      # I do not like filling arguments for me
      autocompleteArguments: false
    checkOnSave: false
    # sort python imports on file save
    sortOnSave: true
    # reduce toolbar icons size
    iconSize: "16px"
    # put toolbar from the left side
    position: "Left"
    # I have no mac book, so not using touch bar
    useTouchBar: false

So, now we have Atom and all packages installed and it looks like screenshot in the beginning of article. In next post I’ll review Nuclide and will show couple of tips and tricks.

 Back to main