Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment setup: requiring cljc source files and possibility of using cljs #568

Open
abondrn opened this issue Nov 2, 2023 · 3 comments

Comments

@abondrn
Copy link

abondrn commented Nov 2, 2023

Hello all I'm having some issues with getting my clerk workflow setup and I would appreciate anyone's input on making this happen.

  1. 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 and src directories, where the files under src are written using the lib.{name} namespace. What additional configuration, clj commands, or clerk code do I need to execute in order use the code from src in a notebook? Bonus points if where is a demo or example repo that already demonstrates this.

  2. 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!

@abondrn
Copy link
Author

abondrn commented Nov 2, 2023

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.

@zampino
Copy link
Collaborator

zampino commented Jan 18, 2024

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?

@zampino
Copy link
Collaborator

zampino commented Jan 18, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants