👋 Does anyone know of a stand-alone nREPL client with similar featureset to REPL-y but with fewer/smaller dependencies? Ideally no JVM Readline and tab complete would be the main things I’m after
there is https://github.com/eraserhd/rep. i've never tried it, so i can't speak to what features it has, but maybe it fits the bill
the scenario is i’ve got some tools we’re bundling into a container that will include connecting to an nrepl server, and i’d like to avoid having to include a whole jvm in there if possible
@glenjamin it's possible to interact with an nREPL server from a bb script as well: https://book.babashka.org/#_interacting_with_an_nrepl_server
but this is possibly lower level than you would like
I'm using this on our CI to send commands to our production app, e.g. to clear caches
i suspect for now we’ll just bundle the usual lein repl
stack, we did briefly try a graal compile and quickly abandoned it
@glenjamin if you would like to do without lein:
clojure -Sdeps '{:deps {reply/reply {:mvn/version "0.4.4"}}}' -M -m reply.main --attach localhost:1667
wow, that's an awesome idea
cheers, we might try that, but i think once we’ve got the JVM in there then lein
isn’t much on top
@glenjamin There's a list of clients here: https://nrepl.org/nrepl/0.8/usage/clients.html#command-line-clients Not sure if any of them fit the bill.
@glenjamin I have some success with reply on GraalVM, working around some issues in complete.core, reflection etc, etc.
$ ./reply --attach localhost:52612
REPL-y 0.4.4, nREPL 0.6.0
Clojure 1.10.0
OpenJDK 64-Bit Server VM 11.0.8+10
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
user=> (+ 1 2 3)
ExecutionException java.io.FileNotFoundException: Could not locate reply/parsing__init.class, reply/parsing.clj or reply/parsing.cljc on classpath.
This could potentially work. I'm willing to take a bet that if nothing comes out of it, you owe me nothing, but if I get it working, I do want to get paid for the hours I'm going to put in it :)One of the issues is that reply "complects" the in-process REPL with the client
please don’t sink time into it on my account! This was only a “it’d be nice if my container was a few hundred MB smaller” idle thought
:thumbsup:
At least this works if I close the REPL:
$ ./reply --attach localhost:52612
ConnectException Connection refused (Connection refused)
ehm... it works!
user=> *clojure-version*
{:major 1, :minor 10, :incremental 0, :qualifier nil}
$ ./reply --attach localhost:63307 <<< '(+ 1 2 3)'
REPL-y 0.4.4, nREPL 0.6.0
Clojure 1.10.0
OpenJDK 64-Bit Server VM 11.0.8+10
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
user=> (+ 1 2 3)
6
user=> Bye for now!
size of reply binary: 39867048
^ @glenjamin...
oh wow, nice one!
@glenjamin I just realized, I've been using CircleCI so much for my open source projects, I owe at least to publish this code, if you're interested.
that would be ace, i could imagine it would work as a PR to REPL-y?
One of the issues is that some of the work is done in futures on the top-level. This causes trouble. So I just copied the source and fixed some of that. Some reflection issues. Some other hacks. It basically works if you run script/compile
and set GRAALVM_HOME
to 20.3.0 java 11. I'll make a private repo (which contains the hacky code, not meant for open source consumption yet)
@glenjamin I invited you to the repo
if I should invite more of your colleagues, let me know
perfect, thanks
could you invite c2nes
please?
is this something you intend to keep private?
depends. this is just scratch code for now, if I would open source it, it would need more testing
I invited your colleague
fair enough, i tend to throw a warning on the top and publish anyway - but my stuff isn’t nearly as popular or polished as your usual stuff - so my bar is much lower 😄