

Also take a look at the “awesome-jupyter” list for even more Jupyter related projects, libraries and resources. I just want to highlight and recommend the “Table of contents”and “Variable Viewer”extensions.To find other extensions you can use the “jupyterlab-extension” search hashtag on github. JupyterLab is the “next-generation user interface for Project Jupyter”. It took a while but the first few really useful JupyterLab extensions have become available. I haven’t tested it yet but it sounds very promising! JupyterLab extensions There is also the relatively new “PixieDebugger” project which wants to offer the “Visual Python Debugger for Jupyter Notebooks You’ve Always Wanted”.
#Jupyterlab autoreload code
You can also set breakpoints in the code of imported modules, but don’t forget to import the debugger in there as well.įrom import set_trace
#Jupyterlab autoreload update
If you update an imported script, Jupyter won’t automatically detect the. When executing a cell, it will stop at the first breakpoint and open the command line for code inspection. Auto-reload Python script changes Coming back to scripts, there is an annoying drawback to mixing scripts with notebooks. Import it and use set_trace() anywhere in your notebook to create one or multiple breakpoints. %debug magic commandĪlthough not quite up to par with the functionality of the debuggers in IDEs like Pycharm or Visual Studio Code, the iPython debugger is another great option. “q” quits the debugger and code execution. Use “c” to continue until the next breakpoint. Type “n” and hit Enter to run the next line of code (The → arrow shows you the current position). This will open a command line where you can test your code and inspect all variables right up to the line that threw the error. Whenever you encounter an error or exception, just open a new notebook cell, type %debug and run the cell. Executing these magic commands will inform your notebook to actively reload all imported modules and packages as they. The easiest way to debug a Jupyter notebook is to use the %debug magic command. Simple solution: Use the autoreload to make sure the latest version of the module is used. But when the code of your module change, you must reload the module in the notebook environment again. %autoreload 2 %debug and the iPython debugger Autoreload a module Mastering JupyterLab Autoreload a module You can work on a new python module and test it in a notebook environment.

With the autoreload magic command, modules are automatically reloaded before any of their code is executed. If you edit the code of an imported module or package, you usually need to restart the notebook kernel or use reload() on the specific module. _ih # code of the 5 most recently run cells Autoreload Comes in handy when you accidentally deleted a cell etc.

Cell execution historyĪs long as your Kernel is active, the code of each executed cell is stored in this input history list. Just a couple of JupyterLab & Notebook features that I didn’t know a year ago but am now using a lot.
