Environment setup: requiring cljc source files and possibility of using cljs
abondrn opened this issue · 3 comments
Hello all I'm having some issues with getting my clerk workflow setup and I would appreciate anyone's input on making this happen.
-
I have my project directory managed with deps.edn. This works perfectly fine when everything (aside from external dependencies) is defined within the notebook itself, but I have not had luck :require'ing source files from elsewhere in the directory. Ideally I would import it just as I would an external dependency or perhaps just use the same namespace and all of the definitions are loaded in, but another possibility might be to define the source files as another notebook directory via :watch-paths and use some clerk-specific mechanism to execute and run. Just want to get unblocked here.
The specifics of my case don't matter, but for generality let's say I have
notebooks
andsrc
directories, where the files undersrc
are written using thelib.{name}
namespace. What additional configuration,clj
commands, or clerk code do I need to execute in order use the code fromsrc
in a notebook? Bonus points if where is a demo or example repo that already demonstrates this. -
Is it possible to execute notebooks via ClojureScript instead of Clojure? I suspect the answer is no, but if it's a reasonable lift I can certainly help in making this happen.
Thanks!
For those of you following along, turns out I was overthinking 1). Turns out, it mainly arose from the way clerk reports compile errors of upstream requirements, that being silently. You can resolve similar issues by running a checker like clj-kondo prior to spinning up the notebook. General, it might be a good idea to add hooks to check updated files via custom tooling, as default Clojure error messages are pretty opaque anyways.
EDIT: scratch that, I end up having to manually load the src file (by editing and triggering the file watcher) in order for the defs to be exported. Still, that unblocks me.
2) is still unresolved.
Some other suggestions:
- clerk should support partial rendering. Ideally, it would render after the execution of each cell, or better yet show progress by capturing stdout and having a spinning wheel.
the way clerk reports compile errors of upstream requirements, that being silently.
Clerk should display errors in the browser. If you've been using serve with the file watcher, this might be an actual bug #616, did you happen to use the :show-filter-fn
option?
execute notebooks via ClojureScript instead of Clojure?
There's some experiment (#607) in that direction to have clerk/show!
evaluate notebooks in the browser via SCI. Is this topic maybe better suited for a discussion?