Skip to content

01 Overview

Austin edited this page Dec 13, 2017 · 1 revision

Overview

About atom-python-run

This package tells atom to make a system call which then executes your program for you.

All my examples will utilize the command line when available.

  • cp is a cli tool that utilizes flags to control the current running process.
  • terminal is a module that creates a default process according to its system type.
  • atom-python-run is the module that passes the call to spawn a process, execute your script within a sub-process, exits, and then pauses the current running process.

How to access the command line

Windows

  • win + r
  • type in cmd
  • press enter

Mac OS X

  • cmd + space
  • type in terminal
  • press enter

Linux

  • open your preferred terminal

atom-python-runs default directory

Windows

  • %USERPROFILE%\.atom\packages\atom-python-run

Mac OS X and Linux

  • ${HOME}/.atom/packages/atom-python-run

Setting the directory to the package in the terminal window

Windows

cd .\ -> is the current relative path
cd ..\ -> is the relative parent directory path
cd C: -> is the current relative path
cd C:\ -> is the absolute path

Accessing the atom-python-run package on Windows

C:\> cd {path-goes-here}
    or
C:\> cd %userprofile%\.atom\packages\atom-python-run

Accessing atoms console

Windows and Linux

  • Open atom
  • Ctrl + Shift + I
  • Click the console tab

Mac OS X

  • Open atom
  • Cmd + Alt + I
  • Click the console tab

Accessing the debugger

Node

Access the desired directory

$ pwd
${HOME}/.atom/packages/atom-python-run
$ cd lib/
$ pwd
${HOME}/.atom/packages/atom-python-run/lib
$ ls -l
total 20
-rw-rw-r-- 1 $USER $USER 5347 Sep 27 16:39 atom-python-run.js
-rw-rw-r-- 1 $USER $USER 9064 Sep 27 16:39 terminal.js
$ which node  # I use `nvm`, so it shows me `nvm`s path to `node`
${HOME}/.nvm/versions/node/v6.11.2/bin/node

Then activate the debugger using node

$ node debug terminal.js
< Debugger listening on [::]:5858
connecting to 127.0.0.1:5858 ... ok
break in terminal.js:1
> 1 'use strict';
  2 
  3 
debug>

Python

Access the desired directory

$ ll
total 8.0K
drwxrwxr-x 2 $USER $USER 4.0K Sep 27 16:39 cp/
-rw-rw-r-- 1 $USER $USER 2.0K Sep 27 16:39 main.py
$ pwd
${HOME}/.atom/packages/atom-python-run/cp
$ python -V
Python 2.7.12

Then activate the debugger using python

$ python -m pdb main.py 
> /home/th3ros/.atom/packages/atom-python-run/cp/main.py(28)<module>()
-> from __future__ import absolute_import
(Pdb)

atom-python-runs directory structure

An overview of the core directory structure for the atom-python-run package

$ tree atom-python-run/
atom-python-run/
├── CHANGELOG.md
├── cp
│   ├── cp
│   │   ├── __init__.py
│   │   ├── parse.py
│   │   └── utils.py
│   └── main.py
├── keymaps
│   └── atom-python-run.json
├── lib
│   ├── atom-python-run.js
│   ├── terminal.js
│   └── test.js
├── LICENSE.md
├── package.json
└── README.md

4 directories, 12 files