Skip to content

40ants/therepl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The REPL

This is an extension for ipython.

It's goal is to make iterative "image-based" development possible. This way of development is able to increase programmer's productivity.

Features

  • A command %in <module-name> allowing to switch current namespace to a given python module.
  • When you are in the module's namespace, all evals will change this module.
  • When a function gets redefined in the module, it also will be redefined in all other modules where it was imported to.
  • The same is for classes.
  • But also all objects of a redefined class will be upgraded, to use a new class.
  • This should works (I hope) for parent classes, which are intermediate in the MRO chain.
  • Also, a command %listen is available. It starts a simple RPC server allowing you to send functions and classes right from the Emacs (this is the only one IDE currently supported.

How to use

  • Install: pip install therepl.
  • Run ipython.
  • Load the extension: %load_ext therepl.
  • Switch to a module you want with %in <the-module> magic command.
  • Eval the code like you want to change:

    image

Connecting from the Emacs

  • In ipython's repl execute %listen command.
  • Load into your emacs therepl.el.
  • With cursor on a function definition, hit C-c C-c to eval it in the ipython. Code will be evaled in the module corresponding to the python file.
  • To switch REPL into the module of the current file, hit C-c v.

Development

To start hacking the repl itself:

  • install poetry package manager.
  • do poetry install in the repl's folder.
  • do poetry shell and start the ipython.

Roadmap

  • Make a emacs minor mode.
  • Add proper error handling in RPC protocol.
  • Create an extension for PyCharm.

About

An extension for IPython to switch between modules and evaluate the code from Emacs like we do in Common Lisp.

Resources

Stars

Watchers

Forks

Packages

No packages published