Issue
Is there a way to get a list of the currently loaded IPython extensions?
For example if I load the extension autoreload into IPython with %load_ext autoreload
or by running:
from IPython import get_ipython
ipython = get_ipython()
ipython.magic("%load_ext autoreload")
Is there any way to show that I have loaded this extension?
I have attempted this by directly accessing the input history with something like
from IPython import get_ipython
ipython = get_ipython()
hist = ipython.extract_input_lines("0:100")
But it turns out that IPython does not store inputs with magic functions here or in the history list accessible with In
and _ih
. Only lines executing plain Python appear to be saved.
This scheme wouldn't work generally anyway. If a script called with runfile
ran load_ext
, all that would be seen in history would be something like runfile('script_name.py', wdir='path/to/wdir')
.
Solution
Figured this out by poking through the %load_ext
code:
from IPython import get_ipython
ip = get_ipython()
ip.extension_manager.loaded
Answered By - Andy Jones
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.