Live coding in Python with PyCharm, Emacs, or Eclipse.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.idea Fix #195 by avoiding unicode prefix in image data. Jul 24, 2018
docs
emacs-live-py-mode Add Eclipse release, and increment Emacs version. Aug 11, 2018
feature Add Eclipse release, and increment Emacs version. Aug 11, 2018
icon-src Fix #166 by shrinking the turtle icons. Jan 10, 2018
plugin Add Eclipse release, and increment Emacs version. Aug 11, 2018
pycharm Increment version number for PyCharm patch release. Sep 1, 2018
test Fix #196 by calling numpy.random.seed(). Aug 9, 2018
.gitignore Fix #203 by forcing a comma when assigning to a tuple or list. Aug 8, 2018
.project Increment version numbers for release. Nov 26, 2016
.pydevproject Close #128 by unpacking a generator during assignment. Jul 16, 2017
.travis.yml
CODE_OF_CONDUCT.md
CONTRIBUTING.md
ISSUE_TEMPLATE.md Create ISSUE_TEMPLATE.md Feb 19, 2018
README.md Mention PyCharm in a few places. Jan 21, 2018
index.html Create gh-pages branch via GitHub Jun 28, 2012
license.txt Switch from EPL to MIT license to close #131. Aug 5, 2017
params.json Create gh-pages branch via GitHub Jun 28, 2012
screenshot.png Add screenshot, and clarify instructions. Feb 6, 2016
tox.ini

README.md

live-py-plugin

Build Status Code Coverage

Live coding in Python with PyCharm, Emacs, or Eclipse.

To see how to use it, watch the demo video or read the getting started page. You might also find some useful examples in the tools folder. To learn more, read about how it works.

Screenshot of a star diagram

Special thanks to Antti Kaihola and Christoph Paulik for contributing the Emacs support. Thanks to all the contributors for helping in all kinds of ways.

If you like this project, check out some of my other projects.

Installing the Eclipse plugin

  1. Install the PyDev plugin and Eclipse if you don't already have them. It's been tested with PyDev 4.5.5, Eclipse 4.4, Python 2.7 and 3.4. It seems to be particularly sensitive to changes in PyDev.
  2. In Eclipse, choose Help: Eclipse Marketplace... from the menu.
  3. Search for Live Coding in Python, and install it.
  4. Restart Eclipse.
  5. Open any Python file, and from the Live Coding menu, choose Start Live Coding. You should see an extra panel on the right that shows the results of running your code.
  6. To try the turtle graphics features, open the Live Coding menu, and choose Start Live Turtle. The panel on the right shows the turtle graphics display.
  7. You can also use another script or a unit test to drive your live code. Run your driver script or unit test as usual in Eclipse, then click on the small arrow next to the big live coding arrow in the toolbar. You should see all the different Python and unit test launches listed there. Click on the one you want, and it will call the live version of your code. To run a single unit test method, open the test file, and type Ctrl+F9, then choose the test method you want to run. Edit your run configurations to give the new configuration a meaningful name, then choose it from the live coding arrow's menu.

If you don't want to use the Eclipse marketplace, you can also install from the update site.

Uninstalling the Eclipse plugin

  1. In Eclipse, choose Help: Installation Details from the menu.
  2. Select Live Coding in Python, and click the Uninstall... button.
  3. Restart Eclipse.

Installing the Emacs mode

It's probably easiest to use the MELPA package archive, as described in this section, but the next section gives instructions for installing without MELPA.

  1. Install GNU Emacs if you don't already have it.
  2. Install MELPA. You probably want to follow the instructions for the stable version, instead of the default bleeding-edge version.
  3. Launch the package installer with M-x package-list-packages.
  4. Find the package with C-s live-py-mode.
  5. Mark the package to install with i, then execute the installation with x.
  6. 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.
  7. Type C-h m and scroll down to the Live-Py section to see all the advanced features that let you run other versions of Python or drive your live coding from another script or a unit test.

Installing the Emacs mode without MELPA

  1. Install GNU Emacs if you don't already have it.

  2. Clone the latest version of the live-py Emacs mode:

     git clone https://github.com/donkirkby/live-py-plugin.git
    
  3. 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-path in ~/.emacs.d/init.el or ~/.emacs:

     (add-to-list 'load-path "~/.emacs.d")
    
  4. Load the Lisp library in your ~/.emacs.d/init.el or ~/.emacs:

     (require 'live-py-mode)
    
  5. Restart Emacs.

  6. 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.

  7. Type C-h m and scroll down to the Live-Py section to see all the advanced features that let you run other versions of Python or drive your live coding from another script or a unit test.

Uninstalling the Emacs mode

If you installed with MELPA, just use it to uninstall. If not, follow these steps:

  1. Remove the files you copied into ~/.emacs.d/:
  2. Revert additions to ~/.emacs.d/init.el or ~/.emacs.
  3. Restart Emacs.

Installing the PyCharm plugin

The PyCharm plugin is very new, and doesn't work well yet. Try it out if you're adventurous, and report any bugs you find. So far, the Emacs mode seems to be the most popular way to use live coding in Python.

This assumes you already have [PyCharm] installed, you have configured a Python interpreter, and you can run a Python script normally.

  1. From the File menu, choose Settings....
  2. Click on the Plugins section.
  3. Click the Browse Repositories... button.
  4. Type live coding in the search box, and click on the "Live Coding in Python" entry in the list below.
  5. Click the green Install button on the right.
  6. Click the Restart PyCharm button.
  7. Close all the dialog boxes by clicking OK, then let PyCharm restart when it asks.
  8. Open a Python file.
  9. From the Run menu, choose Start Live Coding.

Uninstalling the PyCharm plugin

  1. From the File menu, choose Settings....
  2. Click on the Plugins section.
  3. In the list of plugins, click on Live Coding in Python.
  4. Click the Uninstall button on the right.
  5. Click the Restart PyCharm button.
  6. Close all the dialog boxes by clicking OK, then let PyCharm restart.

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.

If you find the project useful, help us make it better.