ipython/ipython — pull request #6448 by takluyver (2014-09-10 23:57:39+00:00)
Title: Add context manager for a kernel, and use it in nbconvert execute preprocessor

The kernel tests have a handy context manager to start a kernel, use its client, and shut it down when the context exits. I've promoted this to a public API in IPython.kernel.manager, leaving a thin wrapper in the tests to integrate with our subprocess output capturing.

Using this context manager makes ExecutePreprocessor significantly simpler.

I've also added support for ExecutePreprocessor to start the appropriate kernel from the kernelspec of the notebook it's processing, closing #6447.