##// END OF EJS Templates
Merge pull request #3430 from minrk/configinstance...
Brian E. Granger -
r11096:3bde9248 merge
parent child Browse files
Show More
@@ -52,6 +52,7 b' class MultipleInstanceError(ConfigurableError):'
52 class Configurable(HasTraits):
52 class Configurable(HasTraits):
53
53
54 config = Instance(Config, (), {})
54 config = Instance(Config, (), {})
55 parent = Instance('IPython.config.configurable.Configurable')
55 created = None
56 created = None
56
57
57 def __init__(self, **kwargs):
58 def __init__(self, **kwargs):
@@ -63,6 +64,8 b' class Configurable(HasTraits):'
63 If this is empty, default values are used. If config is a
64 If this is empty, default values are used. If config is a
64 :class:`Config` instance, it will be used to configure the
65 :class:`Config` instance, it will be used to configure the
65 instance.
66 instance.
67 parent : Configurable instance, optional
68 The parent Configurable instance of this object.
66
69
67 Notes
70 Notes
68 -----
71 -----
@@ -77,6 +80,13 b' class Configurable(HasTraits):'
77
80
78 This ensures that instances will be configured properly.
81 This ensures that instances will be configured properly.
79 """
82 """
83 parent = kwargs.pop('parent', None)
84 if parent is not None:
85 # config is implied from parent
86 if kwargs.get('config', None) is None:
87 kwargs['config'] = parent.config
88 self.parent = parent
89
80 config = kwargs.pop('config', None)
90 config = kwargs.pop('config', None)
81 if config is not None:
91 if config is not None:
82 # We used to deepcopy, but for now we are trying to just save
92 # We used to deepcopy, but for now we are trying to just save
@@ -95,6 +105,54 b' class Configurable(HasTraits):'
95 #-------------------------------------------------------------------------
105 #-------------------------------------------------------------------------
96 # Static trait notifiations
106 # Static trait notifiations
97 #-------------------------------------------------------------------------
107 #-------------------------------------------------------------------------
108
109 @classmethod
110 def section_names(cls):
111 """return section names as a list"""
112 return [c.__name__ for c in reversed(cls.__mro__) if
113 issubclass(c, Configurable) and issubclass(cls, c)
114 ]
115
116 def _find_my_config(self, cfg):
117 """extract my config from a global Config object
118
119 will construct a Config object of only the config values that apply to me
120 based on my mro(), as well as those of my parent(s) if they exist.
121
122 If I am Bar and my parent is Foo, and their parent is Tim,
123 this will return merge following config sections, in this order::
124
125 [Bar, Foo.bar, Tim.Foo.Bar]
126
127 With the last item being the highest priority.
128 """
129 cfgs = [cfg]
130 if self.parent:
131 cfgs.append(self.parent._find_my_config(cfg))
132 my_config = Config()
133 for c in cfgs:
134 for sname in self.section_names():
135 # Don't do a blind getattr as that would cause the config to
136 # dynamically create the section with name Class.__name__.
137 if c._has_section(sname):
138 my_config.merge(c[sname])
139 return my_config
140
141 def _load_config(self, cfg, section_names=None, traits=None):
142 """load traits from a Config object"""
143
144 if traits is None:
145 traits = self.traits(config=True)
146 if section_names is None:
147 section_names = self.section_names()
148
149 my_config = self._find_my_config(cfg)
150 for name, config_value in my_config.iteritems():
151 if name in traits:
152 # We have to do a deepcopy here if we don't deepcopy the entire
153 # config object. If we don't, a mutable config_value will be
154 # shared by all instances, effectively making it a class attribute.
155 setattr(self, name, deepcopy(config_value))
98
156
99 def _config_changed(self, name, old, new):
157 def _config_changed(self, name, old, new):
100 """Update all the class traits having ``config=True`` as metadata.
158 """Update all the class traits having ``config=True`` as metadata.
@@ -109,39 +167,8 b' class Configurable(HasTraits):'
109 # We auto-load config section for this class as well as any parent
167 # We auto-load config section for this class as well as any parent
110 # classes that are Configurable subclasses. This starts with Configurable
168 # classes that are Configurable subclasses. This starts with Configurable
111 # and works down the mro loading the config for each section.
169 # and works down the mro loading the config for each section.
112 section_names = [cls.__name__ for cls in \
170 section_names = self.section_names()
113 reversed(self.__class__.__mro__) if
171 self._load_config(new, traits=traits, section_names=section_names)
114 issubclass(cls, Configurable) and issubclass(self.__class__, cls)]
115
116 for sname in section_names:
117 # Don't do a blind getattr as that would cause the config to
118 # dynamically create the section with name self.__class__.__name__.
119 if new._has_section(sname):
120 my_config = new[sname]
121 for k, v in traits.iteritems():
122 # Don't allow traitlets with config=True to start with
123 # uppercase. Otherwise, they are confused with Config
124 # subsections. But, developers shouldn't have uppercase
125 # attributes anyways! (PEP 6)
126 if k[0].upper()==k[0] and not k.startswith('_'):
127 raise ConfigurableError('Configurable traitlets with '
128 'config=True must start with a lowercase so they are '
129 'not confused with Config subsections: %s.%s' % \
130 (self.__class__.__name__, k))
131 try:
132 # Here we grab the value from the config
133 # If k has the naming convention of a config
134 # section, it will be auto created.
135 config_value = my_config[k]
136 except KeyError:
137 pass
138 else:
139 # print "Setting %s.%s from %s.%s=%r" % \
140 # (self.__class__.__name__,k,sname,k,config_value)
141 # We have to do a deepcopy here if we don't deepcopy the entire
142 # config object. If we don't, a mutable config_value will be
143 # shared by all instances, effectively making it a class attribute.
144 setattr(self, k, deepcopy(config_value))
145
172
146 def update_config(self, config):
173 def update_config(self, config):
147 """Fire the traits events when the config is updated."""
174 """Fire the traits events when the config is updated."""
@@ -161,7 +188,6 b' class Configurable(HasTraits):'
161 class defaults.
188 class defaults.
162 """
189 """
163 assert inst is None or isinstance(inst, cls)
190 assert inst is None or isinstance(inst, cls)
164 cls_traits = cls.class_traits(config=True)
165 final_help = []
191 final_help = []
166 final_help.append(u'%s options' % cls.__name__)
192 final_help.append(u'%s options' % cls.__name__)
167 final_help.append(len(final_help[0])*u'-')
193 final_help.append(len(final_help[0])*u'-')
@@ -72,10 +72,10 b' class MyApp(Application):'
72 ))
72 ))
73
73
74 def init_foo(self):
74 def init_foo(self):
75 self.foo = Foo(config=self.config)
75 self.foo = Foo(parent=self)
76
76
77 def init_bar(self):
77 def init_bar(self):
78 self.bar = Bar(config=self.config)
78 self.bar = Bar(parent=self)
79
79
80
80
81 class TestApplication(TestCase):
81 class TestApplication(TestCase):
@@ -181,3 +181,104 b' class TestSingletonConfigurable(TestCase):'
181 self.assertEqual(bam, Bam._instance)
181 self.assertEqual(bam, Bam._instance)
182 self.assertEqual(bam, Bar._instance)
182 self.assertEqual(bam, Bar._instance)
183 self.assertEqual(SingletonConfigurable._instance, None)
183 self.assertEqual(SingletonConfigurable._instance, None)
184
185
186 class MyParent(Configurable):
187 pass
188
189 class MyParent2(MyParent):
190 pass
191
192 class TestParentConfigurable(TestCase):
193
194 def test_parent_config(self):
195 cfg = Config({
196 'MyParent' : {
197 'MyConfigurable' : {
198 'b' : 2.0,
199 }
200 }
201 })
202 parent = MyParent(config=cfg)
203 myc = MyConfigurable(parent=parent)
204 self.assertEqual(myc.b, parent.config.MyParent.MyConfigurable.b)
205
206 def test_parent_inheritance(self):
207 cfg = Config({
208 'MyParent' : {
209 'MyConfigurable' : {
210 'b' : 2.0,
211 }
212 }
213 })
214 parent = MyParent2(config=cfg)
215 myc = MyConfigurable(parent=parent)
216 self.assertEqual(myc.b, parent.config.MyParent.MyConfigurable.b)
217
218 def test_multi_parent(self):
219 cfg = Config({
220 'MyParent2' : {
221 'MyParent' : {
222 'MyConfigurable' : {
223 'b' : 2.0,
224 }
225 },
226 # this one shouldn't count
227 'MyConfigurable' : {
228 'b' : 3.0,
229 },
230 }
231 })
232 parent2 = MyParent2(config=cfg)
233 parent = MyParent(parent=parent2)
234 myc = MyConfigurable(parent=parent)
235 self.assertEqual(myc.b, parent.config.MyParent2.MyParent.MyConfigurable.b)
236
237 def test_parent_priority(self):
238 cfg = Config({
239 'MyConfigurable' : {
240 'b' : 2.0,
241 },
242 'MyParent' : {
243 'MyConfigurable' : {
244 'b' : 3.0,
245 }
246 },
247 'MyParent2' : {
248 'MyConfigurable' : {
249 'b' : 4.0,
250 }
251 }
252 })
253 parent = MyParent2(config=cfg)
254 myc = MyConfigurable(parent=parent)
255 self.assertEqual(myc.b, parent.config.MyParent2.MyConfigurable.b)
256
257 def test_multi_parent_priority(self):
258 cfg = Config({
259 'MyConfigurable' : {
260 'b' : 2.0,
261 },
262 'MyParent' : {
263 'MyConfigurable' : {
264 'b' : 3.0,
265 }
266 },
267 'MyParent2' : {
268 'MyConfigurable' : {
269 'b' : 4.0,
270 }
271 },
272 'MyParent2' : {
273 'MyParent' : {
274 'MyConfigurable' : {
275 'b' : 5.0,
276 }
277 }
278 }
279 })
280 parent2 = MyParent2(config=cfg)
281 parent = MyParent2(parent=parent2)
282 myc = MyConfigurable(parent=parent)
283 self.assertEqual(myc.b, parent.config.MyParent2.MyParent.MyConfigurable.b)
284
@@ -341,7 +341,7 b' class IPythonConsoleApp(Configurable):'
341 stdin_port=self.stdin_port,
341 stdin_port=self.stdin_port,
342 hb_port=self.hb_port,
342 hb_port=self.hb_port,
343 connection_file=self.connection_file,
343 connection_file=self.connection_file,
344 config=self.config,
344 parent=self,
345 )
345 )
346 self.kernel_manager.client_factory = self.kernel_client_class
346 self.kernel_manager.client_factory = self.kernel_client_class
347 self.kernel_manager.start_kernel(extra_arguments=self.kernel_argv)
347 self.kernel_manager.start_kernel(extra_arguments=self.kernel_argv)
@@ -371,7 +371,7 b' class IPythonConsoleApp(Configurable):'
371 stdin_port=self.stdin_port,
371 stdin_port=self.stdin_port,
372 hb_port=self.hb_port,
372 hb_port=self.hb_port,
373 connection_file=self.connection_file,
373 connection_file=self.connection_file,
374 config=self.config,
374 parent=self,
375 )
375 )
376
376
377 self.kernel_client.start_channels()
377 self.kernel_client.start_channels()
@@ -114,8 +114,8 b' class AliasManager(Configurable):'
114 user_aliases = List(default_value=[], config=True)
114 user_aliases = List(default_value=[], config=True)
115 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
115 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
116
116
117 def __init__(self, shell=None, config=None):
117 def __init__(self, shell=None, **kwargs):
118 super(AliasManager, self).__init__(shell=shell, config=config)
118 super(AliasManager, self).__init__(shell=shell, **kwargs)
119 self.alias_table = {}
119 self.alias_table = {}
120 self.exclude_aliases()
120 self.exclude_aliases()
121 self.init_aliases()
121 self.init_aliases()
@@ -246,7 +246,7 b' class Completer(Configurable):'
246 )
246 )
247
247
248
248
249 def __init__(self, namespace=None, global_namespace=None, config=None, **kwargs):
249 def __init__(self, namespace=None, global_namespace=None, **kwargs):
250 """Create a new completer for the command line.
250 """Create a new completer for the command line.
251
251
252 Completer(namespace=ns,global_namespace=ns2) -> completer instance.
252 Completer(namespace=ns,global_namespace=ns2) -> completer instance.
@@ -280,7 +280,7 b' class Completer(Configurable):'
280 else:
280 else:
281 self.global_namespace = global_namespace
281 self.global_namespace = global_namespace
282
282
283 super(Completer, self).__init__(config=config, **kwargs)
283 super(Completer, self).__init__(**kwargs)
284
284
285 def complete(self, text, state):
285 def complete(self, text, state):
286 """Return the next possible completion for 'text'.
286 """Return the next possible completion for 'text'.
@@ -50,8 +50,8 b' class DisplayHook(Configurable):'
50
50
51 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
51 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
52
52
53 def __init__(self, shell=None, cache_size=1000, config=None):
53 def __init__(self, shell=None, cache_size=1000, **kwargs):
54 super(DisplayHook, self).__init__(shell=shell, config=config)
54 super(DisplayHook, self).__init__(shell=shell, **kwargs)
55
55
56 cache_size_min = 3
56 cache_size_min = 3
57 if cache_size <= 0:
57 if cache_size <= 0:
@@ -47,7 +47,7 b' class ExtensionManager(Configurable):'
47 that point, including defining new magic and aliases, adding new
47 that point, including defining new magic and aliases, adding new
48 components, etc.
48 components, etc.
49
49
50 You can also optionaly define an :func:`unload_ipython_extension(ipython)`
50 You can also optionally define an :func:`unload_ipython_extension(ipython)`
51 function, which will be called if the user unloads or reloads the extension.
51 function, which will be called if the user unloads or reloads the extension.
52 The extension manager will only call :func:`load_ipython_extension` again
52 The extension manager will only call :func:`load_ipython_extension` again
53 if the extension is reloaded.
53 if the extension is reloaded.
@@ -61,8 +61,8 b' class ExtensionManager(Configurable):'
61
61
62 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
62 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
63
63
64 def __init__(self, shell=None, config=None):
64 def __init__(self, shell=None, **kwargs):
65 super(ExtensionManager, self).__init__(shell=shell, config=config)
65 super(ExtensionManager, self).__init__(shell=shell, **kwargs)
66 self.shell.on_trait_change(
66 self.shell.on_trait_change(
67 self._on_ipython_dir_changed, 'ipython_dir'
67 self._on_ipython_dir_changed, 'ipython_dir'
68 )
68 )
@@ -92,7 +92,7 b' class DisplayFormatter(Configurable):'
92 ]
92 ]
93 d = {}
93 d = {}
94 for cls in formatter_classes:
94 for cls in formatter_classes:
95 f = cls(config=self.config)
95 f = cls(parent=self)
96 d[f.format_type] = f
96 d[f.format_type] = f
97 return d
97 return d
98
98
@@ -148,7 +148,7 b' class HistoryAccessor(Configurable):'
148 (self.__class__.__name__, new)
148 (self.__class__.__name__, new)
149 raise TraitError(msg)
149 raise TraitError(msg)
150
150
151 def __init__(self, profile='default', hist_file=u'', config=None, **traits):
151 def __init__(self, profile='default', hist_file=u'', **traits):
152 """Create a new history accessor.
152 """Create a new history accessor.
153
153
154 Parameters
154 Parameters
@@ -162,7 +162,7 b' class HistoryAccessor(Configurable):'
162 Config object. hist_file can also be set through this.
162 Config object. hist_file can also be set through this.
163 """
163 """
164 # We need a pointer back to the shell for various tasks.
164 # We need a pointer back to the shell for various tasks.
165 super(HistoryAccessor, self).__init__(config=config, **traits)
165 super(HistoryAccessor, self).__init__(**traits)
166 # defer setting hist_file from kwarg until after init,
166 # defer setting hist_file from kwarg until after init,
167 # otherwise the default kwarg value would clobber any value
167 # otherwise the default kwarg value would clobber any value
168 # set by config
168 # set by config
@@ -419,13 +419,13 b' class InteractiveShell(SingletonConfigurable):'
419 # Tracks any GUI loop loaded for pylab
419 # Tracks any GUI loop loaded for pylab
420 pylab_gui_select = None
420 pylab_gui_select = None
421
421
422 def __init__(self, config=None, ipython_dir=None, profile_dir=None,
422 def __init__(self, ipython_dir=None, profile_dir=None,
423 user_module=None, user_ns=None,
423 user_module=None, user_ns=None,
424 custom_exceptions=((), None), **kwargs):
424 custom_exceptions=((), None), **kwargs):
425
425
426 # This is where traits with a config_key argument are updated
426 # This is where traits with a config_key argument are updated
427 # from the values on config.
427 # from the values on config.
428 super(InteractiveShell, self).__init__(config=config, **kwargs)
428 super(InteractiveShell, self).__init__(**kwargs)
429 self.configurables = [self]
429 self.configurables = [self]
430
430
431 # These are relatively independent and stateless
431 # These are relatively independent and stateless
@@ -651,7 +651,7 b' class InteractiveShell(SingletonConfigurable):'
651 io.stderr = io.IOStream(sys.stderr)
651 io.stderr = io.IOStream(sys.stderr)
652
652
653 def init_prompts(self):
653 def init_prompts(self):
654 self.prompt_manager = PromptManager(shell=self, config=self.config)
654 self.prompt_manager = PromptManager(shell=self, parent=self)
655 self.configurables.append(self.prompt_manager)
655 self.configurables.append(self.prompt_manager)
656 # Set system prompts, so that scripts can decide if they are running
656 # Set system prompts, so that scripts can decide if they are running
657 # interactively.
657 # interactively.
@@ -660,24 +660,24 b' class InteractiveShell(SingletonConfigurable):'
660 sys.ps3 = 'Out: '
660 sys.ps3 = 'Out: '
661
661
662 def init_display_formatter(self):
662 def init_display_formatter(self):
663 self.display_formatter = DisplayFormatter(config=self.config)
663 self.display_formatter = DisplayFormatter(parent=self)
664 self.configurables.append(self.display_formatter)
664 self.configurables.append(self.display_formatter)
665
665
666 def init_display_pub(self):
666 def init_display_pub(self):
667 self.display_pub = self.display_pub_class(config=self.config)
667 self.display_pub = self.display_pub_class(parent=self)
668 self.configurables.append(self.display_pub)
668 self.configurables.append(self.display_pub)
669
669
670 def init_data_pub(self):
670 def init_data_pub(self):
671 if not self.data_pub_class:
671 if not self.data_pub_class:
672 self.data_pub = None
672 self.data_pub = None
673 return
673 return
674 self.data_pub = self.data_pub_class(config=self.config)
674 self.data_pub = self.data_pub_class(parent=self)
675 self.configurables.append(self.data_pub)
675 self.configurables.append(self.data_pub)
676
676
677 def init_displayhook(self):
677 def init_displayhook(self):
678 # Initialize displayhook, set in/out prompts and printing system
678 # Initialize displayhook, set in/out prompts and printing system
679 self.displayhook = self.displayhook_class(
679 self.displayhook = self.displayhook_class(
680 config=self.config,
680 parent=self,
681 shell=self,
681 shell=self,
682 cache_size=self.cache_size,
682 cache_size=self.cache_size,
683 )
683 )
@@ -688,7 +688,7 b' class InteractiveShell(SingletonConfigurable):'
688
688
689 def init_latextool(self):
689 def init_latextool(self):
690 """Configure LaTeXTool."""
690 """Configure LaTeXTool."""
691 cfg = LaTeXTool.instance(config=self.config)
691 cfg = LaTeXTool.instance(parent=self)
692 if cfg not in self.configurables:
692 if cfg not in self.configurables:
693 self.configurables.append(cfg)
693 self.configurables.append(cfg)
694
694
@@ -1511,7 +1511,7 b' class InteractiveShell(SingletonConfigurable):'
1511
1511
1512 def init_history(self):
1512 def init_history(self):
1513 """Sets up the command history, and starts regular autosaves."""
1513 """Sets up the command history, and starts regular autosaves."""
1514 self.history_manager = HistoryManager(shell=self, config=self.config)
1514 self.history_manager = HistoryManager(shell=self, parent=self)
1515 self.configurables.append(self.history_manager)
1515 self.configurables.append(self.history_manager)
1516
1516
1517 #-------------------------------------------------------------------------
1517 #-------------------------------------------------------------------------
@@ -1943,7 +1943,7 b' class InteractiveShell(SingletonConfigurable):'
1943 global_namespace=self.user_global_ns,
1943 global_namespace=self.user_global_ns,
1944 alias_table=self.alias_manager.alias_table,
1944 alias_table=self.alias_manager.alias_table,
1945 use_readline=self.has_readline,
1945 use_readline=self.has_readline,
1946 config=self.config,
1946 parent=self,
1947 )
1947 )
1948 self.configurables.append(self.Completer)
1948 self.configurables.append(self.Completer)
1949
1949
@@ -2038,7 +2038,7 b' class InteractiveShell(SingletonConfigurable):'
2038 def init_magics(self):
2038 def init_magics(self):
2039 from IPython.core import magics as m
2039 from IPython.core import magics as m
2040 self.magics_manager = magic.MagicsManager(shell=self,
2040 self.magics_manager = magic.MagicsManager(shell=self,
2041 config=self.config,
2041 parent=self,
2042 user_magics=m.UserMagics(self))
2042 user_magics=m.UserMagics(self))
2043 self.configurables.append(self.magics_manager)
2043 self.configurables.append(self.magics_manager)
2044
2044
@@ -2299,7 +2299,7 b' class InteractiveShell(SingletonConfigurable):'
2299 #-------------------------------------------------------------------------
2299 #-------------------------------------------------------------------------
2300
2300
2301 def init_alias(self):
2301 def init_alias(self):
2302 self.alias_manager = AliasManager(shell=self, config=self.config)
2302 self.alias_manager = AliasManager(shell=self, parent=self)
2303 self.configurables.append(self.alias_manager)
2303 self.configurables.append(self.alias_manager)
2304 self.ns_table['alias'] = self.alias_manager.alias_table,
2304 self.ns_table['alias'] = self.alias_manager.alias_table,
2305
2305
@@ -2308,7 +2308,7 b' class InteractiveShell(SingletonConfigurable):'
2308 #-------------------------------------------------------------------------
2308 #-------------------------------------------------------------------------
2309
2309
2310 def init_extension_manager(self):
2310 def init_extension_manager(self):
2311 self.extension_manager = ExtensionManager(shell=self, config=self.config)
2311 self.extension_manager = ExtensionManager(shell=self, parent=self)
2312 self.configurables.append(self.extension_manager)
2312 self.configurables.append(self.extension_manager)
2313
2313
2314 #-------------------------------------------------------------------------
2314 #-------------------------------------------------------------------------
@@ -2316,7 +2316,7 b' class InteractiveShell(SingletonConfigurable):'
2316 #-------------------------------------------------------------------------
2316 #-------------------------------------------------------------------------
2317
2317
2318 def init_payload(self):
2318 def init_payload(self):
2319 self.payload_manager = PayloadManager(config=self.config)
2319 self.payload_manager = PayloadManager(parent=self)
2320 self.configurables.append(self.payload_manager)
2320 self.configurables.append(self.payload_manager)
2321
2321
2322 #-------------------------------------------------------------------------
2322 #-------------------------------------------------------------------------
@@ -2324,7 +2324,7 b' class InteractiveShell(SingletonConfigurable):'
2324 #-------------------------------------------------------------------------
2324 #-------------------------------------------------------------------------
2325
2325
2326 def init_prefilter(self):
2326 def init_prefilter(self):
2327 self.prefilter_manager = PrefilterManager(shell=self, config=self.config)
2327 self.prefilter_manager = PrefilterManager(shell=self, parent=self)
2328 self.configurables.append(self.prefilter_manager)
2328 self.configurables.append(self.prefilter_manager)
2329 # Ultimately this will be refactored in the new interpreter code, but
2329 # Ultimately this will be refactored in the new interpreter code, but
2330 # for now, we should expose the main prefilter method (there's legacy
2330 # for now, we should expose the main prefilter method (there's legacy
@@ -134,8 +134,8 b' class PrefilterManager(Configurable):'
134 multi_line_specials = CBool(True, config=True)
134 multi_line_specials = CBool(True, config=True)
135 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
135 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
136
136
137 def __init__(self, shell=None, config=None):
137 def __init__(self, shell=None, **kwargs):
138 super(PrefilterManager, self).__init__(shell=shell, config=config)
138 super(PrefilterManager, self).__init__(shell=shell, **kwargs)
139 self.shell = shell
139 self.shell = shell
140 self.init_transformers()
140 self.init_transformers()
141 self.init_handlers()
141 self.init_handlers()
@@ -150,7 +150,7 b' class PrefilterManager(Configurable):'
150 self._transformers = []
150 self._transformers = []
151 for transformer_cls in _default_transformers:
151 for transformer_cls in _default_transformers:
152 transformer_cls(
152 transformer_cls(
153 shell=self.shell, prefilter_manager=self, config=self.config
153 shell=self.shell, prefilter_manager=self, parent=self
154 )
154 )
155
155
156 def sort_transformers(self):
156 def sort_transformers(self):
@@ -186,7 +186,7 b' class PrefilterManager(Configurable):'
186 self._checkers = []
186 self._checkers = []
187 for checker in _default_checkers:
187 for checker in _default_checkers:
188 checker(
188 checker(
189 shell=self.shell, prefilter_manager=self, config=self.config
189 shell=self.shell, prefilter_manager=self, parent=self
190 )
190 )
191
191
192 def sort_checkers(self):
192 def sort_checkers(self):
@@ -223,7 +223,7 b' class PrefilterManager(Configurable):'
223 self._esc_handlers = {}
223 self._esc_handlers = {}
224 for handler in _default_handlers:
224 for handler in _default_handlers:
225 handler(
225 handler(
226 shell=self.shell, prefilter_manager=self, config=self.config
226 shell=self.shell, prefilter_manager=self, parent=self
227 )
227 )
228
228
229 @property
229 @property
@@ -368,9 +368,9 b' class PrefilterTransformer(Configurable):'
368 prefilter_manager = Instance('IPython.core.prefilter.PrefilterManager')
368 prefilter_manager = Instance('IPython.core.prefilter.PrefilterManager')
369 enabled = Bool(True, config=True)
369 enabled = Bool(True, config=True)
370
370
371 def __init__(self, shell=None, prefilter_manager=None, config=None):
371 def __init__(self, shell=None, prefilter_manager=None, **kwargs):
372 super(PrefilterTransformer, self).__init__(
372 super(PrefilterTransformer, self).__init__(
373 shell=shell, prefilter_manager=prefilter_manager, config=config
373 shell=shell, prefilter_manager=prefilter_manager, **kwargs
374 )
374 )
375 self.prefilter_manager.register_transformer(self)
375 self.prefilter_manager.register_transformer(self)
376
376
@@ -396,9 +396,9 b' class PrefilterChecker(Configurable):'
396 prefilter_manager = Instance('IPython.core.prefilter.PrefilterManager')
396 prefilter_manager = Instance('IPython.core.prefilter.PrefilterManager')
397 enabled = Bool(True, config=True)
397 enabled = Bool(True, config=True)
398
398
399 def __init__(self, shell=None, prefilter_manager=None, config=None):
399 def __init__(self, shell=None, prefilter_manager=None, **kwargs):
400 super(PrefilterChecker, self).__init__(
400 super(PrefilterChecker, self).__init__(
401 shell=shell, prefilter_manager=prefilter_manager, config=config
401 shell=shell, prefilter_manager=prefilter_manager, **kwargs
402 )
402 )
403 self.prefilter_manager.register_checker(self)
403 self.prefilter_manager.register_checker(self)
404
404
@@ -561,9 +561,9 b' class PrefilterHandler(Configurable):'
561 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
561 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
562 prefilter_manager = Instance('IPython.core.prefilter.PrefilterManager')
562 prefilter_manager = Instance('IPython.core.prefilter.PrefilterManager')
563
563
564 def __init__(self, shell=None, prefilter_manager=None, config=None):
564 def __init__(self, shell=None, prefilter_manager=None, **kwargs):
565 super(PrefilterHandler, self).__init__(
565 super(PrefilterHandler, self).__init__(
566 shell=shell, prefilter_manager=prefilter_manager, config=config
566 shell=shell, prefilter_manager=prefilter_manager, **kwargs
567 )
567 )
568 self.prefilter_manager.register_handler(
568 self.prefilter_manager.register_handler(
569 self.handler_name,
569 self.handler_name,
@@ -318,8 +318,8 b' class PromptManager(Configurable):'
318 def _invisible_chars_default(self):
318 def _invisible_chars_default(self):
319 return {'in': 0, 'in2': 0, 'out': 0, 'rewrite':0}
319 return {'in': 0, 'in2': 0, 'out': 0, 'rewrite':0}
320
320
321 def __init__(self, shell, config=None):
321 def __init__(self, shell, **kwargs):
322 super(PromptManager, self).__init__(shell=shell, config=config)
322 super(PromptManager, self).__init__(shell=shell, **kwargs)
323
323
324 # Prepare colour scheme table
324 # Prepare colour scheme table
325 self.color_scheme_table = coloransi.ColorSchemeTable([PColNoColors,
325 self.color_scheme_table = coloransi.ColorSchemeTable([PColNoColors,
@@ -298,7 +298,7 b' def configure_inline_support(shell, backend, user_ns=None):'
298
298
299 user_ns = shell.user_ns if user_ns is None else user_ns
299 user_ns = shell.user_ns if user_ns is None else user_ns
300
300
301 cfg = InlineBackend.instance(config=shell.config)
301 cfg = InlineBackend.instance(parent=shell)
302 cfg.shell = shell
302 cfg.shell = shell
303 if cfg not in shell.configurables:
303 if cfg not in shell.configurables:
304 shell.configurables.append(cfg)
304 shell.configurables.append(cfg)
@@ -84,7 +84,7 b' class AuthenticatedZMQStreamHandler(ZMQStreamHandler, IPythonHandler):'
84
84
85 def open(self, kernel_id):
85 def open(self, kernel_id):
86 self.kernel_id = kernel_id.decode('ascii')
86 self.kernel_id = kernel_id.decode('ascii')
87 self.session = Session(config=self.config)
87 self.session = Session(parent=self)
88 self.save_on_message = self.on_message
88 self.save_on_message = self.on_message
89 self.on_message = self.on_first_message
89 self.on_message = self.on_first_message
90
90
@@ -522,13 +522,13 b' class NotebookApp(BaseIPythonApplication):'
522 # force Session default to be secure
522 # force Session default to be secure
523 default_secure(self.config)
523 default_secure(self.config)
524 self.kernel_manager = MappingKernelManager(
524 self.kernel_manager = MappingKernelManager(
525 config=self.config, log=self.log, kernel_argv=self.kernel_argv,
525 parent=self, log=self.log, kernel_argv=self.kernel_argv,
526 connection_dir = self.profile_dir.security_dir,
526 connection_dir = self.profile_dir.security_dir,
527 )
527 )
528 kls = import_item(self.notebook_manager_class)
528 kls = import_item(self.notebook_manager_class)
529 self.notebook_manager = kls(config=self.config, log=self.log)
529 self.notebook_manager = kls(parent=self, log=self.log)
530 self.notebook_manager.load_notebook_names()
530 self.notebook_manager.load_notebook_names()
531 self.cluster_manager = ClusterManager(config=self.config, log=self.log)
531 self.cluster_manager = ClusterManager(parent=self, log=self.log)
532 self.cluster_manager.update_profiles()
532 self.cluster_manager.update_profiles()
533
533
534 def init_logging(self):
534 def init_logging(self):
@@ -59,7 +59,7 b' class KernelClient(LoggingConfigurable, ConnectionFileMixin):'
59 # The Session to use for communication with the kernel.
59 # The Session to use for communication with the kernel.
60 session = Instance(Session)
60 session = Instance(Session)
61 def _session_default(self):
61 def _session_default(self):
62 return Session(config=self.config)
62 return Session(parent=self)
63
63
64 # The classes to use for the various channels
64 # The classes to use for the various channels
65 shell_channel_class = Type(ShellChannel)
65 shell_channel_class = Type(ShellChannel)
@@ -134,7 +134,7 b' class InProcessKernel(Kernel):'
134
134
135 def _session_default(self):
135 def _session_default(self):
136 from IPython.kernel.zmq.session import Session
136 from IPython.kernel.zmq.session import Session
137 return Session(config=self.config)
137 return Session(parent=self)
138
138
139 def _shell_class_default(self):
139 def _shell_class_default(self):
140 return InProcessInteractiveShell
140 return InProcessInteractiveShell
@@ -48,7 +48,7 b' class IOLoopKernelManager(KernelManager):'
48 if self._restarter is None:
48 if self._restarter is None:
49 self._restarter = IOLoopKernelRestarter(
49 self._restarter = IOLoopKernelRestarter(
50 kernel_manager=self, loop=self.loop,
50 kernel_manager=self, loop=self.loop,
51 config=self.config, log=self.log
51 parent=self, log=self.log
52 )
52 )
53 self._restarter.start()
53 self._restarter.start()
54
54
@@ -56,7 +56,7 b' class KernelManager(LoggingConfigurable, ConnectionFileMixin):'
56 # The Session to use for communication with the kernel.
56 # The Session to use for communication with the kernel.
57 session = Instance(Session)
57 session = Instance(Session)
58 def _session_default(self):
58 def _session_default(self):
59 return Session(config=self.config)
59 return Session(parent=self)
60
60
61 # the class to create with our `client` method
61 # the class to create with our `client` method
62 client_class = DottedObjectName('IPython.kernel.blocking.BlockingKernelClient')
62 client_class = DottedObjectName('IPython.kernel.blocking.BlockingKernelClient')
@@ -129,7 +129,7 b' class KernelManager(LoggingConfigurable, ConnectionFileMixin):'
129 kw.update(dict(
129 kw.update(dict(
130 connection_file=self.connection_file,
130 connection_file=self.connection_file,
131 session=self.session,
131 session=self.session,
132 config=self.config,
132 parent=self,
133 ))
133 ))
134
134
135 # add kwargs last, for manual overrides
135 # add kwargs last, for manual overrides
@@ -110,7 +110,7 b' class MultiKernelManager(LoggingConfigurable):'
110 # including things like its transport and ip.
110 # including things like its transport and ip.
111 km = self.kernel_manager_factory(connection_file=os.path.join(
111 km = self.kernel_manager_factory(connection_file=os.path.join(
112 self.connection_dir, "kernel-%s.json" % kernel_id),
112 self.connection_dir, "kernel-%s.json" % kernel_id),
113 config=self.config, autorestart=True, log=self.log
113 parent=self, autorestart=True, log=self.log
114 )
114 )
115 km.start_kernel(**kwargs)
115 km.start_kernel(**kwargs)
116 self._kernels[kernel_id] = km
116 self._kernels[kernel_id] = km
@@ -141,7 +141,7 b' class Kernel(Configurable):'
141 super(Kernel, self).__init__(**kwargs)
141 super(Kernel, self).__init__(**kwargs)
142
142
143 # Initialize the InteractiveShell subclass
143 # Initialize the InteractiveShell subclass
144 self.shell = self.shell_class.instance(config=self.config,
144 self.shell = self.shell_class.instance(parent=self,
145 profile_dir = self.profile_dir,
145 profile_dir = self.profile_dir,
146 user_module = self.user_module,
146 user_module = self.user_module,
147 user_ns = self.user_ns,
147 user_ns = self.user_ns,
@@ -71,7 +71,7 b' kernel_aliases.update({'
71 'stdin' : 'IPKernelApp.stdin_port',
71 'stdin' : 'IPKernelApp.stdin_port',
72 'control' : 'IPKernelApp.control_port',
72 'control' : 'IPKernelApp.control_port',
73 'f' : 'IPKernelApp.connection_file',
73 'f' : 'IPKernelApp.connection_file',
74 'parent': 'IPKernelApp.parent',
74 'parent': 'IPKernelApp.parent_handle',
75 'transport': 'IPKernelApp.transport',
75 'transport': 'IPKernelApp.transport',
76 })
76 })
77 if sys.platform.startswith('win'):
77 if sys.platform.startswith('win'):
@@ -172,7 +172,7 b' class IPKernelApp(BaseIPythonApplication, InteractiveShellApp):'
172 config=True, help="The importstring for the DisplayHook factory")
172 config=True, help="The importstring for the DisplayHook factory")
173
173
174 # polling
174 # polling
175 parent = Integer(0, config=True,
175 parent_handle = Integer(0, config=True,
176 help="""kill this process if its parent dies. On Windows, the argument
176 help="""kill this process if its parent dies. On Windows, the argument
177 specifies the HANDLE of the parent process, otherwise it is simply boolean.
177 specifies the HANDLE of the parent process, otherwise it is simply boolean.
178 """)
178 """)
@@ -188,9 +188,9 b' class IPKernelApp(BaseIPythonApplication, InteractiveShellApp):'
188
188
189 def init_poller(self):
189 def init_poller(self):
190 if sys.platform == 'win32':
190 if sys.platform == 'win32':
191 if self.interrupt or self.parent:
191 if self.interrupt or self.parent_handle:
192 self.poller = ParentPollerWindows(self.interrupt, self.parent)
192 self.poller = ParentPollerWindows(self.interrupt, self.parent_handle)
193 elif self.parent:
193 elif self.parent_handle:
194 self.poller = ParentPollerUnix()
194 self.poller = ParentPollerUnix()
195
195
196 def _bind_socket(self, s, port):
196 def _bind_socket(self, s, port):
@@ -329,8 +329,8 b' class IPKernelApp(BaseIPythonApplication, InteractiveShellApp):'
329 # to see the connection info
329 # to see the connection info
330 for line in lines:
330 for line in lines:
331 self.log.info(line)
331 self.log.info(line)
332 # also raw print to the terminal if no parent (`ipython kernel`)
332 # also raw print to the terminal if no parent_handle (`ipython kernel`)
333 if not self.parent:
333 if not self.parent_handle:
334 for line in lines:
334 for line in lines:
335 io.rprint(line)
335 io.rprint(line)
336
336
@@ -341,7 +341,7 b' class IPKernelApp(BaseIPythonApplication, InteractiveShellApp):'
341 def init_session(self):
341 def init_session(self):
342 """create our session object"""
342 """create our session object"""
343 default_secure(self.config)
343 default_secure(self.config)
344 self.session = Session(config=self.config, username=u'kernel')
344 self.session = Session(parent=self, username=u'kernel')
345
345
346 def init_blackhole(self):
346 def init_blackhole(self):
347 """redirects stdout/stderr to devnull if necessary"""
347 """redirects stdout/stderr to devnull if necessary"""
@@ -372,7 +372,7 b' class IPKernelApp(BaseIPythonApplication, InteractiveShellApp):'
372
372
373 kernel_factory = import_item(str(self.kernel_class))
373 kernel_factory = import_item(str(self.kernel_class))
374
374
375 kernel = kernel_factory(config=self.config, session=self.session,
375 kernel = kernel_factory(parent=self, session=self.session,
376 shell_streams=[shell_stream, control_stream],
376 shell_streams=[shell_stream, control_stream],
377 iopub_socket=self.iopub_socket,
377 iopub_socket=self.iopub_socket,
378 stdin_socket=self.stdin_socket,
378 stdin_socket=self.stdin_socket,
@@ -338,7 +338,7 b' class IPClusterEngines(BaseParallelApplication):'
338 self.exit(1)
338 self.exit(1)
339
339
340 launcher = klass(
340 launcher = klass(
341 work_dir=u'.', config=self.config, log=self.log,
341 work_dir=u'.', parent=self, log=self.log,
342 profile_dir=self.profile_dir.location, cluster_id=self.cluster_id,
342 profile_dir=self.profile_dir.location, cluster_id=self.cluster_id,
343 )
343 )
344 return launcher
344 return launcher
@@ -360,7 +360,7 b' class IPEngineApp(BaseParallelApplication):'
360
360
361 def init_mpi(self):
361 def init_mpi(self):
362 global mpi
362 global mpi
363 self.mpi = MPI(config=self.config)
363 self.mpi = MPI(parent=self)
364
364
365 mpi_import_statement = self.mpi.init_script
365 mpi_import_statement = self.mpi.init_script
366 if mpi_import_statement:
366 if mpi_import_statement:
@@ -76,7 +76,7 b' class IPLoggerApp(BaseParallelApplication):'
76
76
77 def init_watcher(self):
77 def init_watcher(self):
78 try:
78 try:
79 self.watcher = LogWatcher(config=self.config, log=self.log)
79 self.watcher = LogWatcher(parent=self, log=self.log)
80 except:
80 except:
81 self.log.error("Couldn't start the LogWatcher", exc_info=True)
81 self.log.error("Couldn't start the LogWatcher", exc_info=True)
82 self.exit(1)
82 self.exit(1)
@@ -385,7 +385,7 b' class LocalEngineSetLauncher(LocalEngineLauncher):'
385 for i in range(n):
385 for i in range(n):
386 if i > 0:
386 if i > 0:
387 time.sleep(self.delay)
387 time.sleep(self.delay)
388 el = self.launcher_class(work_dir=self.work_dir, config=self.config, log=self.log,
388 el = self.launcher_class(work_dir=self.work_dir, parent=self, log=self.log,
389 profile_dir=self.profile_dir, cluster_id=self.cluster_id,
389 profile_dir=self.profile_dir, cluster_id=self.cluster_id,
390 )
390 )
391
391
@@ -767,7 +767,7 b' class SSHEngineSetLauncher(LocalEngineSetLauncher):'
767 for i in range(n):
767 for i in range(n):
768 if i > 0:
768 if i > 0:
769 time.sleep(self.delay)
769 time.sleep(self.delay)
770 el = self.launcher_class(work_dir=self.work_dir, config=self.config, log=self.log,
770 el = self.launcher_class(work_dir=self.work_dir, parent=self, log=self.log,
771 profile_dir=self.profile_dir, cluster_id=self.cluster_id,
771 profile_dir=self.profile_dir, cluster_id=self.cluster_id,
772 )
772 )
773 if i > 0:
773 if i > 0:
@@ -922,9 +922,9 b' class WindowsHPCControllerLauncher(WindowsHPCLauncher, ClusterAppMixin):'
922 help="extra args to pass to ipcontroller")
922 help="extra args to pass to ipcontroller")
923
923
924 def write_job_file(self, n):
924 def write_job_file(self, n):
925 job = IPControllerJob(config=self.config)
925 job = IPControllerJob(parent=self)
926
926
927 t = IPControllerTask(config=self.config)
927 t = IPControllerTask(parent=self)
928 # The tasks work directory is *not* the actual work directory of
928 # The tasks work directory is *not* the actual work directory of
929 # the controller. It is used as the base path for the stdout/stderr
929 # the controller. It is used as the base path for the stdout/stderr
930 # files that the scheduler redirects to.
930 # files that the scheduler redirects to.
@@ -954,10 +954,10 b' class WindowsHPCEngineSetLauncher(WindowsHPCLauncher, ClusterAppMixin):'
954 help="extra args to pas to ipengine")
954 help="extra args to pas to ipengine")
955
955
956 def write_job_file(self, n):
956 def write_job_file(self, n):
957 job = IPEngineSetJob(config=self.config)
957 job = IPEngineSetJob(parent=self)
958
958
959 for i in range(n):
959 for i in range(n):
960 t = IPEngineTask(config=self.config)
960 t = IPEngineTask(parent=self)
961 # The tasks work directory is *not* the actual work directory of
961 # The tasks work directory is *not* the actual work directory of
962 # the engine. It is used as the base path for the stdout/stderr
962 # the engine. It is used as the base path for the stdout/stderr
963 # files that the scheduler redirects to.
963 # files that the scheduler redirects to.
@@ -300,7 +300,7 b' class HubFactory(RegistrationFactory):'
300 hrep = ctx.socket(zmq.ROUTER)
300 hrep = ctx.socket(zmq.ROUTER)
301 util.set_hwm(hrep, 0)
301 util.set_hwm(hrep, 0)
302 hrep.bind(self.engine_url('hb_pong'))
302 hrep.bind(self.engine_url('hb_pong'))
303 self.heartmonitor = HeartMonitor(loop=loop, config=self.config, log=self.log,
303 self.heartmonitor = HeartMonitor(loop=loop, parent=self, log=self.log,
304 pingstream=ZMQStream(hpub,loop),
304 pingstream=ZMQStream(hpub,loop),
305 pongstream=ZMQStream(hrep,loop)
305 pongstream=ZMQStream(hrep,loop)
306 )
306 )
@@ -324,7 +324,7 b' class HubFactory(RegistrationFactory):'
324 db_class = _db_shortcuts.get(self.db_class.lower(), self.db_class)
324 db_class = _db_shortcuts.get(self.db_class.lower(), self.db_class)
325 self.log.info('Hub using DB backend: %r', (db_class.split('.')[-1]))
325 self.log.info('Hub using DB backend: %r', (db_class.split('.')[-1]))
326 self.db = import_item(str(db_class))(session=self.session.session,
326 self.db = import_item(str(db_class))(session=self.session.session,
327 config=self.config, log=self.log)
327 parent=self, log=self.log)
328 time.sleep(.25)
328 time.sleep(.25)
329
329
330 # resubmit stream
330 # resubmit stream
@@ -230,7 +230,7 b' class EngineFactory(RegistrationFactory):'
230 sys.displayhook = self.display_hook_factory(self.session, iopub_socket)
230 sys.displayhook = self.display_hook_factory(self.session, iopub_socket)
231 sys.displayhook.topic = cast_bytes('engine.%i.pyout' % self.id)
231 sys.displayhook.topic = cast_bytes('engine.%i.pyout' % self.id)
232
232
233 self.kernel = Kernel(config=self.config, int_id=self.id, ident=self.ident, session=self.session,
233 self.kernel = Kernel(parent=self, int_id=self.id, ident=self.ident, session=self.session,
234 control_stream=control_stream, shell_streams=shell_streams, iopub_socket=iopub_socket,
234 control_stream=control_stream, shell_streams=shell_streams, iopub_socket=iopub_socket,
235 loop=loop, user_ns=self.user_ns, log=self.log)
235 loop=loop, user_ns=self.user_ns, log=self.log)
236
236
@@ -251,7 +251,7 b' class EngineFactory(RegistrationFactory):'
251
251
252
252
253 # FIXME: This is a hack until IPKernelApp and IPEngineApp can be fully merged
253 # FIXME: This is a hack until IPKernelApp and IPEngineApp can be fully merged
254 app = IPKernelApp(config=self.config, shell=self.kernel.shell, kernel=self.kernel, log=self.log)
254 app = IPKernelApp(parent=self, shell=self.kernel.shell, kernel=self.kernel, log=self.log)
255 app.init_profile_dir()
255 app.init_profile_dir()
256 app.init_code()
256 app.init_code()
257
257
@@ -196,7 +196,7 b' class IPythonQtConsoleApp(BaseIPythonApplication, IPythonConsoleApp):'
196 """
196 """
197 kernel_manager = self.kernel_manager_class(
197 kernel_manager = self.kernel_manager_class(
198 connection_file=self._new_connection_file(),
198 connection_file=self._new_connection_file(),
199 config=self.config,
199 parent=self,
200 autorestart=True,
200 autorestart=True,
201 )
201 )
202 # start the kernel
202 # start the kernel
@@ -37,7 +37,7 b' class QtKernelManager(KernelManager, QtKernelManagerMixin):'
37 if self._restarter is None:
37 if self._restarter is None:
38 self._restarter = QtKernelRestarter(
38 self._restarter = QtKernelRestarter(
39 kernel_manager=self,
39 kernel_manager=self,
40 config=self.config,
40 parent=self,
41 log=self.log,
41 log=self.log,
42 )
42 )
43 self._restarter.add_callback(self._handle_kernel_restarted)
43 self._restarter.add_callback(self._handle_kernel_restarted)
@@ -112,7 +112,7 b' class ZMQTerminalIPythonApp(TerminalIPythonApp, IPythonConsoleApp):'
112 IPythonConsoleApp.initialize(self)
112 IPythonConsoleApp.initialize(self)
113 # relay sigint to kernel
113 # relay sigint to kernel
114 signal.signal(signal.SIGINT, self.handle_sigint)
114 signal.signal(signal.SIGINT, self.handle_sigint)
115 self.shell = ZMQTerminalInteractiveShell.instance(config=self.config,
115 self.shell = ZMQTerminalInteractiveShell.instance(parent=self,
116 display_banner=False, profile_dir=self.profile_dir,
116 display_banner=False, profile_dir=self.profile_dir,
117 ipython_dir=self.ipython_dir,
117 ipython_dir=self.ipython_dir,
118 manager=self.kernel_manager,
118 manager=self.kernel_manager,
@@ -337,7 +337,7 b' class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):'
337 # shell.display_banner should always be False for the terminal
337 # shell.display_banner should always be False for the terminal
338 # based app, because we call shell.show_banner() by hand below
338 # based app, because we call shell.show_banner() by hand below
339 # so the banner shows *before* all extension loading stuff.
339 # so the banner shows *before* all extension loading stuff.
340 self.shell = TerminalInteractiveShell.instance(config=self.config,
340 self.shell = TerminalInteractiveShell.instance(parent=self,
341 display_banner=False, profile_dir=self.profile_dir,
341 display_banner=False, profile_dir=self.profile_dir,
342 ipython_dir=self.ipython_dir)
342 ipython_dir=self.ipython_dir)
343 self.shell.configurables.append(self)
343 self.shell.configurables.append(self)
General Comments 0
You need to be logged in to leave comments. Login now