1 # encoding: utf-8 2 """Simple function to call to get the current InteractiveShell instance 3 """ 4 5 #----------------------------------------------------------------------------- 6 # Copyright (C) 2013 The IPython Development Team 7 # 8 # Distributed under the terms of the BSD License. The full license is in 9 # the file COPYING, distributed as part of this software. 10 #----------------------------------------------------------------------------- 11 12 #----------------------------------------------------------------------------- 13 # Classes and functions 14 #----------------------------------------------------------------------------- 15 16 17 def get_ipython(): 18 """Get the global InteractiveShell instance. 19 20 Returns None if no InteractiveShell instance is registered. 21 """ 22 from IPython.core.interactiveshell import InteractiveShell 23 if InteractiveShell.initialized(): 24 return InteractiveShell.instance() 25