I was wondering is there is a good and comprehensive way to debug python code step by step so that I can have a better idea of all the variables involved, their dimensions and values?
What can be done to do step-by-step debugging?
JupyterLab is the current generation of Jupyter interface and has a debugger mode that allows you to step through code. See this post here and a related one here.
Documentation is here.
You can try it out without installing anything on your own system by clicking here to launch a temporary Jupyter session running on a remote computer via the MyBinder service, and then open a new notebook file from the launcher. You can step the sections 'Debug code in notebook' and 'Explore the code state' there in the documentation.
For %%debug
, which is from IPython that Jupyter inherits much from, see here and other posts in that thread.