I use this kind of workflow all the time in Emacs. I write code in one window and have a Jupyter REPL in the other and send code to the REPL to test things live as I'm coding.

I'll have "pdb" set up in Jupyter REPL so it drops into a debugger when I have an error with a function.

In the case of a long running function I want to debug (like the video example at the end) I'll set local variables with the same names as the variables of the function and then execute the function line-by-line/chunk-by-chunk.

The only problem is losing track of global state, but the same thing can happen in Jupyter notebooks.

This type of workflow is really common in Lisp and R.

If I want to integrate documentation and code, I'll use org-babel or R Markdown (which does work with Python).

What do you use for running the jupyter REPL in emacs? I haven't found a great way of doing so yet. Just running it in a comint buffer?

If you connect your code buffer to an jupyter notebook via Emacs IPython Notebook [1] then you can hit C-c C-o (ein:console-open) which will launch a jupyter REPL.

- [1] https://github.com/millejoh/emacs-ipython-notebook