live-py-plugin
Live coding in Python implemented as an Eclipse plugin or an Emacs minor mode.
To see how it works, watch the demo video or read the blog post. You might also find some useful examples in the tools folder.
If you like this project, check out some of my other projects.
Installing the Eclipse plugin
- Install the PyDev plugin and Eclipse if you don't already have them.
- Download the latest version of the live-py plugin jar file from the downloads page.
-
Copy the plugin jar file to Eclipse's dropins folder. On my workstation I was able to do that in two different ways.
-
Copy it to the system-wide Eclipse installation.
sudo cp live-py_2.0.0.201209171018.jar /usr/lib/eclipse/dropins/ -
Copy it to your
.eclipsefolder in your home directory. This doesn't require sudo permission.mkdir ~/.eclipse/org.eclipse.platform_3.7.0_155965261/dropins cp live-py_2.0.0.201209171018.jar \ ~/.eclipse/org.eclipse.platform_3.7.0_155965261/dropins
-
Restart Eclipse.
Open any Python file, and from the Pydev menu, choose Live Coding. You should see an extra panel on the right that shows the results of running your code.
To try the turtle graphics features, open the Window menu, and choose Show View: Other.... Then under PyDev, click Live Coding Canvas and click OK.
Uninstalling the Eclipse plugin
- Delete the jar file from the dropins directory.
- Restart Eclipse.
Installing the Emacs mode
- Install GNU Emacs if you don't already have it.
-
Clone the latest version of the live-py Emacs mode:
git clone https://github.com/donkirkby/live-py-plugin.git -
Copy the Emacs Lisp file and the supporting Python files into a directory which is in your Emacs
load-path. For example:cd live-py-plugin cp emacs-live-py-mode/live-py-mode.el plugin/PySrc/*.py ~/.emacs.d/Add ~/.emacs.d/ to your
load-pathin~/.emacs.d/init.elor~/.emacs:(add-to-list 'load-path "~/.emacs.d") -
Load the Lisp library in your
~/.emacs.d/init.elor~/.emacs:(require 'live-py-mode) Restart Emacs.
Open any Python file, and activate live-py-mode with
M-x live-py-mode. You should see an extra window on the right that shows the results of running your code.
Uninstalling the Emacs mode
- Remove the files you copied into
~/.emacs.d/: - Revert additions to
~/.emacs.d/init.elor~/.emacs. - Restart Emacs.
Working Features
- turtle graphics, including filled polygons (Eclipse only)
- local variable assignments
- looping
- function calls, and multiple calls.
- compile errors
- runtime exceptions
- infinite loops halted.
- print statements work.
To do
- PyUnit integration
- canvas coordinates?
- Any syntax error currently blanks out the results, should just show previous result with error marker.
- Run
code_tracer.pyasynchronously so the editor doesn't block (Emacs only). - Also see the issues list.
Creating an Install Package for the Eclipse plugin
- Open live-py/plugin.xml, and increment the Version field.
- Click the Export Wizard in the bottom right corner.
- Change the destination to Directory, and click Finish.
- Go to the directory you chose, and find the .jar file. You can distribute that as your install package.