

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 JupyterLab is the latest web-based interactive development environment for notebooks, code, and data. 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 When executing a cell, it will stop at the first breakpoint and open the command line for code inspection. 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. This extension reloads modules before executing user code and thus allows you to use your IDE for development while executing it inside of JupyterLab. “q” quits the debugger and code execution. loadext autoreload autoreload 2 and execute. 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. The easiest way to debug a Jupyter notebook is to use the %debug magic command. Check out chapter IPython Magic Commands by Jake VanderPlas for. I have had great use for this when I'm writing new utility functions and want to test and improve them in a jupyter notebook without restarting the whole thing each time.
%autoreload 2 %debug and the iPython debugger You can use the magic function runWith 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.
