##// END OF EJS Templates
Backport PR #10373 on branch 5.x...
Matthias Bussonnier -
Show More
@@ -35,7 +35,7 b' from IPython.extensions.storemagic import StoreMagics'
35 from .interactiveshell import TerminalInteractiveShell
35 from .interactiveshell import TerminalInteractiveShell
36 from IPython.paths import get_ipython_dir
36 from IPython.paths import get_ipython_dir
37 from traitlets import (
37 from traitlets import (
38 Bool, List, Dict, default, observe,
38 Bool, List, Dict, default, observe, Type
39 )
39 )
40
40
41 #-----------------------------------------------------------------------------
41 #-----------------------------------------------------------------------------
@@ -185,6 +185,13 b' class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):'
185 flags = Dict(flags)
185 flags = Dict(flags)
186 aliases = Dict(aliases)
186 aliases = Dict(aliases)
187 classes = List()
187 classes = List()
188
189 interactive_shell_class = Type(
190 klass=object, # use default_value otherwise which only allow subclasses.
191 default_value=TerminalInteractiveShell,
192 help="Class to use to instantiate the TerminalInteractiveShell object. Useful for custom Frontends"
193 ).tag(config=True)
194
188 @default('classes')
195 @default('classes')
189 def _classes_default(self):
196 def _classes_default(self):
190 """This has to be in a method, for TerminalIPythonApp to be available."""
197 """This has to be in a method, for TerminalIPythonApp to be available."""
@@ -320,7 +327,7 b' class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):'
320 # shell.display_banner should always be False for the terminal
327 # shell.display_banner should always be False for the terminal
321 # based app, because we call shell.show_banner() by hand below
328 # based app, because we call shell.show_banner() by hand below
322 # so the banner shows *before* all extension loading stuff.
329 # so the banner shows *before* all extension loading stuff.
323 self.shell = TerminalInteractiveShell.instance(parent=self,
330 self.shell = self.interactive_shell_class.instance(parent=self,
324 profile_dir=self.profile_dir,
331 profile_dir=self.profile_dir,
325 ipython_dir=self.ipython_dir, user_ns=self.user_ns)
332 ipython_dir=self.ipython_dir, user_ns=self.user_ns)
326 self.shell.configurables.append(self)
333 self.shell.configurables.append(self)
@@ -10,7 +10,6 b' This document describes in-flight development work.'
10 conflicts for other Pull Requests). Instead, create a new file in the
10 conflicts for other Pull Requests). Instead, create a new file in the
11 `docs/source/whatsnew/pr` folder
11 `docs/source/whatsnew/pr` folder
12
12
13
14 .. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT.
13 .. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT.
15
14
16
15
@@ -2,6 +2,20 b''
2 5.x Series
2 5.x Series
3 ============
3 ============
4
4
5 IPython 5.4
6 ===========
7
8 Configurable TerminalInteractiveShell
9 -------------------------------------
10
11 Backported from the 6.x branch as an exceptional new feature. See
12 :ghpull:`10373` and :ghissue:`10364`
13
14 IPython gained a new ``c.TerminalIPythonApp.interactive_shell_class`` option
15 that allow to customize the class used to start the terminal frontend. This
16 should allow user to use custom interfaces, like reviving the former readline
17 interface which is now a separate package not maintained by the core team.
18
5 IPython 5.3
19 IPython 5.3
6 ===========
20 ===========
7
21
General Comments 0
You need to be logged in to leave comments. Login now