3 ms·
> Interactive editing and debugging is limited to top-level code. Very true. When programming in jupyter notebooks I often put off wrapping my code in a functi
by meken 9y ago
> Interactive editing and debugging is limited to top-level code.
Very true. When programming in jupyter notebooks I often put off wrapping my code in a function because it becomes harder to interact with and debug. But this obviously becomes problematic when you want to leverage code reuse and abstraction.
In order to tackle this (somewhat) I made a tool [1] which allows you to take code anywhere and get it back into a jupyter notebook and make it top-level (e.g. function function/method and loop bodies).
- [1] https://github.com/ebanner/pynt https://github.com/ebanner/pynt
- fizixer 9y agoThis has been one of my major gripes with ipython/jupyter notebook workflow. And I realized that, past an intermediate level of expertise in this ecosystem, you could really benefit from dropping down to JSON of your notebook and doing a bit of "metaprogramming" (the way you did). Yet the jupyter development team doesn't appear to be taking that into account, i.e., not making it easy/consistent for users to programmatically manipulate their notebooks.
- wcrichton 9y agoI would love to see "Jupyter for power users." I think the programming language tooling community needs to take a serious look at how interactive programming interfaces could work in the development cycle for all expert programmers, not just novices or data scientists.
- meken 9y agoAgreed. Indeed, the original punchline I had for pynt (the tool I linked above) was "Jupyter notebooks for software engineers". The idea being that software engineers might look at jupyter notebooks and think "they look cool, but my code isn't in a jupyter notebook, so it looks like I can't use them". I'm curious for what ideas you have that you think jupyter notebooks (or other interactive programming tools) would have the most promise for gaining adoption amongst software engineers. One pynt feature I had going facilitated a "debugger-driven development" workflow where when your code hits an exception it would save the state and generate a jupyter notebook with your code in it, hence allowing you to fix the bug faster.
- jonnycomputer 9y agoIn MATLAB I run in debugger mode very frequently, and it allows you to step inside functions, and query variables. When encapsulated within functions, it also allows variable assignment at the prompt. This is pretty useful when writing data munging or analysis scripts; in that case, the code in the editor is the running canonical copy, while the current running environment is exploratory in nature.