From 3f2bb7288f3a11d0adb8ee7a650a09fe5bdda156 2024-01-29 05:13:13 From: Paul Ivanov Date: 2024-01-29 05:13:13 Subject: [PATCH] Remove old mentions and uses of ipython_extension_dir The bulk of this functionality was removed in IPython 8.6.0, but there were still mentions of it in the docs and in the reload code. --- diff --git a/IPython/core/extensions.py b/IPython/core/extensions.py index ded94be..14ddc13 100644 --- a/IPython/core/extensions.py +++ b/IPython/core/extensions.py @@ -42,28 +42,15 @@ class ExtensionManager(Configurable): if the extension is reloaded. You can put your extension modules anywhere you want, as long as - they can be imported by Python's standard import mechanism. However, - to make it easy to write extensions, you can also put your extensions - in ``os.path.join(self.ipython_dir, 'extensions')``. This directory - is added to ``sys.path`` automatically. + they can be imported by Python's standard import mechanism. """ shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True) def __init__(self, shell=None, **kwargs): super(ExtensionManager, self).__init__(shell=shell, **kwargs) - self.shell.observe( - self._on_ipython_dir_changed, names=('ipython_dir',) - ) self.loaded = set() - @property - def ipython_extension_dir(self): - return os.path.join(self.shell.ipython_dir, u'extensions') - - def _on_ipython_dir_changed(self, change): - ensure_dir_exists(self.ipython_extension_dir) - def load_extension(self, module_str: str): """Load an IPython extension by its module name. @@ -124,7 +111,6 @@ class ExtensionManager(Configurable): :func:`reload` is called and then the :func:`load_ipython_extension` function of the module, if it exists is called. """ - from IPython.utils.syspathcontext import prepended_to_syspath if BUILTINS_EXTS.get(module_str, False) is True: module_str = "IPython.extensions." + module_str @@ -132,8 +118,7 @@ class ExtensionManager(Configurable): if (module_str in self.loaded) and (module_str in sys.modules): self.unload_extension(module_str) mod = sys.modules[module_str] - with prepended_to_syspath(self.ipython_extension_dir): - reload(mod) + reload(mod) if self._call_load_ipython_extension(mod): self.loaded.add(module_str) else: