Skip to content

Commit

Permalink
add IPython.start_kernel
Browse files Browse the repository at this point in the history
for symmetry
  • Loading branch information
minrk committed Jul 4, 2013
1 parent bc17e08 commit a10986a
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions IPython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
def embed_kernel(module=None, local_ns=None, **kwargs):
"""Embed and start an IPython kernel in a given scope.
If you don't want the kernel to initialize the namespace
from the scope of the surrounding function,
and/or you want to load full IPython configuration,
you probably want `IPython.start_kernel()` instead.
Parameters
----------
module : ModuleType, optional
Expand Down Expand Up @@ -112,3 +118,30 @@ def start_ipython(argv=None, **kwargs):
"""
from IPython.terminal.ipapp import launch_new_instance
return launch_new_instance(argv=argv, **kwargs)

def start_kernel(argv=None, **kwargs):
"""Launch a normal IPython kernel instance (as opposed to embedded)
`IPython.embed_kernel()` puts a shell in a particular calling scope,
such as a function or method for debugging purposes,
which is often not desirable.
`start_kernel()` does full, regular IPython initialization,
including loading startup files, configuration, etc.
much of which is skipped by `embed()`.
Parameters
----------
argv : list or None, optional
If unspecified or None, IPython will parse command-line options from sys.argv.
To prevent any command-line parsing, pass an empty list: `argv=[]`.
user_ns : dict, optional
specify this dictionary to initialize the IPython user namespace with particular values.
kwargs : various, optional
Any other kwargs will be passed to the Application constructor,
such as `config`.
"""
from IPython.kernel.zmq.kernelapp import launch_new_instance
return launch_new_instance(argv=argv, **kwargs)

0 comments on commit a10986a

Please sign in to comment.