GithubHelp home page GithubHelp logo

agermanidis / livepython Goto Github PK

View Code? Open in Web Editor NEW
2.5K 77.0 171.0 46.98 MB

Visually trace Python code in real-time.

License: MIT License

Python 24.58% JavaScript 75.42%
python electron-app debugging-tool

livepython's Introduction

Livepython

Watch your Python run like a movie.

NOTE: Livepython is alpha software. It doesn't handle a lot of edge cases and features may change.

Livepython is a desktop app that lets you visually trace, in real-time, the execution of a Python program. In addition, it can track changes in global and local variables as your program is running. Livepython is 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...]

Controls:

SPACE: Play/Pause the program.

Left/Right Arrow: Change speed of execution.

V: Open/Close Variable Inspector.

Compatibility

Python Version Compatible?
3.6
3.5
2.7
2.6

Installation

npm install livepython -g

Development

Livepython has 3 main components:

  • a Python tracer that uses sys.settrace() to intercept every line of your program as it's being evaluated
  • an Electron app that is responsible for the rendering the Livepython frontend
  • a node.js gateway script that manages communication between the frontend and the tracer

If you want to make changes to Livepython, you will need to run webpack:

webpack

Then you can test your built version of livepython by running:

bin/livepython [your python program]

License

MIT

livepython's People

Contributors

agermanidis avatar meain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

livepython's Issues

README gif is disorienting

Just a bit of candid feedback... Seems like an awesome project, but the gif on the README is really confusing... I can't tell if you're scrolling up and down to show different lines lighting up? I also find myself trying to understand the intent of the source code itself, which, of course, is a fool's errand with all the jumping around.

What about using a simple, short program to showcase the program? Maybe a simple Euler problem or something like that.

enhancement - variable explorer - introspection on self

looking at the variable explorer - often there's a self reference. this wraps up a lot of properties and keeps things in the dark.

it would be awesome if this could be toggled and expanded to included the properties on class.
I believe this can be achieved with a dir() call.

unicode decode error

I can't launch it in my terminal, my system is windows 10, with python 3.6 and node v8.9.
the error is :

Traceback (most recent call last):
  File "C:\Users\sytj1\AppData\Roaming\npm\node_modules\livepython\bin/../tracer.py", line 189, in <module>
    code = compile(fp.read(), starting_filename, 'exec')
UnicodeDecodeError: 'gbk' codec can't decode byte 0x8c in position 89: illegal multibyte sequence```
I think this package can help me a lot, so I'm looking forward for your reply, thank you. 

Enhancement - don't close on completion

It would be handy to leave the windows open upon completion of the run, to allow time to look over the variable pane. Also, saving preferences (always show the variable pane, always show functions) would be useful.

Thanks!

enhancement - remove truncation of value

screen shot 2018-06-15 at 20 39 00

eg.
instead of
Tensor("rnn3/while/Identity_3:...

allow user to scroll to right to see larger value....

is there a memory limit on this ? or just a ui problem with css in electron I wonder.

webpack 3.12.0 - Invalid configuration object

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.module has an unknown property 'loaders'. These properties are valid:
   object { exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, noParse?, rules?, defaultRules?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp?, strictExportPresence?, strictThisContextOnImports? }
   -> Options affecting the normal modules (`NormalModuleFactory`).
 - configuration.target should be one of these:
   "web" | "webworker" | "node" | "async-node" | "node-webkit" | "electron-main" | "electron-renderer" | function
   -> Environment to build for
   Details:
    * configuration.target should be one of these:
      "web" | "webworker" | "node" | "async-node" | "node-webkit" | "electron-main" | "electron-renderer"
    * configuration.target should be an instance of function

https://stackoverflow.com/questions/49370849/configuration-module-has-an-unknown-property-loaders

fixed with rename of loaders -> rules

and

  • configuration.target should be one of these:
    "web" | "webworker" | "node" | "async-node" | "node-webkit" | "electron-main" | "electron-renderer"

configuration.target -> electron-main

Short running program

How would I use livepython to examine a short running program like an algorithm example? It seemed to exit immediately

is there a simple way to pipe input `<` to the script?

I like the python script.py < input.txt style on occasion

Obvious alternative: work the input file in as an argument,
just thought it might be obvious/doable itself :))

doesn't seem to work with 'livepython script.py < input.txt' just as a mention, it opens and steps through to the line with input() but the in isn't ... putting

livepython fails with "SyntaxError: Unexpected token {"

livepython foo.py 
/usr/local/lib/node_modules/livepython/bin/livepython:27
const { spawn } = require("child_process");
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)
    at node.js:966:3

enhancement - variable explorer - pandas / scipy / numpy - help wanted.

this maybe too hard -(feel free to close) just putting it out there

there's a full blown ide - spyder that can do this.
https://github.com/spyder-ide/spyder

some screen shots.
https://gist.github.com/johndpope/187b0dd996d16152ace2f842d43e3990

not sure how this app works under the hood - but if you could hook into these somehow - it would be amazing. Microsoft threw this in the too hard basket (if you need any motivation).

microsoft/vscode#29971

also related
microsoft/PTVS#747

enhancement - force directed layout visualization of files/methods accessed

Hi @agermanidis - latest build is so good - and runs really smooth.
thanks so much for all your work. the variable explore is great!

so I'm thinking out loud here - but given the last suggestion was well received - going to take another stab.

I'm imagining a visualization of classes accessed like gource.io
(this requires c++ etc too heavy for electron - however d3 has a simple force directed graph)
screen shot 2017-11-08 at 10 56 17 am
https://www.youtube.com/watch?v=cNBtDstOTmA&t=44s

FORCE DIRECTED GRAPH
https://bl.ocks.org/mbostock/4062045

screen shot 2017-11-08 at 11 04 19 am

curves
screen shot 2017-11-08 at 11 10 33 am

when a file is imported an edge would be created in graph.
when a method is called - perhaps the link is highlighted.
a naive linking maybe the edge would be from parent class - to child class.
not sure best way to do this.

Not able to input in console on Windows

System

Windows 7 x64
Python 3.6.1 on win32
[!] Not sure if this happens on other systems as well

Description

When running scripts containing an input()-function I am not able to input something and so the execution stops.

input

Steps to reproduce

  1. Create a test.py with following content:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

x = input('Input something: ')
print(str(x))
  1. Open console window and run with livepython

livepython test.py

  1. Try to input something in the console window

How can I run livepython in a Docker container?

I tried to run livepython in a docker image which I build (docker build -t livepython .) with the following Dockerfile.

# use base image which provides Python latest and Node 10.x
FROM nikolaik/python-nodejs:latest

# install livepython
RUN npm install livepython

# electron default port
EXPOSE 8080

# run livepython executable
ENTRYPOINT ["livepython"]
CMD ["--help"]

If I run the image (docker run -it livepython) the executable cannot be found docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"livepython\": executable file not found in $PATH": unknown. I could not find an executable in the container. Can you help out?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.