Stream: python-questions

Topic: developing python modules for use in notebooks


view this post on Zulip Matt Long (May 01 2020 at 17:14):

I typically use Jupyter Notebooks as an environment for developing code that I ultimately want to reside in a Python module or package. For instance, I might have a function some_function defined in a module foo.py.

Adding the following magic to the top of my notebook

%load_ext autoreload
%autoreload 2

forces reload of the modules before executing user code. I can thus edit foo.py and see changes made in foo.py with each execution.

Full documentation is here: https://ipython.readthedocs.io/en/stable/config/extensions/autoreload.html?highlight=autoreload


Last updated: Jan 30 2022 at 12:01 UTC