Skip to content

Commit 93ffc15

Browse files
authored
Remove old mentions and uses of ipython_extension_dir (#14310)
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. The extant mentions of `.ipython/extensions` in code came up as a source of confusion in #14263.
2 parents 112e596 + c55d9f3 commit 93ffc15

1 file changed

Lines changed: 3 additions & 18 deletions

File tree

IPython/core/extensions.py

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,22 @@ def load_ipython_extension(ipython):
3535
the only argument. You can do anything you want with IPython at
3636
that point, including defining new magic and aliases, adding new
3737
components, etc.
38-
38+
3939
You can also optionally define an :func:`unload_ipython_extension(ipython)`
4040
function, which will be called if the user unloads or reloads the extension.
4141
The extension manager will only call :func:`load_ipython_extension` again
4242
if the extension is reloaded.
4343
4444
You can put your extension modules anywhere you want, as long as
45-
they can be imported by Python's standard import mechanism. However,
46-
to make it easy to write extensions, you can also put your extensions
47-
in ``os.path.join(self.ipython_dir, 'extensions')``. This directory
48-
is added to ``sys.path`` automatically.
45+
they can be imported by Python's standard import mechanism.
4946
"""
5047

5148
shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)
5249

5350
def __init__(self, shell=None, **kwargs):
5451
super(ExtensionManager, self).__init__(shell=shell, **kwargs)
55-
self.shell.observe(
56-
self._on_ipython_dir_changed, names=('ipython_dir',)
57-
)
5852
self.loaded = set()
5953

60-
@property
61-
def ipython_extension_dir(self):
62-
return os.path.join(self.shell.ipython_dir, u'extensions')
63-
64-
def _on_ipython_dir_changed(self, change):
65-
ensure_dir_exists(self.ipython_extension_dir)
66-
6754
def load_extension(self, module_str: str):
6855
"""Load an IPython extension by its module name.
6956
@@ -124,16 +111,14 @@ def reload_extension(self, module_str: str):
124111
:func:`reload` is called and then the :func:`load_ipython_extension`
125112
function of the module, if it exists is called.
126113
"""
127-
from IPython.utils.syspathcontext import prepended_to_syspath
128114

129115
if BUILTINS_EXTS.get(module_str, False) is True:
130116
module_str = "IPython.extensions." + module_str
131117

132118
if (module_str in self.loaded) and (module_str in sys.modules):
133119
self.unload_extension(module_str)
134120
mod = sys.modules[module_str]
135-
with prepended_to_syspath(self.ipython_extension_dir):
136-
reload(mod)
121+
reload(mod)
137122
if self._call_load_ipython_extension(mod):
138123
self.loaded.add(module_str)
139124
else:

0 commit comments

Comments
 (0)