IPython Cookbook - 1.6. Creating a simple kernel for Jupyter
IPython Cookbook,