6161def embed_kernel (module = None , local_ns = None , ** kwargs ):
6262 """Embed and start an IPython kernel in a given scope.
6363
64+ If you don't want the kernel to initialize the namespace
65+ from the scope of the surrounding function,
66+ and/or you want to load full IPython configuration,
67+ you probably want `IPython.start_kernel()` instead.
68+
69+
6470 Parameters
6571 ----------
6672 module : ModuleType, optional
@@ -112,3 +118,30 @@ def start_ipython(argv=None, **kwargs):
112118 """
113119 from IPython .terminal .ipapp import launch_new_instance
114120 return launch_new_instance (argv = argv , ** kwargs )
121+
122+ def start_kernel (argv = None , ** kwargs ):
123+ """Launch a normal IPython kernel instance (as opposed to embedded)
124+
125+ `IPython.embed_kernel()` puts a shell in a particular calling scope,
126+ such as a function or method for debugging purposes,
127+ which is often not desirable.
128+
129+ `start_kernel()` does full, regular IPython initialization,
130+ including loading startup files, configuration, etc.
131+ much of which is skipped by `embed()`.
132+
133+ Parameters
134+ ----------
135+
136+ argv : list or None, optional
137+ If unspecified or None, IPython will parse command-line options from sys.argv.
138+ To prevent any command-line parsing, pass an empty list: `argv=[]`.
139+ user_ns : dict, optional
140+ specify this dictionary to initialize the IPython user namespace with particular values.
141+ kwargs : various, optional
142+ Any other kwargs will be passed to the Application constructor,
143+ such as `config`.
144+ """
145+ from IPython .kernel .zmq .kernelapp import launch_new_instance
146+ return launch_new_instance (argv = argv , ** kwargs )
147+
0 commit comments