Show More
@@ -123,7 +123,16 b' class Application(SingletonConfigurable):' | |||||
123 |
|
123 | |||
124 | # A sequence of Configurable subclasses whose config=True attributes will |
|
124 | # A sequence of Configurable subclasses whose config=True attributes will | |
125 | # be exposed at the command line. |
|
125 | # be exposed at the command line. | |
126 |
classes = |
|
126 | classes = [] | |
|
127 | @property | |||
|
128 | def _help_classes(self): | |||
|
129 | """Define `App.help_classes` if CLI classes should differ from config file classes""" | |||
|
130 | return getattr(self, 'help_classes', self.classes) | |||
|
131 | ||||
|
132 | @property | |||
|
133 | def _config_classes(self): | |||
|
134 | """Define `App.config_classes` if config file classes should differ from CLI classes.""" | |||
|
135 | return getattr(self, 'config_classes', self.classes) | |||
127 |
|
136 | |||
128 | # The version string of this application. |
|
137 | # The version string of this application. | |
129 | version = Unicode(u'0.0') |
|
138 | version = Unicode(u'0.0') | |
@@ -256,7 +265,7 b' class Application(SingletonConfigurable):' | |||||
256 |
|
265 | |||
257 | lines = [] |
|
266 | lines = [] | |
258 | classdict = {} |
|
267 | classdict = {} | |
259 | for cls in self.classes: |
|
268 | for cls in self._help_classes: | |
260 | # include all parents (up to, but excluding Configurable) in available names |
|
269 | # include all parents (up to, but excluding Configurable) in available names | |
261 | for c in cls.mro()[:-3]: |
|
270 | for c in cls.mro()[:-3]: | |
262 | classdict[c.__name__] = c |
|
271 | classdict[c.__name__] = c | |
@@ -331,7 +340,8 b' class Application(SingletonConfigurable):' | |||||
331 | self.print_options() |
|
340 | self.print_options() | |
332 |
|
341 | |||
333 | if classes: |
|
342 | if classes: | |
334 | if self.classes: |
|
343 | help_classes = self._help_classes | |
|
344 | if help_classes: | |||
335 | print("Class parameters") |
|
345 | print("Class parameters") | |
336 | print("----------------") |
|
346 | print("----------------") | |
337 | print() |
|
347 | print() | |
@@ -339,7 +349,7 b' class Application(SingletonConfigurable):' | |||||
339 | print(p) |
|
349 | print(p) | |
340 | print() |
|
350 | print() | |
341 |
|
351 | |||
342 |
for cls in |
|
352 | for cls in help_classes: | |
343 | cls.class_print_help() |
|
353 | cls.class_print_help() | |
344 | print() |
|
354 | print() | |
345 | else: |
|
355 | else: | |
@@ -412,7 +422,7 b' class Application(SingletonConfigurable):' | |||||
412 | # it will be a dict by parent classname of classes in our list |
|
422 | # it will be a dict by parent classname of classes in our list | |
413 | # that are descendents |
|
423 | # that are descendents | |
414 | mro_tree = defaultdict(list) |
|
424 | mro_tree = defaultdict(list) | |
415 | for cls in self.classes: |
|
425 | for cls in self._help_classes: | |
416 | clsname = cls.__name__ |
|
426 | clsname = cls.__name__ | |
417 | for parent in cls.mro()[1:-3]: |
|
427 | for parent in cls.mro()[1:-3]: | |
418 | # exclude cls itself and Configurable,HasTraits,object |
|
428 | # exclude cls itself and Configurable,HasTraits,object | |
@@ -530,7 +540,7 b' class Application(SingletonConfigurable):' | |||||
530 | lines.append('') |
|
540 | lines.append('') | |
531 | lines.append('c = get_config()') |
|
541 | lines.append('c = get_config()') | |
532 | lines.append('') |
|
542 | lines.append('') | |
533 | for cls in self.classes: |
|
543 | for cls in self._config_classes: | |
534 | lines.append(cls.class_config_section()) |
|
544 | lines.append(cls.class_config_section()) | |
535 | return '\n'.join(lines) |
|
545 | return '\n'.join(lines) | |
536 |
|
546 |
@@ -7,11 +7,6 b' refactoring of what used to be the IPython/qt/console/qtconsoleapp.py' | |||||
7 | # Copyright (c) IPython Development Team. |
|
7 | # Copyright (c) IPython Development Team. | |
8 | # Distributed under the terms of the Modified BSD License. |
|
8 | # Distributed under the terms of the Modified BSD License. | |
9 |
|
9 | |||
10 | #----------------------------------------------------------------------------- |
|
|||
11 | # Imports |
|
|||
12 | #----------------------------------------------------------------------------- |
|
|||
13 |
|
||||
14 | # stdlib imports |
|
|||
15 | import atexit |
|
10 | import atexit | |
16 | import os |
|
11 | import os | |
17 | import signal |
|
12 | import signal | |
@@ -19,7 +14,6 b' import sys' | |||||
19 | import uuid |
|
14 | import uuid | |
20 |
|
15 | |||
21 |
|
16 | |||
22 | # Local imports |
|
|||
23 | from IPython.config.application import boolean_flag |
|
17 | from IPython.config.application import boolean_flag | |
24 | from IPython.core.profiledir import ProfileDir |
|
18 | from IPython.core.profiledir import ProfileDir | |
25 | from IPython.kernel.blocking import BlockingKernelClient |
|
19 | from IPython.kernel.blocking import BlockingKernelClient | |
@@ -40,18 +34,9 b' from IPython.kernel.zmq.session import Session, default_secure' | |||||
40 | from IPython.kernel.zmq.zmqshell import ZMQInteractiveShell |
|
34 | from IPython.kernel.zmq.zmqshell import ZMQInteractiveShell | |
41 | from IPython.kernel.connect import ConnectionFileMixin |
|
35 | from IPython.kernel.connect import ConnectionFileMixin | |
42 |
|
36 | |||
43 | #----------------------------------------------------------------------------- |
|
|||
44 | # Network Constants |
|
|||
45 | #----------------------------------------------------------------------------- |
|
|||
46 |
|
||||
47 | from IPython.utils.localinterfaces import localhost |
|
37 | from IPython.utils.localinterfaces import localhost | |
48 |
|
38 | |||
49 | #----------------------------------------------------------------------------- |
|
39 | #----------------------------------------------------------------------------- | |
50 | # Globals |
|
|||
51 | #----------------------------------------------------------------------------- |
|
|||
52 |
|
||||
53 |
|
||||
54 | #----------------------------------------------------------------------------- |
|
|||
55 | # Aliases and Flags |
|
40 | # Aliases and Flags | |
56 | #----------------------------------------------------------------------------- |
|
41 | #----------------------------------------------------------------------------- | |
57 |
|
42 | |||
@@ -98,11 +83,7 b' aliases.update(app_aliases)' | |||||
98 | # Classes |
|
83 | # Classes | |
99 | #----------------------------------------------------------------------------- |
|
84 | #----------------------------------------------------------------------------- | |
100 |
|
85 | |||
101 | #----------------------------------------------------------------------------- |
|
86 | classes = [KernelManager, ProfileDir, Session] | |
102 | # IPythonConsole |
|
|||
103 | #----------------------------------------------------------------------------- |
|
|||
104 |
|
||||
105 | classes = [IPKernelApp, ZMQInteractiveShell, KernelManager, ProfileDir, Session, InlineBackend] |
|
|||
106 |
|
87 | |||
107 | class IPythonConsoleApp(ConnectionFileMixin): |
|
88 | class IPythonConsoleApp(ConnectionFileMixin): | |
108 | name = 'ipython-console-mixin' |
|
89 | name = 'ipython-console-mixin' | |
@@ -158,8 +139,15 b' class IPythonConsoleApp(ConnectionFileMixin):' | |||||
158 | Set to display confirmation dialog on exit. You can always use 'exit' or 'quit', |
|
139 | Set to display confirmation dialog on exit. You can always use 'exit' or 'quit', | |
159 | to force a direct exit without any confirmation.""", |
|
140 | to force a direct exit without any confirmation.""", | |
160 | ) |
|
141 | ) | |
161 |
|
142 | |||
162 |
|
143 | @property | ||
|
144 | def help_classes(self): | |||
|
145 | """ConsoleApps can configure kernels on the command-line | |||
|
146 | ||||
|
147 | But this shouldn't be written to a file | |||
|
148 | """ | |||
|
149 | return self.classes + [IPKernelApp] + IPKernelApp.classes | |||
|
150 | ||||
163 | def build_kernel_argv(self, argv=None): |
|
151 | def build_kernel_argv(self, argv=None): | |
164 | """build argv to be passed to kernel subprocess""" |
|
152 | """build argv to be passed to kernel subprocess""" | |
165 | if argv is None: |
|
153 | if argv is None: |
@@ -261,6 +261,7 b' class ProfileCreate(BaseIPythonApplication):' | |||||
261 | from IPython.terminal.ipapp import TerminalIPythonApp |
|
261 | from IPython.terminal.ipapp import TerminalIPythonApp | |
262 | apps = [TerminalIPythonApp] |
|
262 | apps = [TerminalIPythonApp] | |
263 | for app_path in ( |
|
263 | for app_path in ( | |
|
264 | 'IPython.kernel.zmq.kernelapp.IPKernelApp', | |||
264 | 'IPython.qt.console.qtconsoleapp.IPythonQtConsoleApp', |
|
265 | 'IPython.qt.console.qtconsoleapp.IPythonQtConsoleApp', | |
265 | 'IPython.html.notebookapp.NotebookApp', |
|
266 | 'IPython.html.notebookapp.NotebookApp', | |
266 | 'IPython.nbconvert.nbconvertapp.NbConvertApp', |
|
267 | 'IPython.nbconvert.nbconvertapp.NbConvertApp', |
@@ -97,7 +97,7 b' To read more about this, see https://github.com/ipython/ipython/issues/2049' | |||||
97 |
|
97 | |||
98 | class IPKernelApp(BaseIPythonApplication, InteractiveShellApp, |
|
98 | class IPKernelApp(BaseIPythonApplication, InteractiveShellApp, | |
99 | ConnectionFileMixin): |
|
99 | ConnectionFileMixin): | |
100 | name='ipkernel' |
|
100 | name='ipython-kernel' | |
101 | aliases = Dict(kernel_aliases) |
|
101 | aliases = Dict(kernel_aliases) | |
102 | flags = Dict(kernel_flags) |
|
102 | flags = Dict(kernel_flags) | |
103 | classes = [IPythonKernel, ZMQInteractiveShell, ProfileDir, Session] |
|
103 | classes = [IPythonKernel, ZMQInteractiveShell, ProfileDir, Session] | |
@@ -114,10 +114,6 b' class IPKernelApp(BaseIPythonApplication, InteractiveShellApp,' | |||||
114 | heartbeat = Instance(Heartbeat) |
|
114 | heartbeat = Instance(Heartbeat) | |
115 | ports = Dict() |
|
115 | ports = Dict() | |
116 |
|
116 | |||
117 | # ipkernel doesn't get its own config file |
|
|||
118 | def _config_file_name_default(self): |
|
|||
119 | return 'ipython_config.py' |
|
|||
120 |
|
||||
121 | # connection info: |
|
117 | # connection info: | |
122 |
|
118 | |||
123 | @property |
|
119 | @property |
@@ -70,11 +70,12 b" if __name__ == '__main__':" | |||||
70 |
|
70 | |||
71 | write_doc('terminal', 'Terminal IPython options', TerminalIPythonApp().classes) |
|
71 | write_doc('terminal', 'Terminal IPython options', TerminalIPythonApp().classes) | |
72 | write_doc('kernel', 'IPython kernel options', kernel_classes, |
|
72 | write_doc('kernel', 'IPython kernel options', kernel_classes, | |
73 |
|
|
73 | preamble="These options can be used in :file:`ipython_kernel_config.py`", | |
74 | "or in :file:`ipython_qtconsole_config.py`") |
|
74 | ) | |
75 | nbclasses = set(NotebookApp().classes) - set(kernel_classes) |
|
75 | nbclasses = set(NotebookApp().classes) - set(kernel_classes) | |
76 | write_doc('notebook', 'IPython notebook options', nbclasses, |
|
76 | write_doc('notebook', 'IPython notebook options', nbclasses, | |
77 | preamble="Any of the :doc:`kernel` can also be used.") |
|
77 | preamble="To configure the IPython kernel, see :doc:`kernel`." | |
|
78 | ) | |||
78 |
|
79 | |||
79 | try: |
|
80 | try: | |
80 | from IPython.qt.console.qtconsoleapp import IPythonQtConsoleApp |
|
81 | from IPython.qt.console.qtconsoleapp import IPythonQtConsoleApp | |
@@ -84,5 +85,6 b" if __name__ == '__main__':" | |||||
84 | else: |
|
85 | else: | |
85 | qtclasses = set(IPythonQtConsoleApp().classes) - set(kernel_classes) |
|
86 | qtclasses = set(IPythonQtConsoleApp().classes) - set(kernel_classes) | |
86 | write_doc('qtconsole', 'IPython Qt console options', qtclasses, |
|
87 | write_doc('qtconsole', 'IPython Qt console options', qtclasses, | |
87 | preamble="Any of the :doc:`kernel` can also be used.") |
|
88 | preamble="To configure the IPython kernel, see :doc:`kernel`." | |
|
89 | ) | |||
88 |
|
90 |
@@ -95,9 +95,6 b' commented; the minimum set you need to uncomment and edit is the following::' | |||||
95 |
|
95 | |||
96 | c = get_config() |
|
96 | c = get_config() | |
97 |
|
97 | |||
98 | # Kernel config |
|
|||
99 | c.IPKernelApp.pylab = 'inline' # if you want plotting support always |
|
|||
100 |
|
||||
101 | # Notebook config |
|
98 | # Notebook config | |
102 | c.NotebookApp.certfile = u'/absolute/path/to/your/certificate/mycert.pem' |
|
99 | c.NotebookApp.certfile = u'/absolute/path/to/your/certificate/mycert.pem' | |
103 | c.NotebookApp.ip = '*' |
|
100 | c.NotebookApp.ip = '*' |
General Comments 0
You need to be logged in to leave comments.
Login now