I am working on a python package as a developer. The package is stored in a git repo and I use a local branch to debug/fix this package.
I use Jupyter notebooks using pip in edit mode to load my local branch as a package, where I test changes I make.
I run the following steps:
- Load the local package in a develop mode
- Import the module I want to test
- Do the test
For instance:
! pip install -e Path/To/Local/Package/ # step 1
import local_foo as foo # step 2
foo.print() # step 3
After step 3 if the code doesn't behave as expected, I correct my package, restart the jupyter kernel, and re-run the 3 previous steps until I get the behavior I want.
My question is:
Is there a way to avoid restarting the kernel?
I tried the following but it doesn't work in this case:
IPython autoreload:
%load_ext autoreload
%autoreload 2
and importlib.reload:
import importlib
importlib.reload(foo)
I tried the solution suggested in this article:
https://support.enthought.com/hc/en-us/articles/204469240-Jupyter-IPython-After-editing-a-module-changes-are-not-effective-without-kernel-restart
Many thanks!
PS: In addition, can some of you can share tips, workflows or experiences using Jupyter notebooks to manage python package development (test,...)