jupyter icon indicating copy to clipboard operation
jupyter copied to clipboard

Using jupyter-eval-line-or-region with kernel from org babel?

Open talwrii opened this issue 7 months ago • 1 comments

I'd quite like to build the command I want to run interactively by sending the lines one-by-one with jupyter-eval-line-or-region before putting this in an org-babel plot.

This is useful when you aren't certain what you want to do - and the advantages of using blocks (hiding intermediate lines, being able to rerun and keeping track of what you are doing) go away, because you probably don't want to keep the lines. Jupyter in the browser has a shell, presumably for this reason.

Is there a way of settings the connection used by jupyter-eval-line-or-region to be the same as that used by org-babel?

I'm probably going to find a work around now anyway!

talwrii avatar May 06 '25 03:05 talwrii

Okay, I've worked out how do this. I use the following for a :session of session and a kernelspec of venv.

#+begin_src elisp
(hash-table-keys org-babel-jupyter-session-clients)
#+end_src


#+begin_src elisp
  (setq jupyter-current-client (gethash "session-venv" org-babel-jupyter-session-clients))
#+end_src

talwrii avatar May 06 '25 03:05 talwrii