Anyone using doom emacs for datascience projects?

Hello! I have used Emacs on and off for a long time but have not been able to completely switch from Pycharm, jupyter notebooks and latex. There are just so many small things that pycharm takes care of that I don’t know if I should setup up manually or if there are simple solutions within Doom Emacs.

So is there anyone doing datascience with just Emacs? If so I would love to hear how you go about setting up a project and working with both model creation, visuals, reports and presentations.

I use it for ML things. If you want a replacement for jupyter notebooks, there’s GitHub - millejoh/emacs-ipython-notebook: Jupyter notebook client in Emacs or GitHub - nnicandro/emacs-jupyter: An interface to communicate with Jupyter kernels. or simply using org-babel with src block.

I dislike all of the above-mentioned methods. Notebooks do not scale and are a nightmare to use beyond tiny snippets of code. If you want a quick and easy repl for visualization or experimentation, you can use M-x +python/open-ipython-repl. Depending on your setup, you may want to install the with-venv macro and add (setq python-shell-interpreter (with-venv (executable-find "python"))) to config.el to get your packages loaded properly.

However, I have found that as my projects grow in size, even the ipython repl becomes unwieldy. When I do anything beyond experimentation, I use dap-debug to run my program to a specific point and then play around with the code in dap-ui-repl. Tutorial on setting up dap-debug with python here: https://emacs-lsp.github.io/dap-mode/page/python-poetry-pyenv/ Similar steps should work for tools like conda.

Emacs has a fully functional latex mode. I prefer to use org-mode when I can (I sometimes need to resort to latex), which exports to latex if you need it. If you still wish to use latex, I suggest installing latexmk and setting the +latexmk flag in the latex module to preserve some of your sanity.

For images, I either use plt.show() or just savefig and have the figure open in an emacs buffer, or a separate window. If you use savefig and open the image in a buffer, you can add this to config.el to automatically update the image as you save and re-save it:

(add-hook 'image-mode-hook
  (lambda ()
    (setq auto-revert-use-notify t)
    (auto-revert-mode)
    (auto-image-file-mode)))

For presentations I haven’t done enough to decide what way I like the most. The org module has the +present flag which supports reveal.js, beamer and org-tree-slide. Beamer is nice because it’s standardized, less nice because it’s ugly as heck (theme can be changed of course, just requires some extra work). I tried reveal.js and found it frustrating. org-tree-slide did the trick last time I had a presentation, and it’s probably what I’ll use next time as well.

Two things that you might find to be of interest:

  1. https://mirror.aarnet.edu.au/pub/CTAN/macros/latex/contrib/beamer-contrib/themes/metropolis/demo/demo.pdf
  2. GitHub - tecosaur/ox-chameleon: Make your Org exports blend in

Here’s what putting those two things together looks like for me:

1 Like

Yes, those do make it much nicer! I should try org → beamer export, I never have.