Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
agermanidis committed Oct 6, 2017
0 parents commit 4a3418b
Show file tree
Hide file tree
Showing 220 changed files with 173,011 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["es2015", "react"]
}

7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
npm-debug.log*
.npm
*.lock
package-lock.json
.DS_Store
.vs-code
100 changes: 100 additions & 0 deletions .vscode/.ropeproject/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# The default ``config.py``
# flake8: noqa


def set_prefs(prefs):
"""This function is called before opening the project"""

# Specify which files and folders to ignore in the project.
# Changes to ignored resources are not added to the history and
# VCSs. Also they are not returned in `Project.get_files()`.
# Note that ``?`` and ``*`` match all characters but slashes.
# '*.pyc': matches 'test.pyc' and 'pkg/test.pyc'
# 'mod*.pyc': matches 'test/mod1.pyc' but not 'mod/1.pyc'
# '.svn': matches 'pkg/.svn' and all of its children
# 'build/*.o': matches 'build/lib.o' but not 'build/sub/lib.o'
# 'build//*.o': matches 'build/lib.o' and 'build/sub/lib.o'
prefs['ignored_resources'] = ['*.pyc', '*~', '.ropeproject',
'.hg', '.svn', '_svn', '.git', '.tox']

# Specifies which files should be considered python files. It is
# useful when you have scripts inside your project. Only files
# ending with ``.py`` are considered to be python files by
# default.
#prefs['python_files'] = ['*.py']

# Custom source folders: By default rope searches the project
# for finding source folders (folders that should be searched
# for finding modules). You can add paths to that list. Note
# that rope guesses project source folders correctly most of the
# time; use this if you have any problems.
# The folders should be relative to project root and use '/' for
# separating folders regardless of the platform rope is running on.
# 'src/my_source_folder' for instance.
#prefs.add('source_folders', 'src')

# You can extend python path for looking up modules
#prefs.add('python_path', '~/python/')

# Should rope save object information or not.
prefs['save_objectdb'] = True
prefs['compress_objectdb'] = False

# If `True`, rope analyzes each module when it is being saved.
prefs['automatic_soa'] = True
# The depth of calls to follow in static object analysis
prefs['soa_followed_calls'] = 0

# If `False` when running modules or unit tests "dynamic object
# analysis" is turned off. This makes them much faster.
prefs['perform_doa'] = True

# Rope can check the validity of its object DB when running.
prefs['validate_objectdb'] = True

# How many undos to hold?
prefs['max_history_items'] = 32

# Shows whether to save history across sessions.
prefs['save_history'] = True
prefs['compress_history'] = False

# Set the number spaces used for indenting. According to
# :PEP:`8`, it is best to use 4 spaces. Since most of rope's
# unit-tests use 4 spaces it is more reliable, too.
prefs['indent_size'] = 4

# Builtin and c-extension modules that are allowed to be imported
# and inspected by rope.
prefs['extension_modules'] = []

# Add all standard c-extensions to extension_modules list.
prefs['import_dynload_stdmods'] = True

# If `True` modules with syntax errors are considered to be empty.
# The default value is `False`; When `False` syntax errors raise
# `rope.base.exceptions.ModuleSyntaxError` exception.
prefs['ignore_syntax_errors'] = False

# If `True`, rope ignores unresolvable imports. Otherwise, they
# appear in the importing namespace.
prefs['ignore_bad_imports'] = False

# If `True`, rope will insert new module imports as
# `from <package> import <module>` by default.
prefs['prefer_module_from_imports'] = False

# If `True`, rope will transform a comma list of imports into
# multiple separate import statements when organizing
# imports.
prefs['split_imports'] = False

# If `True`, rope will sort imports alphabetically by module name
# instead of alphabetically by import statement, with from imports
# after normal imports.
prefs['sort_imports_alphabetically'] = False


def project_opened(project):
"""This function is called after opening the project"""
# Do whatever you like here!
Binary file added .vscode/.ropeproject/objectdb
Binary file not shown.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Anastasis Germanidis

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
![](https://i.imgur.com/TSNJJCm.gif)

## Livepython
### Watch your Python run like a movie.

##### NOTE: Livepython is alpha software. Lots of edge cases where it fails.

Livepython is a desktop app that lets you visually trace, in real-time, the execution of a Python program. It's meant to give you a quick grasp of a program's execution flow. It's less messy than sprinkling print statements throughout your code and simpler to use than debuggers/profilers.

Livepython can be launched from the command-line as easily as:

livepython [program] [args...]

### Compatibility

| **Python Version** | **Compatible?** |
|-----------|---------------|
| 3.6 ||
| 3.5 ||
| 2.7 ||
| 2.6 ||

### Installation



npm install livepython -g

### License

MIT
82 changes: 82 additions & 0 deletions bin/livepython
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/usr/bin/env node

const fs = require("fs");
var electronPath = require("electron");
try {
if (process.platform === "darwin") {
fs.statSync(__dirname + "/../livepython-darwin-x64/");
electronPath =
__dirname +
"/../livepython-darwin-x64/livepython.app/Contents/MacOS/livepython";
}
} catch (e) {}

const { spawn } = require("child_process");
const byline = require("byline")

var args = process.argv.slice(2)

if (!args.length) {
console.log("Usage: livepython [program] [..args]")
process.exit()
}

args.unshift(__dirname + "/../tracer.py")

const electronProcess = spawn(electronPath, [__dirname + "/../"], {
stdio: ["pipe", "pipe", "pipe", "ipc"]
})

const pythonProcess = spawn("python", args);

const pythonLineStream = byline.createStream(pythonProcess.stdout);

var buffer = []
var electronWindowOpened = false

pythonLineStream.on("data", line => {
line = line.toString();
if (!line.length) return;
if (line.startsWith("[LIVEPYTHON_TRACER]")) {
const msg = line
.split(" ")
.slice(1)
.join(" ")
if (electronWindowOpened) {
electronProcess.send(msg);
} else {
buffer.push(msg);
}
} else {
process.stdout.write(line + "\n");
}
});

pythonProcess.stderr.on("data", data => {
process.stdout.write(data.toString())
})

pythonProcess.on("exit", (code) => {
if (code !== 0) {
electronProcess.kill('SIGINT')
process.exit();
}
})

electronProcess.on("message", data => {
electronWindowOpened = true
buffer.forEach((msg) => {
electronProcess.send(msg)
})
})

function killSubprocesses () {
// electronProcess.kill("SIGINT")
// pythonProcess.kill("SIGINT")
}

process.on('exit', killSubprocesses)
process.on('SIGINT', killSubprocesses)
process.on("SIGUSR1", killSubprocesses)
process.on("SIGUSR2", killSubprocesses)
process.on("uncaughtException", killSubprocesses)
Loading

0 comments on commit 4a3418b

Please sign in to comment.