Literate Programming

Continuing the discussion from If you were writing a dissertation in the present, what would you use?:

Ugh!
I can’t believe that article didn’t mention Donald Knuth, who invented this concept in the 1960’s. He called it Literate Programming where documentation and code are intermingled in the same document. To run the code, the document is “tangled” to produce source code. To produce the documentation, the document is “woven”.
Jupyter notebooks, etc. basically do this without the need to weave and tangle. Just read some stuff and run the code.
I’ll be using this for a course I’m teaching this summer, and I can’t wait for the students to use Jupyter notebooks, rather than trying to type in commands, click through endless menus, etc.

For those interested, you can play for free using Google’s Colab.

Or, try out this notebook I copied from a tutorial as a starting point for some of my stuff.

It’s all so modern, I can’t hardly stand it.

For reference, here’s what the interface for AFNI, a popular fMRI tool, looks like.

4 Likes

FWIW, I have found Spyder to be a better IDE for programming just in python. It mimics MatLab in its UI.

Surely, once you need interactive widgets, you have to switch to Jupyter Notebooks.

So, I am curious … Does Colaboratory support interactive widgets as does Jupyter Notebooks? And is Colaboratory essentially Google’s wrapper around Jupyter Notebooks so that everything stays in a Google Drive (e.g. for sharing)?


JJW

1 Like

In my experience jupyter notebooks are helpful for documenting the experiments you’ve tried when you’re exploring. They are not, however, valuable long term or as a source of truth. It’s possible I’m using them not to their full potential though.

1 Like

+1 for Spyder as a Python IDE. All the simplicity of Python on the command line, with most of the useful tools of an IDE (auto completion, baked-in documentation, debugging tools, etc.).

I appreciate Jupyter notebooks for their ability to teach and demonstrate programming concepts interactively. But I’ve never been able to use them effectively for my own work — the biggest drawback for me is that they run in a browser, which is inevitably frustrating — I’ve never understood the attraction of running an app (an IDE) inside another app (a browser).

As I understand it, it’s possible to use Jupyter notebooks inside Spyder. However, I think it currently only works when you install Spyder through Anaconda. The standalone version didn’t have the feature yet last I checked.

My greatest wish is that Spyder would adeptly handle the ipywidgets module. Or provide an approach that is as easy to bring interactive widgets into its IDE. Any insights on this would be appreciated.


JJW

VS Code also supports Jupyter Notebooks (haven’t tried it).
I would assume VS Codium (the open source version of VS Code) would as well.