Live data from Hacker News

JupyterCon: I don't like Notebooks [slides]

docs.google.com

91–100 of 112 posts

Re: JupyterCon: I don't like Notebooks [slides]

#91

I think notebooks are neat, and can be a useful tool, especially for learning. But until the last few days I had no clue people were trying to use them for actual software development. To me this is a mistake, and adds a lot of tooling to what was and should be fairly simple process of opening up a text editor (of your choice, mine will be emacs). I am also fairly shocked there is a conference around this idea. I fee…

someone linked me this article the other day about how netflix is using notebooks as a development platform https://medium.com/netflix-techblog/notebook-innovation-591e...

i mean i get that theyre nice for doing data stuff and presenting it, but it just seems a bit crazy to use it as some sort of development platform.

Re: JupyterCon: I don't like Notebooks [slides]

#92
post #31

The code written by a couple of "data scientists" I was working with is the worst code I have ever seen. They don't care, they just want to have an experimental results. The problem starts when their experimental "code" needs to be used on production or they are asked to describe how it works. Why cannot we just get good programmers and train them as data scientists?

Why cannot we just get good programmers and train them as data scientists? For the same reason we can't just get good programmers and train then in biology or chemistry or structural engineering. Sure they exist, as do data scientists that are really good programmers, it's just that they're more rare and in very high demand. Often much easier to find a domain expert and a programmer and have the programmer rework the…

sounds like this is a process issue! EG, why data scientists and software engineers are both needed, and how they can work together to produce quality code which will produce quality data analysis

Re: JupyterCon: I don't like Notebooks [slides]

#93
I’m glad these concerns are becoming more widespread, since they are somewhat subtle and when we originally shipped RunKit many people didn’t know why we didn’t “just write a js backend for Jupyter”. The reality is that solving these problems are a huge engineering challenge and we spent the entire first year of development at RunKit on unifying the “module” and “REPL” environments. Our litmus test was that notebooks would be logical to work with once they could literally be required by other packages as if they were just modules with no modifications. The solution we came up with was VM-level time traveling: if you modify a previous cell, you should rewind the entire state of the machine (including undoing changes made to the file system, spawned processes, etc) and “pick up from there”. In RunKit, if cell 3 deletes a file, you can still read the file if you modify cell 2, since we snapshot the entire computer, and thus you don’t have to “pretend” you’re modifying cell order like with Jupyter. In this way you really do get the best of both worlds: a notebook never has out of order cells or is displaying its contents in an unintuitive way because if behaves “as if” you had just rerun the entire notebook from the start on every change - but with the feel and speed of iteratively appending cells. Additionally, since this isn’t done at the “language level”, computer-level side effects don’t become “out of sync” with your notebook - “oops I dropped a table in the database” - don’t worry just rerun the cell with corrected contents, it’ll always run with the same state it started with. You can read more about this in a blog post we wrote when we initially released (even though it reads like a direct response to slide 25 of this presentation): https://blog.runkit.com/2015/09/10/time-traveling-in-node-js...

Re: JupyterCon: I don't like Notebooks [slides]

#94
post #87
post #73

Earlier quoted context omitted.

I don't even like it for initial experimentation and exploration. Much prefer the command line repl (the jupyter/ipython one). Faster feedback and easier navigation then you can just export the history when you're ready to capture and make permanent some workflow. It still requires going through and picking out the important bits, but reading the history like a story of commands is generally enough to pick out the im…

Will the REPL allow you to easily edit function definitions and then reinterpret them?

I mean Jupyter doesn't really do that either, right? You can't edit most function definitions. Only ones that you've defined right there in the notebook, and only because you can run the cell that defines them again, overwriting the function.

But if you do use libraries instead of just a huge mess of notebooks, you're stuck if you want to change the code in a well-supported way. You can ask your notebook to monkey-patch the code (which is an even bigger mess), or you can use an unreliable magic extension, "%autoreload".

Re: JupyterCon: I don't like Notebooks [slides]

#95
What if notebooks re-executed all cells in order as you type? That would solve the ordering and hidden state problem. To speed that up you could take a snapshot of the program state at each cell and re-execute from the snapshot of the cell preceding the cell you're modifying.

The advantage of a notebook over a repl is that the code you typed stays there and can be re-run and modified later. Re-executing all cells in order ensures that that actually works.

You can do away with the cell concept, and instead have some way to annotate which lines display their output. Then the distinction between an editor and a notebook almost disappears. An editor plus a way to annotate which lines' outputs are displayed, plus a way to type rich text, becomes a notebook.

Even better, you could allow users to display the output of lines inside functions, and have a way to select which concrete call is actually displayed. Sean McDirmid has already implemented such an editor. This removes the incentive to avoid abstraction, because it allows you to display outputs even if you put code inside a function or class. It's even better than a repl in this regard, and it doubles as a powerful debugger that can navigate through the execution.

The navigation works similar to an IDE's go to definition, except that when you go to definition on a call, it sets the concrete execution context of the call. For instance,

    function foo(x)
      y = x+2
      return 3*y
    end

    foo(5)
    foo(6)
If you click on the foo(5) call then it jumps to the definition of foo and sets x=5 and displays the outputs of expressions you've annotated, such as y = x+2. A similar mechanism allows you to pick the iteration of a loop. It even works fine in the presence of lambdas, allowing you to debug through callbacks (unlike conventional debuggers).

