1 """Entry point for launching an IPython kernel. 2 3 This is separate from the ipykernel package so we can avoid doing imports until 4 after removing the cwd from sys.path. 5 """ 6 7 import sys 8 from pathlib import Path 9 10 if __name__ == "__main__": 11 # Remove the CWD from sys.path while we load stuff. 12 # This is added back by InteractiveShellApp.init_path() 13 if sys.path[0] == "" or Path(sys.path[0]) == Path.cwd(): 14 del sys.path[0] 15 16 from ipykernel import kernelapp as app 17 18 app.launch_new_instance() 19