Coder Social home page Coder Social logo

hyrepl's Introduction

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

  • Support live eval by connecting with Clojure nrepl. Still basic and buggy

Vim

  • fireplace with vim-hy to provide the necessary glue

Emacs

  • cider
  • monroe

Console

  • python-nrepl-client

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

  • :Require[!] does not yet work. Use :%Eval to evaluate complete files.
  • fireplace uses a lot of clojure-specific pieces of code. Most of these could be transformed with workarounds.

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.

hyrepl's People

Contributors

farhaven avatar foxboron avatar algernon avatar

Watchers

James Cloos avatar Daniel Slutsky avatar  avatar

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.