1
""" An example of one way to embed IPython in your own application
3
This basically means starting up IPython with some of your programs objects visible in the IPython
15
ses = IPython.ipapi.make_session(my_ns)
17
# Now get the ipapi instance, to be stored somewhere in your program for manipulation of the running
18
# IPython session. See http://ipython.scipy.org/moin/IpythonExtensionApi
22
# let's play with the ipapi a bit, creating a magic function for a soon-to-be-started IPython
23
def mymagic_f(self,s):
24
print "mymagic says",s
26
ip.expose_magic("mymagic",mymagic_f)
28
# And finally, start the IPython interaction! This will block until you say Exit.
32
print "IPython session finished! namespace content:",my_ns