4 ms·
Are there any other people who hate notebooks? Give a plain old script anytime. Run and edit anywhere without extra packages or even a Web browser.
by drnick1 1y ago
Are there any other people who hate notebooks? Give a plain old script anytime. Run and edit anywhere without extra packages or even a Web browser.
- 7moritz7 1y ago*anywhere that has the python runtime installed ironically that makes jupyter more portable via colab
- culi 1y agonotebooks are great for sharing code with people who might have only a cursory knowledge of coding. It also helps highlight specific sections of code. Graphs and other outputs immediately proceeding the block of code that generates them can be really helpful as well If a "script" gets too long and complicated, and it's a project I intend to present to others, I often reach for a notebook to organize the code in a more digestible format
- nixpulvis 1y agoI have no real qualms with the idea of a notebook, as long as it's not adding a lot of custom magic. I should be able to share what I'm working on, iterate in a notebook with someone, then extract it into a standalone program without much thought.
- drnick1 1y agoOne issue is that very often the "magic" happens in imported modules, so you can't really see what is happening unless you drop down to a text editor anyway. Then there is the infamous issue of modules not automatically reloading even when rerunning the Notebook.
- nixpulvis 1y agoThat in theory shouldn't be too bad. Though, there have been some things like %sql I remember using in one notebook, which was essentially a macro for making a datatable from a SQL expression, but it wasn't something you could just copy directly.
- bragr 1y agoI've found that notebooks are great for ad hoc reporting and analysis scripts. Once you have your quick and dirty script, it is trivial to convert to a notebook and you get a lot for little. Being able to change one cell and rerun just that is a godsend for getting reports "just right", and the "show your work" and visual aspect make them much more consumable and trusted by other people.
- victorbjorklund 1y agonotebook are great when you wanna see the intermediate results and not just the final result (in case last step takes time and you wanna double check the data) or when you just wanna better understand what the code does (yes, you can set up a debugger and debug a script etc but that is just more pain)
- OkayPhysicist 1y agoNotebooks aren't competing with scripts, they're competing with REPLs. ML and scientific applications in particular tend to have segments that run for a long time, but then you'd like the resulting script to be in a state where you can mess with it, maybe display some multimedia output, etc, without re-running the long-running segment. Notebooks fit this need to a tee.
- verdverm 1y agoNotebooks are closer to using a repl than a script. One key feature is that you can run a long data-prep/processing step and then iterate on whatever comes after without having to re-run the compute intensive steps to get the data (i.e.) you want to graph Another key feature is learning and sharing knowledge. Images, markdown, graphs, links, code... all interwoven. Scripts do not have affordances for these things. In this sense, Notebooks can be closer to reproducible blog posts.
- AnotherGoodName 1y agoI do think notebooks are very flawed right now even if the concept is sound. Right now they are essentially an IDE without the ability to produce publishable output (you are literally expected to ship the project in the form the IDE works with) and they are not a very good IDE at that. They need reliable dedicated published output fit for general public consumption. This means a static (no backend host required) sharable .html file where end users can view all the data and run the code samples that doesn't try to present as an IDE. I actually wrote https://rubberduckmaths.com/eulers_theorem https://rubberduckmaths.com/eulers_theorem in Jupyter but had to manually copy and paste to a new well formatted static html file and re-paste the code blocks into Pyodide enabled text areas within that html since the export functionality is a mess. The result of the manual work means i now have an easily sharable and easily hosted static html file with working Python code samples as it should be but... Why don't Notebooks have a published form like this already? It seems pretty obvious that Notebooks are your IDE, they shouldn't be the output you present. We're literally asking users today 'to view this notebook install Jupyter/Marimo/whatever and open from there' when the Notebook is designed to create the publication rather than a place to view it. In general the output i demonstrate above should be the minimum bar that Notebook 'export' features should hit. Export as a static .html file with working code. As someone who manually 'compiles' notebooks it's not hard to do yet Notebooks simply don't have an actual working html export right now (i know there's technically a 'html' export option in Jupyter but it will strip out your code and create a terribly poorly formatted document as output). The IDE aspects themselves, at least for Jupyter (the one I've tried out the most), are a bit too simple too. Yes it's nice to have alternating 'text' blocks followed by 'code' blocks but that's really all they are right not. I want something more complex. I want the code blocks shown to actually be windows to a full python project. Users should be able to change the code shown and view the larger, well structured Python code. Right now it's text, followed by simple code. Not much more honestly. As it is right now i feel Notebooks only work for really simple projects. If you have a complex Python project i agree the way to only share it is to share the Python project as is. Notebooks could be a wonderful explanatory wrapper to a larger project but right now they just aren't good at doing much more than the simple 'here's some data' followed by 'here's the code i used to process that data' and they don't even present that particularly well.
- 1y ago
- paradox460 1y agoI'm more amused by them than anything. They're mostly just a reinvention of literate programming, via web or org mode or whatever
- marcoalopez 1y agoJupiter is excellent at what it is designed for. For example, my usual workflow is as follows: when I develop a tool or model, I do so in a plain Python file. I then import the file from the notebook to create figures, demonstrations, documentation and so on, resulting in an immediate document that my colleagues and I can easily use for discussion. It's as simple and effective as that. It is also a great tool for teaching coding to beginners. Of course, notebooks are not designed for code development. Also, nowadays, if you want to, you can open notebooks in dedicated apps.
- drnick1 1y agoAny reason your colleagues can't run the original Python script? It seems like your workflow entails going back and forth between script and notebook or having to make changes in two places to keep both versions in sync. Then there is also the issue that notebooks are too complex to version-control effectively.
- bragr 1y ago>make changes in two places to keep both versions in sync. That's not how Python imports work. You can import in the notebook just like any other Python script.
- marcoalopez 1y agoNot all of my colleagues know how to code, but they do know how to interpret results, plots and so on (I'm in science, by the way). In my case, I am not interested in version controlling the notebook; it's just for quick prototyping and discussing ideas. I only need to version control the Python file. Also, colleagues who don't code (or dislike coding) can easily modify parameters in the notebook and obtain different results immediately with no additional effort.