jupyter
jupyter copied to clipboard
Support named source block execution with other source blocks
From https://youtu.be/RD0o2pkJBaI?t=2100, named source blocks don't appear to work properly when passing results of one source block to another.
#+NAME: jp
#+begin_src jupyter-python :session test :async no
a = 9 + 9
a
#+end_src
#+RESULTS: jp
: 18
#+begin_src elisp :var d=jp
d
#+end_src
#+RESULTS:
: nil
The issue stems from not handling :results silent in the way that Org expects. When resolving named references, Org passes a :results silent header argument to the org-babel-execute-src-block call made by org-babel-ref-resolve. I supposed that :results silent ignores the execution of source block results and does not insert any result into the buffer (which is what it says in the documentation), but it seems that under the hood it's expected that the result is still returned by the org-babel-execute:jupyter function.
org-babel-execute:jupyter bypasses the work of org-babel-insert-result (called by org-babel-execute-src-block) by either returning nil (:async yes case) or returning an Org formatted string and injecting the :results raw header argument into the property list that is in scope in org-babel-execute-src-block (:async no case). Neither of which are useful as a return value of the org-babel-execute-src-block call.
#222 is also related to the issue of org-babel-execute-src-block returning a value that is later used somewhere.