Cognitect REBL data browser
Cognitect REBL captures the results of evaluating expressions and visualizes them in a human readable form. REBL was initially created to support development with the Datomic database and is useful viewing and navigating data structures, especially nested data structures and large data sets.
REBL requires an end user license and a personal access token to obtain the packaged library.
Open alternatives include Reveal and Portal, which are simpler to install.
Sign-up for Cognitect dev-tools license
REBL is part of the Cognitect dev-tools project that also includes Datomic dev-local (local running instance of Datomic).
Accept the Cognitect dev-tools license to receive an email containing a link to download the latest version of Datomic local and a personal access token for access to the Cognitect Maven repository which contains the REBL library.
Follow the maven configuration link in the email to configure your build tool (Clojure CLI tools or Leiningen) and the repository in the project pom.xml.
Aliases for Cognitect REBL
Follow the REBL installation steps to create an alias in the user-wide deps.edn configuration.
Alternatively, use the practicalli/clojure-deps-edn configuration which contains the :inspect/rebl
alias for use with Java 11.
Running REBL with a project
Run the project using the Clojure CLI tools
clojure -M:inspect/rebl
If rlwrap is installed, then use:
clj -M:inspect/rebl
Configure REBL with Clojure editors
nrebl.middleware is a middleware library that listens to the nREPL connection between editor and REPL, sending the results of every evaluation to Cognitect REBL.
This library is described as very alpha but works in basic tests run by Practicalli.
An :middleware/nrebl
alias along with the supporting :lib/cider-nrepl
aliases are included in practicalli/clojure-deps-edn configuration
Add an alias called :middleware/nrebl
to ~/.clojure/deps.edn
or a deps.edn
file in the root of a specific project
:middleware/nrebl
{:extra-deps {rickmoynihan/nrebl.middleware {:mvn/version "0.3.1"}}
:main-opts ["-e" "((requiring-resolve,'cognitect.rebl/ui))"
"-m" "nrepl.cmdline"
"-i"
"--middleware" "[nrebl.middleware/wrap-nrebl,cider.nrepl/cider-middleware]"]}
Supporting aliases for nrebl.middleware
:lib/cider-nrepl
{:extra-deps {nrepl/nrepl {:mvn/version "0.8.2"}
cider/cider-nrepl {:mvn/version "0.25.3"}
refactor-nrepl/refactor-nrepl {:mvn/version "2.5.0"}}}
Using REBL with Clojure editors
CIDER and Calva use the nREPL
protocol to connect to the REBL REPL and have all the evaluated code in those editors automatically display the results in the REBL UI.
In a terminal, run REBL listening to nREPL using the command
clojure -M:lib/cider-nrepl:inspect/rebl:middleware/nrebl
Then cider-connect-clj
in Spacemacs / Emacs and CIDER will connect to the nREPL port and results of evaluated code are sent to REBL UI.
Using cider-jack-in - not recommended
To use cider-jack-in-clj
add a .dir-locals.el
file to the root of a Clojure project. The .dir-locals.el
configuration adds the nREBL aliases set via cider-clojure-cli-global-options
. The automatically injected configuration must be disabled or the command will fail.
((clojure-mode . ((cider-preferred-build-tool . clojure-cli)
(cider-clojure-cli-global-options . "-M:lib/cider-nrepl:inspect/rebl:middleware/nrebl")
(cider-jack-in-dependencies . nil)
(cider-jack-in-nrepl-middlewares . nil)
(cider-jack-in-lein-plugins . nil)
(cider-clojure-cli-parameters . ""))))
revert-buffer
will force Emacs to load in the .dir-locals.el configuration if it was added to a project with files already opened.
See the guide on using VSCode Calva with REBL
References
- Cognitect Labs REBL-distro repository and issue tracker
- Cognitect Local Dev and CI with dev-local
- Cognitect REBL documentation shows how to use nREPL with REBL
- practicalli/clojure-deps-aliases common aliases for Clojure
- nrebl.middleware project and documentation
- #rebl channel on Clojurians Community
- nrepl-rebl alternative to nrebl.middleware
- cider-repl - configurable form results with REBL