Skip to content

Loading…

i658 #660

Merged
merged 1 commit into from

2 participants

@minrk
IPython member

move InteractiveShellApp before TerminalIPythonApp in TerminalApp class list

This is useful because InteractiveShellApp is a parent that affects
all IPython apps, so it makes sense to come first.

The change affects auto generated ipython_config.py and the output
of ipython --help-all.

Also prevents duplicate entries for self.__class__

closes gh-658

@minrk minrk move InteractiveShellApp before TerminalIPythonApp in TerminalApp cla…
…ss list

This is useful because InteractiveShellApp is a parent that affects
all IPython apps, so it makes sense to come first.

The change affects auto generated ipython_config.py and the output
of `ipython --help-all`.

Also prevents duplicate entries for `self.__class__`

closes gh-658
da4180d
@fperez
IPython member

+1, merge away. Thanks for taking care of it quickly!

@minrk minrk merged commit d932a91 into ipython:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 1, 2011
  1. @minrk

    move InteractiveShellApp before TerminalIPythonApp in TerminalApp cla…

    minrk committed
    …ss list
    
    This is useful because InteractiveShellApp is a parent that affects
    all IPython apps, so it makes sense to come first.
    
    The change affects auto generated ipython_config.py and the output
    of `ipython --help-all`.
    
    Also prevents duplicate entries for `self.__class__`
    
    closes gh-658
Showing with 16 additions and 6 deletions.
  1. +4 −3 IPython/config/application.py
  2. +12 −3 IPython/frontend/terminal/ipapp.py
View
7 IPython/config/application.py
@@ -143,9 +143,10 @@ def _flags_changed(self, name, old, new):
def __init__(self, **kwargs):
SingletonConfigurable.__init__(self, **kwargs)
- # Add my class to self.classes so my attributes appear in command line
- # options.
- self.classes.insert(0, self.__class__)
+ # Ensure my class is in self.classes, so my attributes appear in command line
+ # options and config files.
+ if self.__class__ not in self.classes:
+ self.classes.insert(0, self.__class__)
self.init_logging()
View
15 IPython/frontend/terminal/ipapp.py
@@ -48,7 +48,7 @@
from IPython.utils import warn
from IPython.utils.path import get_ipython_dir, check_for_old_config
from IPython.utils.traitlets import (
- Bool, Dict, CaselessStrEnum
+ Bool, List, Dict, CaselessStrEnum
)
#-----------------------------------------------------------------------------
@@ -189,8 +189,17 @@ class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):
flags = Dict(flags)
aliases = Dict(aliases)
- classes = [InteractiveShellApp, TerminalInteractiveShell, ProfileDir,
- PlainTextFormatter]
+ classes = List()
+ def _classes_default(self):
+ """This has to be in a method, for TerminalIPythonApp to be available."""
+ return [
+ InteractiveShellApp, # ShellApp comes before TerminalApp, because
+ self.__class__, # it will also affect subclasses (e.g. QtConsole)
+ TerminalInteractiveShell,
+ ProfileDir,
+ PlainTextFormatter,
+ ]
+
subcommands = Dict(dict(
qtconsole=('IPython.frontend.qt.console.qtconsoleapp.IPythonQtConsoleApp',
"""Launch the IPython Qt Console."""
Something went wrong with that request. Please try again.