Sometimes it is useful to connect Emacs ELPY process buffer to an existing Jupyter Kernel which is already interacting with a notebook (this notebook could be opened via Emacs EIN or standard Jupyter Browser Notebook front end).

Typical usage is to use the ELPY process buffer to quickly develop the code in traditional REPL style while creating a more presentational document in the notebook. (See e.g. https://github.com/jupyter/notebook/issues/1699#issuecomment-521987750 ).

It turns out this is every easy to support, the trick is in using the jupyter console argument --existing:

  (setq python-shell-interpreter "jupyter"
      python-shell-interpreter-args "console --simple-prompt --existing ")

does it. It allows easy combination of Emacs and Jupyter!

png