Show More
@@ -18,20 +18,13 b' from IPython.config.application import boolean_flag' | |||||
18 | from IPython.core.profiledir import ProfileDir |
|
18 | from IPython.core.profiledir import ProfileDir | |
19 | from IPython.kernel.blocking import BlockingKernelClient |
|
19 | from IPython.kernel.blocking import BlockingKernelClient | |
20 | from IPython.kernel import KernelManager |
|
20 | from IPython.kernel import KernelManager | |
21 |
from IPython.kernel import tunnel_to_kernel, find_connection_file |
|
21 | from IPython.kernel import tunnel_to_kernel, find_connection_file | |
22 | from IPython.kernel.kernelspec import NoSuchKernel |
|
22 | from IPython.kernel.kernelspec import NoSuchKernel | |
23 | from IPython.utils.path import filefind |
|
23 | from IPython.utils.path import filefind | |
24 | from IPython.utils.traitlets import ( |
|
24 | from IPython.utils.traitlets import ( | |
25 | Dict, List, Unicode, CUnicode, CBool, Any |
|
25 | Dict, List, Unicode, CUnicode, CBool, Any | |
26 | ) |
|
26 | ) | |
27 | from IPython.kernel.zmq.kernelapp import ( |
|
|||
28 | kernel_flags, |
|
|||
29 | kernel_aliases, |
|
|||
30 | IPKernelApp |
|
|||
31 | ) |
|
|||
32 | from IPython.kernel.zmq.pylab.config import InlineBackend |
|
|||
33 | from IPython.kernel.zmq.session import Session |
|
27 | from IPython.kernel.zmq.session import Session | |
34 | from IPython.kernel.zmq.zmqshell import ZMQInteractiveShell |
|
|||
35 | from IPython.kernel.connect import ConnectionFileMixin |
|
28 | from IPython.kernel.connect import ConnectionFileMixin | |
36 |
|
29 | |||
37 | from IPython.utils.localinterfaces import localhost |
|
30 | from IPython.utils.localinterfaces import localhost | |
@@ -40,7 +33,7 b' from IPython.utils.localinterfaces import localhost' | |||||
40 | # Aliases and Flags |
|
33 | # Aliases and Flags | |
41 | #----------------------------------------------------------------------------- |
|
34 | #----------------------------------------------------------------------------- | |
42 |
|
35 | |||
43 | flags = dict(kernel_flags) |
|
36 | flags = {} | |
44 |
|
37 | |||
45 | # the flags that are specific to the frontend |
|
38 | # the flags that are specific to the frontend | |
46 | # these must be scrubbed before being passed to the kernel, |
|
39 | # these must be scrubbed before being passed to the kernel, | |
@@ -60,7 +53,7 b' app_flags.update(boolean_flag(' | |||||
60 | )) |
|
53 | )) | |
61 | flags.update(app_flags) |
|
54 | flags.update(app_flags) | |
62 |
|
55 | |||
63 | aliases = dict(kernel_aliases) |
|
56 | aliases = {} | |
64 |
|
57 | |||
65 | # also scrub aliases from the frontend |
|
58 | # also scrub aliases from the frontend | |
66 | app_aliases = dict( |
|
59 | app_aliases = dict( | |
@@ -140,19 +133,12 b' class IPythonConsoleApp(ConnectionFileMixin):' | |||||
140 | to force a direct exit without any confirmation.""", |
|
133 | to force a direct exit without any confirmation.""", | |
141 | ) |
|
134 | ) | |
142 |
|
135 | |||
143 | @property |
|
136 | def build_kernel_argv(self, argv=None): | |
144 | def help_classes(self): |
|
137 | """build argv to be passed to kernel subprocess | |
145 | """ConsoleApps can configure kernels on the command-line |
|
|||
146 |
|
138 | |||
147 | But this shouldn't be written to a file |
|
139 | Override in subclasses if any args should be passed to the kernel | |
148 | """ |
|
140 | """ | |
149 | return self.classes + [IPKernelApp] + IPKernelApp.classes |
|
141 | self.kernel_argv = self.extra_args | |
150 |
|
||||
151 | def build_kernel_argv(self, argv=None): |
|
|||
152 | """build argv to be passed to kernel subprocess""" |
|
|||
153 | if argv is None: |
|
|||
154 | argv = sys.argv[1:] |
|
|||
155 | self.kernel_argv = swallow_argv(argv, self.frontend_aliases, self.frontend_flags) |
|
|||
156 |
|
142 | |||
157 | def init_connection_file(self): |
|
143 | def init_connection_file(self): | |
158 | """find the connection file, and load the info if found. |
|
144 | """find the connection file, and load the info if found. |
@@ -354,8 +354,6 b' class NotebookApp(BaseIPythonApplication):' | |||||
354 | list=(NbserverListApp, NbserverListApp.description.splitlines()[0]), |
|
354 | list=(NbserverListApp, NbserverListApp.description.splitlines()[0]), | |
355 | ) |
|
355 | ) | |
356 |
|
356 | |||
357 | ipython_kernel_argv = List(Unicode) |
|
|||
358 |
|
||||
359 | _log_formatter_cls = LogFormatter |
|
357 | _log_formatter_cls = LogFormatter | |
360 |
|
358 | |||
361 | def _log_level_default(self): |
|
359 | def _log_level_default(self): | |
@@ -777,12 +775,6 b' class NotebookApp(BaseIPythonApplication):' | |||||
777 | c.NotebookApp.file_to_run = f |
|
775 | c.NotebookApp.file_to_run = f | |
778 | self.update_config(c) |
|
776 | self.update_config(c) | |
779 |
|
777 | |||
780 | def init_kernel_argv(self): |
|
|||
781 | """add the profile-dir to arguments to be passed to IPython kernels""" |
|
|||
782 | # FIXME: remove special treatment of IPython kernels |
|
|||
783 | # Kernel should get *absolute* path to profile directory |
|
|||
784 | self.ipython_kernel_argv = ["--profile-dir", self.profile_dir.location] |
|
|||
785 |
|
||||
786 | def init_configurables(self): |
|
778 | def init_configurables(self): | |
787 | self.kernel_spec_manager = self.kernel_spec_manager_class( |
|
779 | self.kernel_spec_manager = self.kernel_spec_manager_class( | |
788 | parent=self, |
|
780 | parent=self, | |
@@ -791,7 +783,6 b' class NotebookApp(BaseIPythonApplication):' | |||||
791 | self.kernel_manager = self.kernel_manager_class( |
|
783 | self.kernel_manager = self.kernel_manager_class( | |
792 | parent=self, |
|
784 | parent=self, | |
793 | log=self.log, |
|
785 | log=self.log, | |
794 | ipython_kernel_argv=self.ipython_kernel_argv, |
|
|||
795 | connection_dir=self.profile_dir.security_dir, |
|
786 | connection_dir=self.profile_dir.security_dir, | |
796 | ) |
|
787 | ) | |
797 | self.contents_manager = self.contents_manager_class( |
|
788 | self.contents_manager = self.contents_manager_class( | |
@@ -999,7 +990,6 b' class NotebookApp(BaseIPythonApplication):' | |||||
999 | def initialize(self, argv=None): |
|
990 | def initialize(self, argv=None): | |
1000 | super(NotebookApp, self).initialize(argv) |
|
991 | super(NotebookApp, self).initialize(argv) | |
1001 | self.init_logging() |
|
992 | self.init_logging() | |
1002 | self.init_kernel_argv() |
|
|||
1003 | self.init_configurables() |
|
993 | self.init_configurables() | |
1004 | self.init_components() |
|
994 | self.init_components() | |
1005 | self.init_webapp() |
|
995 | self.init_webapp() |
@@ -3,25 +3,10 b'' | |||||
3 | """ |
|
3 | """ | |
4 | The :class:`~IPython.core.application.Application` object for the command |
|
4 | The :class:`~IPython.core.application.Application` object for the command | |
5 | line :command:`ipython` program. |
|
5 | line :command:`ipython` program. | |
6 |
|
||||
7 | Authors |
|
|||
8 | ------- |
|
|||
9 |
|
||||
10 | * Brian Granger |
|
|||
11 | * Fernando Perez |
|
|||
12 | * Min Ragan-Kelley |
|
|||
13 | """ |
|
6 | """ | |
14 |
|
7 | |||
15 | #----------------------------------------------------------------------------- |
|
8 | # Copyright (c) IPython Development Team. | |
16 | # Copyright (C) 2008-2011 The IPython Development Team |
|
9 | # Distributed under the terms of the Modified BSD License. | |
17 | # |
|
|||
18 | # Distributed under the terms of the BSD License. The full license is in |
|
|||
19 | # the file COPYING, distributed as part of this software. |
|
|||
20 | #----------------------------------------------------------------------------- |
|
|||
21 |
|
||||
22 | #----------------------------------------------------------------------------- |
|
|||
23 | # Imports |
|
|||
24 | #----------------------------------------------------------------------------- |
|
|||
25 |
|
10 | |||
26 | from __future__ import absolute_import |
|
11 | from __future__ import absolute_import | |
27 | from __future__ import print_function |
|
12 | from __future__ import print_function |
@@ -2,17 +2,11 b'' | |||||
2 |
|
2 | |||
3 | This is not a complete console app, as subprocess will not be able to receive |
|
3 | This is not a complete console app, as subprocess will not be able to receive | |
4 | input, there is no real readline support, among other limitations. |
|
4 | input, there is no real readline support, among other limitations. | |
5 |
|
||||
6 | Authors: |
|
|||
7 |
|
||||
8 | * Min RK |
|
|||
9 | * Paul Ivanov |
|
|||
10 |
|
||||
11 | """ |
|
5 | """ | |
12 |
|
6 | |||
13 | #----------------------------------------------------------------------------- |
|
7 | # Copyright (c) IPython Development Team. | |
14 | # Imports |
|
8 | # Distributed under the terms of the Modified BSD License. | |
15 | #----------------------------------------------------------------------------- |
|
9 | ||
16 | import signal |
|
10 | import signal | |
17 |
|
11 | |||
18 | from IPython.terminal.ipapp import TerminalIPythonApp, frontend_flags as term_flags |
|
12 | from IPython.terminal.ipapp import TerminalIPythonApp, frontend_flags as term_flags | |
@@ -58,6 +52,7 b' aliases = dict(aliases)' | |||||
58 | frontend_aliases = dict(app_aliases) |
|
52 | frontend_aliases = dict(app_aliases) | |
59 | # load updated frontend flags into full dict |
|
53 | # load updated frontend flags into full dict | |
60 | aliases.update(frontend_aliases) |
|
54 | aliases.update(frontend_aliases) | |
|
55 | aliases['colors'] = 'InteractiveShell.colors' | |||
61 |
|
56 | |||
62 | # get flags&aliases into sets, and remove a couple that |
|
57 | # get flags&aliases into sets, and remove a couple that | |
63 | # shouldn't be scrubbed from backend flags: |
|
58 | # shouldn't be scrubbed from backend flags: | |
@@ -99,9 +94,11 b' class ZMQTerminalIPythonApp(TerminalIPythonApp, IPythonConsoleApp):' | |||||
99 |
|
94 | |||
100 | subcommands = Dict() |
|
95 | subcommands = Dict() | |
101 |
|
96 | |||
|
97 | force_interact = True | |||
|
98 | ||||
102 | def parse_command_line(self, argv=None): |
|
99 | def parse_command_line(self, argv=None): | |
103 | super(ZMQTerminalIPythonApp, self).parse_command_line(argv) |
|
100 | super(ZMQTerminalIPythonApp, self).parse_command_line(argv) | |
104 |
self.build_kernel_argv( |
|
101 | self.build_kernel_argv(self.extra_args) | |
105 |
|
102 | |||
106 | def init_shell(self): |
|
103 | def init_shell(self): | |
107 | IPythonConsoleApp.initialize(self) |
|
104 | IPythonConsoleApp.initialize(self) |
@@ -7,11 +7,6 b' input, there is no real readline support, among other limitations.' | |||||
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 os |
|
10 | import os | |
16 | import signal |
|
11 | import signal | |
17 | import sys |
|
12 | import sys | |
@@ -46,10 +41,8 b" if os.name == 'nt':" | |||||
46 |
|
41 | |||
47 | sys.excepthook = gui_excepthook |
|
42 | sys.excepthook = gui_excepthook | |
48 |
|
43 | |||
49 | # System library imports |
|
|||
50 | from IPython.external.qt import QtCore, QtGui |
|
44 | from IPython.external.qt import QtCore, QtGui | |
51 |
|
45 | |||
52 | # Local imports |
|
|||
53 | from IPython.config.application import boolean_flag |
|
46 | from IPython.config.application import boolean_flag | |
54 | from IPython.config.application import catch_config_error |
|
47 | from IPython.config.application import catch_config_error | |
55 | from IPython.core.application import BaseIPythonApplication |
|
48 | from IPython.core.application import BaseIPythonApplication | |
@@ -191,7 +184,7 b' class IPythonQtConsoleApp(BaseIPythonApplication, IPythonConsoleApp):' | |||||
191 |
|
184 | |||
192 | def parse_command_line(self, argv=None): |
|
185 | def parse_command_line(self, argv=None): | |
193 | super(IPythonQtConsoleApp, self).parse_command_line(argv) |
|
186 | super(IPythonQtConsoleApp, self).parse_command_line(argv) | |
194 |
self.build_kernel_argv( |
|
187 | self.build_kernel_argv(self.extra_args) | |
195 |
|
188 | |||
196 |
|
189 | |||
197 | def new_frontend_master(self): |
|
190 | def new_frontend_master(self): |
General Comments 0
You need to be logged in to leave comments.
Login now