Show More
@@ -19,8 +19,10 b' from IPython.core.application import SYSTEM_CONFIG_DIRS, ENV_CONFIG_DIRS' | |||
|
19 | 19 | from IPython.core import pylabtools |
|
20 | 20 | from IPython.utils.contexts import preserve_keys |
|
21 | 21 | from IPython.utils.path import filefind |
|
22 | import traitlets | |
|
22 | 23 | from traitlets import ( |
|
23 | 24 | Unicode, Instance, List, Bool, CaselessStrEnum, observe, |
|
25 | DottedObjectName, | |
|
24 | 26 | ) |
|
25 | 27 | from IPython.terminal import pt_inputhooks |
|
26 | 28 | |
@@ -89,13 +91,18 b' shell_aliases = dict(' | |||
|
89 | 91 | logappend='InteractiveShell.logappend', |
|
90 | 92 | c='InteractiveShellApp.code_to_run', |
|
91 | 93 | m='InteractiveShellApp.module_to_run', |
|
92 |
ext= |
|
|
94 | ext="InteractiveShellApp.extra_extensions", | |
|
93 | 95 | gui='InteractiveShellApp.gui', |
|
94 | 96 | pylab='InteractiveShellApp.pylab', |
|
95 | 97 | matplotlib='InteractiveShellApp.matplotlib', |
|
96 | 98 | ) |
|
97 | 99 | shell_aliases['cache-size'] = 'InteractiveShell.cache_size' |
|
98 | 100 | |
|
101 | if traitlets.version_info < (5, 0): | |
|
102 | # traitlets 4 doesn't handle lists on CLI | |
|
103 | shell_aliases["ext"] = "InteractiveShellApp.extra_extension" | |
|
104 | ||
|
105 | ||
|
99 | 106 | #----------------------------------------------------------------------------- |
|
100 | 107 | # Main classes and functions |
|
101 | 108 | #----------------------------------------------------------------------------- |
@@ -118,8 +125,27 b' class InteractiveShellApp(Configurable):' | |||
|
118 | 125 | extensions = List(Unicode(), |
|
119 | 126 | help="A list of dotted module names of IPython extensions to load." |
|
120 | 127 | ).tag(config=True) |
|
121 | extra_extension = Unicode('', | |
|
122 | help="dotted module name of an IPython extension to load." | |
|
128 | ||
|
129 | extra_extension = Unicode( | |
|
130 | "", | |
|
131 | help=""" | |
|
132 | DEPRECATED. Dotted module name of a single extra IPython extension to load. | |
|
133 | ||
|
134 | Only one extension can be added this way. | |
|
135 | ||
|
136 | Only used with traitlets < 5.0, plural extra_extensions list is used in traitlets 5. | |
|
137 | """, | |
|
138 | ).tag(config=True) | |
|
139 | ||
|
140 | extra_extensions = List( | |
|
141 | DottedObjectName(), | |
|
142 | help=""" | |
|
143 | Dotted module name(s) of one or more IPython extensions to load. | |
|
144 | ||
|
145 | For specifying extra extensions to load on the command-line. | |
|
146 | ||
|
147 | .. versionadded:: 7.10 | |
|
148 | """, | |
|
123 | 149 | ).tag(config=True) |
|
124 | 150 | |
|
125 | 151 | reraise_ipython_extension_failures = Bool(False, |
@@ -264,7 +290,9 b' class InteractiveShellApp(Configurable):' | |||
|
264 | 290 | """ |
|
265 | 291 | try: |
|
266 | 292 | self.log.debug("Loading IPython extensions...") |
|
267 | extensions = self.default_extensions + self.extensions | |
|
293 | extensions = ( | |
|
294 | self.default_extensions + self.extensions + self.extra_extensions | |
|
295 | ) | |
|
268 | 296 | if self.extra_extension: |
|
269 | 297 | extensions.append(self.extra_extension) |
|
270 | 298 | for ext in extensions: |
General Comments 0
You need to be logged in to leave comments.
Login now