##// END OF EJS Templates
deprecate auto-injection of deep-reload
Matthias Bussonnier -
Show More
@@ -56,9 +56,11 b' class BuiltinTrap(Configurable):'
56 try:
56 try:
57 from IPython.lib import deepreload
57 from IPython.lib import deepreload
58 if self.shell.deep_reload:
58 if self.shell.deep_reload:
59 self.auto_builtins['reload'] = deepreload.reload
59 from warnings import warn
60 warn("Automatically replacing builtin `reload` by `deepreload.reload` is deprecated, please import `reload` explicitly from `IPython.lib.deeprelaod", DeprecationWarning)
61 self.auto_builtins['reload'] = deepreload._dreload
60 else:
62 else:
61 self.auto_builtins['dreload']= deepreload.reload
63 self.auto_builtins['dreload']= deepreload._dreload
62 except ImportError:
64 except ImportError:
63 pass
65 pass
64
66
@@ -284,10 +284,12 b' class InteractiveShell(SingletonConfigurable):'
284 debug = CBool(False, config=True)
284 debug = CBool(False, config=True)
285 deep_reload = CBool(False, config=True, help=
285 deep_reload = CBool(False, config=True, help=
286 """
286 """
287 **Deprecated**
288
287 Enable deep (recursive) reloading by default. IPython can use the
289 Enable deep (recursive) reloading by default. IPython can use the
288 deep_reload module which reloads changes in modules recursively (it
290 deep_reload module which reloads changes in modules recursively (it
289 replaces the reload() function, so you don't need to change anything to
291 replaces the reload() function, so you don't need to change anything to
290 use it). deep_reload() forces a full reload of modules whose code may
292 use it). `deep_reload` forces a full reload of modules whose code may
291 have changed, which the default reload() function does not. When
293 have changed, which the default reload() function does not. When
292 deep_reload is off, IPython will use the normal reload(), but
294 deep_reload is off, IPython will use the normal reload(), but
293 deep_reload will still be available as dreload().
295 deep_reload will still be available as dreload().
@@ -71,7 +71,7 b" addflag('color-info', 'InteractiveShell.color_info',"
71 "Disable using colors for info related things."
71 "Disable using colors for info related things."
72 )
72 )
73 addflag('deep-reload', 'InteractiveShell.deep_reload',
73 addflag('deep-reload', 'InteractiveShell.deep_reload',
74 """Enable deep (recursive) reloading by default. IPython can use the
74 """ **Deprecated** Enable deep (recursive) reloading by default. IPython can use the
75 deep_reload module which reloads changes in modules recursively (it
75 deep_reload module which reloads changes in modules recursively (it
76 replaces the reload() function, so you don't need to change anything to
76 replaces the reload() function, so you don't need to change anything to
77 use it). deep_reload() forces a full reload of modules whose code may
77 use it). deep_reload() forces a full reload of modules whose code may
@@ -327,7 +327,7 b' except AttributeError:'
327 original_reload = imp.reload # Python 3
327 original_reload = imp.reload # Python 3
328
328
329 # Replacement for reload()
329 # Replacement for reload()
330 def reload(module, exclude=['sys', 'os.path', builtin_mod_name, '__main__']):
330 def reload(module, exclude=('sys', 'os.path', builtin_mod_name, '__main__')):
331 """Recursively reload all modules used in the given module. Optionally
331 """Recursively reload all modules used in the given module. Optionally
332 takes a list of modules to exclude from reloading. The default exclude
332 takes a list of modules to exclude from reloading. The default exclude
333 list contains sys, __main__, and __builtin__, to prevent, e.g., resetting
333 list contains sys, __main__, and __builtin__, to prevent, e.g., resetting
@@ -342,6 +342,19 b" def reload(module, exclude=['sys', 'os.path', builtin_mod_name, '__main__']):"
342 finally:
342 finally:
343 found_now = {}
343 found_now = {}
344
344
345
346 def _dreload(module, **kwargs):
347 """
348 **deprecated**
349
350 import reload explicitly from `IPython.lib.deepreload` to use it
351
352 """
353 warn("""
354 injecting `dreload` in interactive namespace is deprecated, please import `reload` explicitly from `IPython.lib.deepreload`
355 """, DeprecationWarning, stacklevel=2)
356 reload(module, **kwargs)
357
345 # Uncomment the following to automatically activate deep reloading whenever
358 # Uncomment the following to automatically activate deep reloading whenever
346 # this module is imported
359 # this module is imported
347 #builtin_mod.reload = reload
360 #builtin_mod.reload = reload
@@ -70,7 +70,6 b' Example config file'
70 c.InteractiveShell.autoindent = True
70 c.InteractiveShell.autoindent = True
71 c.InteractiveShell.colors = 'LightBG'
71 c.InteractiveShell.colors = 'LightBG'
72 c.InteractiveShell.confirm_exit = False
72 c.InteractiveShell.confirm_exit = False
73 c.InteractiveShell.deep_reload = True
74 c.InteractiveShell.editor = 'nano'
73 c.InteractiveShell.editor = 'nano'
75 c.InteractiveShell.xmode = 'Context'
74 c.InteractiveShell.xmode = 'Context'
76
75
General Comments 0
You need to be logged in to leave comments. Login now