5 ms·
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
by fantispug 8y ago
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).
- mindB 8y agoWhat 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?
- fantispug 8y agoYeah, just comint with elpy. There are some rough edges; I can't input multiline in the comint buffer (but can send it), and gives an error on the very first command, but otherwise works well.
- tincholio 8y agoob-ipython works really well.
- mindB 8y agoThe REPL opened with org-babel-switch-to-session has been really buggy for me. Has it worked for you? Could just be because I'm using it with non-python kernels, which isn't well supported yet in general as far as I can tell.
- tincholio 8y agoI've only used it with a Python kernel so far, and doing eval on each or all blocks in the buffer (org-ctrl-c-ctrl-c, and org-babel-execute-buffer). Haven't had problems so far.
- meken 8y agoIf 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 https://github.com/millejoh/emacs-ipython-notebook
- mindB 8y agoLooks like that just calls make-comint-in-buffer eventually[1] with some fancy stuff to make sure it connects to the same jupyter server as being used for ein. Not sure I see a lot of utility there if I'm just wanting to run a jupyter REPL next to a regular code buffer or e.g. org-mode. [1] https://github.com/millejoh/emacs-ipython-notebook/blob/cfd0e8a3d7edd0f82324568bc80ac92c4bdccf91/lisp/ein-console.el#L226 https://github.com/millejoh/emacs-ipython-notebook/blob/cfd0...
- jonnycomputer 8y agoi hate actually writing code in Jupyter. part of it is just that my muscle memory is all emacs. but its not just the muscle memory, its all the features missing that I usually use but are common in an IDE or good editor. Does anyone know whether emacs ipython notebook is still viable?
- meken 8y agoYes Emacs IPython Notebook is alive and kicking [1]. I recently wrote a tool on top of it and found most everything to work, even as I was banging on it pretty hard at times. - [1] https://github.com/millejoh/emacs-ipython-notebook https://github.com/millejoh/emacs-ipython-notebook