Wednesday, March 30, 2016

Atom text editor: Configuration for OSX and setup for Python development

Setup
Mac download the dmg and install it in Applications

Create a Python virtualenv to install Atom depdencies in and to launch Atom from
Reference: https://virtualenv.pypa.io/en/latest/
From: http://www.marinamele.com/2014/05/install-python-virtualenv-virtualenvwrapper-mavericks.html

Start the virtualenv and cd to the virtual env with the Atom dependencies installed (you will install them below if you want).

Now launch Atom from inside of the virtualenv
$ /Applications/Atom.app/Contents/MacOS/Atom

Make an alias for launching Atom inside of the activated virtualenv

alias atom_mac="workon atom_editor_env; cd ~/.virtualenvs/atom_editor_env; /Applications/Atom.app/Contents/MacOS/Atom &"

Ubuntu-one way to do it
http://itsfoss.com/install-atom-text-editor-ubuntu-1404-linux-mint-17/

Atom Editor Keyboard Shortcut Cheat Sheets

Mac OSX key notes
Alt in the Atom docs is option on the Mac keyboard

Atom Python configuration
Install packages in Atom using the directions from the link below
From: http://www.marinamele.com/install-and-configure-atom-editor-for-python

Atom package installation list
Note: install all Python packages in a virtualenv (see above for the setup instructions)
https://atom.io/packages/box-edit
Alt-S to enable
Use the mouse to select
Cntl-{c,v}
Cntl-x does not seem to work in some cases

https://atom.io/packages/linter-flake8
pip install flake8
pip install flake8-docstrings
pip install hacking
You will need to open the Atom init script (Atom –> Open your Init Script) 

http://flight-manual.atom.io/
http://flight-manual.atom.io/hacking-atom/sections/the-init-file/

Add the following to the ~/.atom/init.coffee file:
Crayon Syntax Highlighter v2.7.1 # config option currently does not load correctly- do not use
process.env.PATH = ['/usr/local/bin/', process.env.PATH].join(':')


Project configuration files
Linter also supports reading flake8 configuration files. To use them, you need specify their names manually into Config Files Names in the package settings. Note that package settings from Settings panel will be ignored if a configuration file was found.

https://atom.io/packages/linter-pep8
pip install flake8
pip install flake8-docstrings

https://atom.io/packages/autocomplete-python

atom.io/packages/auto-indent
From: http://stackoverflow.com/questions/22611377/auto-indent-code-in-atom-editor
Package auto-indent exists to apply auto-indent to entire file with this shortcuts :
ctrl+shift+i
or
cmd+shift+i
Package url : atom.io/packages/auto-indent

https://atom.io/packages/linter
https://atom.io/packages//python-debugger
  1. Press alt-r (OSX: Option-r) to show the debugger view
  2. Insert input arguments in the input arguments field if applicable
  3. Hit the Run button. Focus moves to the first breakpoint.
https://atom.io/packages/language-python

https://atom.io/packages/python-tools

https://atom.io/packages/minimap
Minimap: Displays a small map of the current file on the right side of your document (like Sublime
Text by default).
Atom Tutorials
http://code.tutsplus.com/tutorials/check-out-atom-githubs-new-development-editor--net-37030
See the code snippets section

Using Atom as a Python Editor
http://pythonhow.com/using-atom-as-a-python-editor/


UNDER CONSTRUCTION!!
Lets build a script to install Atom with the python configuration on new machines.
1. Install apm

2.Install each of the atom packages above with apm
apm install atom-beautify
...
3. Create the python virutalenv

4. Add the alias to .bashrc

Now lets use Atom to edit Python files:
http://pythonhow.com/using-atom-as-a-python-editor/