##// END OF EJS Templates
Cleaned up embedded shell and added cleanup method to InteractiveShell....
Cleaned up embedded shell and added cleanup method to InteractiveShell. * Added explicit code in InteractiveShell to make sure it cleans itself up. This is now done by the single method .cleanup, that can be called to have InteractiveShell cleanup. We can't use __del__ because of the many cycles in our object graph. * The embedded shell is refactored to no embedding logic is in the base class. Thus, InteractiveShell no longer takes an ``embedded`` argument. Just use InteractiveShellEmbed. * Created a super simple top-level :func:`embed` function that creates an InteractiveShellEmbed and calls it.

File last commit:

r2226:7053ea2c
r2226:7053ea2c
Show More
ipapi.py
58 lines | 1.7 KiB | text/x-python | PythonLexer
#!/usr/bin/env python
# encoding: utf-8
"""
Oh my @#*%, where did ipapi go?
Originally, this module was designed to be a public api for IPython. It is
now deprecated and replaced by :class:`IPython.core.Interactive` shell.
Almost all of the methods that were here are now there, but possibly renamed.
During our transition, we will keep this simple module with its :func:`get`
function. It too will eventually go away when the new component querying
interface is fully used.
Authors:
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2009 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from IPython.core.error import TryNext, UsageError
#-----------------------------------------------------------------------------
# Classes and functions
#-----------------------------------------------------------------------------
def get():
"""Get the most recently created InteractiveShell instance."""
from IPython.core.iplib import InteractiveShell
insts = InteractiveShell.get_instances()
most_recent = insts[0]
for inst in insts[1:]:
if inst.created > most_recent.created:
most_recent = inst
return most_recent
def launch_new_instance():
"""Create a run a full blown IPython instance"""
from IPython.core.ipapp import IPythonApp
app = IPythonApp()
app.start()