====== IPython ======
===== Autoreload =====
%load_ext autoreload
%autoreload 2
===== ipython notebook 기본 설정 =====
변경을 원하는 profile의 ipython_notebook_config.py 수정(없으면 생성)
기본 프로파일(~/.ipython/profile_default/ipython_notebook_config.py)
c = get_config()
# 외부에서 노트북 접속가능
c.NotebookApp.ip = '*'
# 기본 figure size 설정
c.InlineBackend.rc = {'font.size': 10, 'figure.figsize': (10.0, 4.0), 'figure.facecolor': 'white', 'savefig.dpi': 72, 'figure.subplot.bottom': 0.125, 'figure.edgecolor': 'white'}
===== IPython Interpreter Embed 하기 =====
from IPython import embed
embed()
예외가 발생하거나 사용자가 프로그램 실행 도중에 개입하고 싶을때 사용예
from IPython import embed
import traceback
...
while True:
try:
do_something()
except KeyboardInterrupt:
embed()
except Exception as e:
traceback.print_exc()
embed()
...
===== asyncio와 같이 사용 =====
%autoawait True