Re: JupyterCon: I don't like Notebooks [slides]

#96
Agree 100%! The best use of notebooks seems to be making demos of very simple things that demonstrate the idea of notebooks. My gripes:

1) It's claustrophobic! Trying to work in notebooks always felt like trying to do a math problem with too little paper when you're used to big empty sheets.

2) Readability is weird! I want to see all the code and then see the plots, not little crazy crunched up snippets with little crazy crunched up plots that might allow interactivity.

3) I might actually want to do something that involves looking at more than one plot at a time! Seriously? This always struck me as ridiculous. I have screen real estate, I want to use it! ESPECIALLY for interactive data analysis.

4) They're not as portable as they should be! There's always some drama when you open up someone else's notebook locally.

5) They encourage people to write weird ass code! Scientists already have a tendency to be messy if they're not CS types, this just makes it worse.

Alternative:

vim + tmux + ipython REPL + vim/tmux slime for shipping stuff from the editor to the REPL + matplotlib in QT mode

It's not as good as MATLAB but it gets close.

Re: JupyterCon: I don't like Notebooks [slides]

#97
post #95

What if notebooks re-executed all cells in order as you type? That would solve the ordering and hidden state problem. To speed that up you could take a snapshot of the program state at each cell and re-execute from the snapshot of the cell preceding the cell you're modifying. The advantage of a notebook over a repl is that the code you typed stays there and can be re-run and modified later. Re-executing all cells in…

This causes issues when working with large data sets or running expensive operations, which is an advantage of modifying a single step independently from the rest.

Re: JupyterCon: I don't like Notebooks [slides]

#98
post #31

The code written by a couple of "data scientists" I was working with is the worst code I have ever seen. They don't care, they just want to have an experimental results. The problem starts when their experimental "code" needs to be used on production or they are asked to describe how it works. Why cannot we just get good programmers and train them as data scientists?

Why cannot we just get good programmers and train them as data scientists? For the same reason we can't just get good programmers and train then in biology or chemistry or structural engineering. Sure they exist, as do data scientists that are really good programmers, it's just that they're more rare and in very high demand. Often much easier to find a domain expert and a programmer and have the programmer rework the…

> Often much easier to find a domain expert and a programmer and have the programmer rework the code done by the domain expert. In fact that used to be my job for a while (working with physicists), and it was actually quite fun.

It's basically what people are now calling 'Research Software Engineers'

Re: JupyterCon: I don't like Notebooks [slides]

#99
post #73

Earlier quoted context omitted.

I don't even like it for initial experimentation and exploration. Much prefer the command line repl (the jupyter/ipython one). Faster feedback and easier navigation then you can just export the history when you're ready to capture and make permanent some workflow. It still requires going through and picking out the important bits, but reading the history like a story of commands is generally enough to pick out the im…

If you work with image processing, notebooks are very handy as they can display images directly. Also to display tables nicely with pandas, or for any data visualization actually.

Doesn't IPython repl running in a QTconsole terminal do that ?

Re: JupyterCon: I don't like Notebooks [slides]

#100

Notebooks were not created as a way to implement and organize software. You can do that with code files. Jupyter Notebook is a presentation software, for demonstrating something to yourself or others. There is hardly anything comparable to build interactive demonstrations. You'd have to implement a (multi-paged?) GUI application, or a web application. Just plain html output may cut it for certain use cases, but still…

> Notebooks were not created as a way to implement and organize software. You can do that with code files.

It doesn't have to be an either/or. The granddaddy of the modern Notebook, Literate Programming [0] _was_ about implementing and organizing software. Just because today's Notebooks like Jupyter aren't currently sufficient to implement and organize software doesn't mean that they cannot be (again) in the future.

A lot of the problems pointed out in the slides are solvable. The DevOps of Notebooks is stuff we can absolutely sink our teeth into as an industry. We can make good Notebook formats that source control well. (Some folks have filters already for Jupyter.) We can make better bridges to (incrementally, per user interest) move Notebooks into source control, CI, testing, etc. Jupyter should already have some idea of the environment it is running in, it could certainly build things like requirements.txt or even full Docker containers. We can build beyond the single cell or single Notebook page and ask deeper questions about how do we organize Notebooks, how do we organize software in Notebooks, how do we interoperate with maybe some code that has a strong narrative to live in a Notebook alongside code that doesn't have a strong narrative or doesn't need one (or wasn't written with one in mind and is legacy code in the project). It could be great to take an existing Python codebase and say "this feature is best explained in a Notebook" and just build it that way. Similarly it could be great to say "this Notebook I found is already a great module, I'm going to build a more traditional app around it" and getting the Notebook's own help in bootstrapping that effort.

We certainly have the technology and the opportunities to do interesting software development in/with/alongside Notebooks and Notebook-like tools. The questions are certainly more ones of what are our priorities? Knuth argued in the 80s that all software development was best when embedded in a human-focused narrative. I'm not that extreme myself, but I certainly see some great opportunities for pragmatic middle grounds where you can mix-and-match as opportunity/interest/need warrants. Having Notebooks as a tool in software development _can_ make us better software developers. It's cool to have a lot of tools in your toolbelt so you can pick and choose the best ones for the jobs at hand.

[0] https://en.wikipedia.org/wiki/Literate_programming

Post reply on HN