🇬🇧 developmentPythonbest practices
Jupyter is the poor man's debugger
July 31, 2024
Jupyter is the poor man's debugger
Provocative? Let me explain.
Jupyter's weaknesses
- Inconsistent state with the code (unless you restart the kernel every time)
- Limited view of the application state — you need
printstatements everywhere - Production integration? A nightmare
- Advanced debugging? Forget it, everything is done block by block manually
- Overloaded memory, block-by-block execution = slowness
- Labyrinthine navigation in code that's 400 pages tall
- Tooling? Zilch, figure it out yourself
- Poor syntax highlighting to top it all off
The Python debugger: the professional solution
- Guaranteed repeatability at every execution
- Full visibility of the app state (even plugins to visualize image variables and tensors)
- Smooth integration into production with the right entrypoint
- Very advanced debugging: step-by-step, conditional breakpoints, remote debugging, stepping into sub-functions...
- Optimized performance
- Intuitive navigation through the code architecture
- Rich ecosystem: auto-completion, linters...
- Git friendly
So why do so many people still use Jupyter?
A. For one-shot data analysis focused on visualization
B. They don't know how to use the Python debugger
Those who answered B, don't panic! Learning to use a debugger is doable. And it's a game-changer.
Hot take
Jupyter is a one-shot tool that will never compete with a good debugger in the long run.
For quick exploration and occasional visualization, it's perfect. For everything else — development, debugging, production — take 30 minutes to learn how to use the VSCode or Cursor debugger. You'll never go back.
Originally published on LinkedIn.
