Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoreload functionality #117

Open
davidleejy opened this issue Jun 8, 2022 · 0 comments
Open

Autoreload functionality #117

davidleejy opened this issue Jun 8, 2022 · 0 comments

Comments

@davidleejy
Copy link

Does anyone know how to engage autoreload functionality while using importnb package?

Autoreload is the automatic reloading of imported content when that content is altered. This functionality is available in Jupyter. For example, to use autoreload in Jupyter, enter the following in a Jupyter cell:

%load_ext autoreload
%autoreload 2
import abc

abc.foo()

When content in abc.py is changed, abc is re-imported and the changes are effected in the Jupyter notebook.

I understand that importnb is compatible with importlib's reload (see README). Disappointingly, I've tried pairing it with autoreload in a Jupyter notebook to observe that notebooks imported via importnb are not affected.

Autoreload has no effect on importnb's import of abc.ipynb.

%load_ext autoreload          # No effect on the import of abc.ipynb
%autoreload 2                      # No effect on the import of abc.ipynb
from importnb import Notebook
from importlib import reload
with Notebook(): 
    import abc
    assert abc.__file__.endswith('.ipynb')
    reload(abc)
import abc

abc.foo()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant