-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Track which extensions are loaded #2462
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
Conversation
|
While this is a beneficial change in that the state is being managed per IPython shell instead of per-process, I have to wonder why we are requiring the extensions to manage the state at all. Could all of the |
|
That's mostly what the PR description is about. ;-) We certainly can, I'm just not sure yet what the best behaviour to implement is. |
|
OK, for now I've implemented it so that calling I've also made |
|
@bfroehle any more thoughts on this? I might merge in a few days unless anyone objects. |
Track which extensions are loaded
|
Merged. 😄 Thanks for the reminder. |
|
Thanks! |
Updated sympyprinting IPython extension to use the IPython ExtensionManager tracking of loaded extensions to ensure the extension is not re-loaded, rather than using a global variable. This is introduced in IPython pull sympy#2462 [1]. Support for using a global variable is maintained for older versions of IPython. [1] ipython/ipython#2462
Track which extensions are loaded
As discussed on the mailing list, extensions should track whether they are loaded per-shell, not per-process. For now, this still leaves it up to extensions what they do if the same shell attempts to load them a second time.
We could easily adjust that so that the shell will only load them once. If you try
%load_extwith an already loaded extension, there are several possible behaviours we could implement:%reload_extin this case.There could also be a flag to force loading an extension, but it's not clear how this would differ from the current
%reload_ext.Update: This now also tries to call
unload_ipython_extension()before it reloads a module, so it should be possible to avoid any problems from loading things twice.