From 4ff6367edcd75044d60e9e1c558a1fcc59e8b996 Mon Sep 17 00:00:00 2001 From: Yuri Numerov Date: Sun, 23 Aug 2015 19:17:56 +0200 Subject: [PATCH 1/4] removed install_ext magic, as asked in issue #8634 --- IPython/core/magics/extension.py | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/IPython/core/magics/extension.py b/IPython/core/magics/extension.py index 65f3993258c..2991d55ca40 100644 --- a/IPython/core/magics/extension.py +++ b/IPython/core/magics/extension.py @@ -29,35 +29,6 @@ class ExtensionMagics(Magics): """Magics to manage the IPython extensions system.""" - @line_magic - def install_ext(self, parameter_s=''): - """Download and install an extension from a URL, e.g.:: - - %install_ext https://bitbucket.org/birkenfeld/ipython-physics/raw/d1310a2ab15d/physics.py - - The URL should point to an importable Python module - either a .py file - or a .zip file. - - Parameters: - - -n filename : Specify a name for the file, rather than taking it from - the URL. - """ - warn("%install_ext` is deprecated, please distribute your extension " - "as a python package.", UserWarning) - opts, args = self.parse_options(parameter_s, 'n:') - try: - filename = self.shell.extension_manager.install_extension(args, - opts.get('n')) - except ValueError as e: - print(e) - return - - filename = os.path.basename(filename) - print("Installed %s. To use it, type:" % filename) - print(" %%load_ext %s" % os.path.splitext(filename)[0]) - - @line_magic def load_ext(self, module_str): """Load an IPython extension by its module name.""" From 36849b27a396f26d64057802da106068b434b46c Mon Sep 17 00:00:00 2001 From: Yuri Numerov Date: Sun, 23 Aug 2015 20:02:02 +0200 Subject: [PATCH 2/4] added pr info to docs/source/whatsnew/pr/ --- docs/source/whatsnew/pr/incompat-deleted-install_ext.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 docs/source/whatsnew/pr/incompat-deleted-install_ext.rst diff --git a/docs/source/whatsnew/pr/incompat-deleted-install_ext.rst b/docs/source/whatsnew/pr/incompat-deleted-install_ext.rst new file mode 100644 index 00000000000..c46ac318f4d --- /dev/null +++ b/docs/source/whatsnew/pr/incompat-deleted-install_ext.rst @@ -0,0 +1,2 @@ +Deleted the install_ext magic from IPython/core/magics/extension.py + From 1dbf2c22fccaa4f5fc9817ca79274bc1da1855de Mon Sep 17 00:00:00 2001 From: Yuri Numerov Date: Mon, 24 Aug 2015 01:03:58 +0200 Subject: [PATCH 3/4] emptied rst file --- docs/source/whatsnew/pr/incompat-deleted-install_ext.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/source/whatsnew/pr/incompat-deleted-install_ext.rst b/docs/source/whatsnew/pr/incompat-deleted-install_ext.rst index c46ac318f4d..e69de29bb2d 100644 --- a/docs/source/whatsnew/pr/incompat-deleted-install_ext.rst +++ b/docs/source/whatsnew/pr/incompat-deleted-install_ext.rst @@ -1,2 +0,0 @@ -Deleted the install_ext magic from IPython/core/magics/extension.py - From fda188e316a8659b8f4e24aec05649d218997e99 Mon Sep 17 00:00:00 2001 From: Yuri Numerov Date: Mon, 24 Aug 2015 01:42:38 +0200 Subject: [PATCH 4/4] commented extension test function that depends on install_ext --- IPython/core/tests/test_magic.py | 35 +++++++++---------- .../pr/incompat-deleted-install_ext.rst | 1 + 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/IPython/core/tests/test_magic.py b/IPython/core/tests/test_magic.py index a9f9392fbae..c307827ec04 100644 --- a/IPython/core/tests/test_magic.py +++ b/IPython/core/tests/test_magic.py @@ -600,24 +600,23 @@ def test_prun_quotes(): _ip.magic(r"prun -q x = '\t'") nt.assert_equal(_ip.user_ns['x'], '\t') -def test_extension(): - tmpdir = TemporaryDirectory() - orig_ipython_dir = _ip.ipython_dir - try: - _ip.ipython_dir = tmpdir.name - nt.assert_raises(ImportError, _ip.magic, "load_ext daft_extension") - url = os.path.join(os.path.dirname(__file__), "daft_extension.py") - _ip.magic("install_ext %s" % url) - _ip.user_ns.pop('arq', None) - invalidate_caches() # Clear import caches - _ip.magic("load_ext daft_extension") - nt.assert_equal(_ip.user_ns['arq'], 185) - _ip.magic("unload_ext daft_extension") - assert 'arq' not in _ip.user_ns - finally: - _ip.ipython_dir = orig_ipython_dir - tmpdir.cleanup() - +#def test_extension(): +# tmpdir = TemporaryDirectory() +# orig_ipython_dir = _ip.ipython_dir +# try: +# _ip.ipython_dir = tmpdir.name +# nt.assert_raises(ImportError, _ip.magic, "load_ext daft_extension") +# url = os.path.join(os.path.dirname(__file__), "daft_extension.py") +# _ip.magic("install_ext %s" % url) +# _ip.user_ns.pop('arq', None) +# invalidate_caches() # Clear import caches +# _ip.magic("load_ext daft_extension") +# nt.assert_equal(_ip.user_ns['arq'], 185) +# _ip.magic("unload_ext daft_extension") +# assert 'arq' not in _ip.user_ns +# finally: +# _ip.ipython_dir = orig_ipython_dir +# tmpdir.cleanup() @dec.skip_without('nbformat') def test_notebook_export_json(): diff --git a/docs/source/whatsnew/pr/incompat-deleted-install_ext.rst b/docs/source/whatsnew/pr/incompat-deleted-install_ext.rst index e69de29bb2d..01b6d750497 100644 --- a/docs/source/whatsnew/pr/incompat-deleted-install_ext.rst +++ b/docs/source/whatsnew/pr/incompat-deleted-install_ext.rst @@ -0,0 +1 @@ +Deleted the install_ext magic function