##// END OF EJS Templates
Merge pull request #964 from takluyver/default-profile...
Min RK -
r5265:c3d885fa merge
parent child Browse files
Show More
@@ -104,11 +104,9 b' class BaseIPythonApplication(Application):'
104 104 def _config_file_paths_default(self):
105 105 return [os.getcwdu()]
106 106
107 profile = Unicode(u'', config=True,
107 profile = Unicode(u'default', config=True,
108 108 help="""The IPython profile to use."""
109 109 )
110 def _profile_default(self):
111 return "python3" if py3compat.PY3 else "default"
112 110
113 111 def _profile_changed(self, name, old, new):
114 112 self.builtin_profile_dir = os.path.join(
@@ -230,7 +228,7 b' class BaseIPythonApplication(Application):'
230 228 p = ProfileDir.find_profile_dir_by_name(self.ipython_dir, self.profile, self.config)
231 229 except ProfileDirError:
232 230 # not found, maybe create it (always create default profile)
233 if self.auto_create or self.profile==self._profile_default():
231 if self.auto_create or self.profile=='default':
234 232 try:
235 233 p = ProfileDir.create_profile_dir_by_name(self.ipython_dir, self.profile, self.config)
236 234 except ProfileDirError:
@@ -527,7 +527,11 b' Currently the magic system has the following functions:\\n"""'
527 527
528 528 def magic_profile(self, parameter_s=''):
529 529 """Print your currently active IPython profile."""
530 print self.shell.profile
530 from IPython.core.application import BaseIPythonApplication
531 if BaseIPythonApplication.initialized():
532 print BaseIPythonApplication.instance().profile
533 else:
534 error("profile is an application-level value, but you don't appear to be in an IPython application")
531 535
532 536 def magic_pinfo(self, parameter_s='', namespaces=None):
533 537 """Provide detailed information about an object.
@@ -80,7 +80,7 b' def test_startup_py():'
80 80 # write simple test file, to check that the startup file was run
81 81 fname = os.path.join(TMP_TEST_DIR, 'test.py')
82 82 with open(fname, 'w') as f:
83 f.write('print zzz\n')
83 f.write(py3compat.doctest_refactor_print('print zzz\n'))
84 84 # validate output
85 85 tt.ipexec_validate(fname, '123', '',
86 86 options=['--ipython-dir', IP_TEST_DIR, '--profile', 'test'])
@@ -100,4 +100,4 b' def test_startup_ipy():'
100 100 tt.ipexec_validate(fname, 'test', '',
101 101 options=['--ipython-dir', IP_TEST_DIR, '--profile', 'test'])
102 102
103 No newline at end of file
103
@@ -64,6 +64,7 b' class Kernel(Configurable):'
64 64
65 65 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
66 66 session = Instance(Session)
67 profile_dir = Instance('IPython.core.profiledir.ProfileDir')
67 68 shell_socket = Instance('zmq.Socket')
68 69 iopub_socket = Instance('zmq.Socket')
69 70 stdin_socket = Instance('zmq.Socket')
@@ -106,7 +107,9 b' class Kernel(Configurable):'
106 107 atexit.register(self._at_shutdown)
107 108
108 109 # Initialize the InteractiveShell subclass
109 self.shell = ZMQInteractiveShell.instance(config=self.config)
110 self.shell = ZMQInteractiveShell.instance(config=self.config,
111 profile_dir = self.profile_dir,
112 )
110 113 self.shell.displayhook.session = self.session
111 114 self.shell.displayhook.pub_socket = self.iopub_socket
112 115 self.shell.display_pub.session = self.session
@@ -739,16 +742,16 b' class IPKernelApp(KernelApp, InteractiveShellApp):'
739 742 self.init_code()
740 743
741 744 def init_kernel(self):
742 kernel_factory = Kernel
743 745
744 746 if self.pylab:
745 747 gui, backend = pylabtools.find_gui_and_backend(self.pylab)
746 748
747 kernel = kernel_factory(config=self.config, session=self.session,
749 kernel = Kernel(config=self.config, session=self.session,
748 750 shell_socket=self.shell_socket,
749 751 iopub_socket=self.iopub_socket,
750 752 stdin_socket=self.stdin_socket,
751 753 log=self.log,
754 profile_dir=self.profile_dir,
752 755 )
753 756 self.kernel = kernel
754 757 kernel.record_ports(self.ports)
General Comments 0
You need to be logged in to leave comments. Login now