allison-casey / HyREPL

NREPL for Hy
MIT License
114 stars 15 forks source link

HyREPL

HyREPL is an implementation of the nREPL protocol for Hy.

Lighttable
lighttable

Fireplace
fireplace

Experimental!

HyREPL requires Python3 and Hy from Git. It is still a work in progress, but it is suitable for daily usage :)

To install, run

python setup.py install

or get it from pypi

pip install hyrepl

To run the tests, simply execute nosetests-3.4 -v. The tests create (and bind to) a UNIX domain socket at /tmp/HyREPL-test.

Confirmed working nREPL clients

This list is not exhaustive, and HyREPL does not support all features offered by these clients, such as advanced debugger integration, profiling or tracing. Jump to source is also not supported.

Lighttable

Vim

Emacs

Console

Using HyREPL with fireplace

For the best integration, install vim-hy. It offers syntax highlighting and indentation support as well as wrappers around fireplace to make it more Hy-friendly.

Run hy -m HyREPL.server in your target directory and open a Hy file in vim. You can also use :setf hy to set the file type explicitly. Connect vim to the REPL with :Connect. Use nrepl as the protocol, localhost as the host and the port number HyREPL printed on start.

Without vim-hy

Open a Hy file and set the file type to clojure: set filetype=clojure. This will suck because it doesn't support :Doc. Other things might be broken as well.

Missing features

Using HyREPL inside your own programs

You can use HyREPL to add a remote control to your own programs. The following steps are a small example:

(import time
  [HyREPL.server :as repl]
  [HyREPL.middleware.eval :as repl-mw])
(setv (. repl-mw eval-module) (globals))
(defmain [&rest args]
  (let [[s (repl.start-server)]]
    (print (.format "Listening on {}" (. (second s) server-address)))
    (while True
      (time.sleep 1))))

Made with ♥

If you encounter bugs or missing features, please create an issue report. Patches are always welcome. If you have questions, we hang out in #hy on Freenode.