[IPython-dev] Kernel-independent magics?

Thomas Kluyver takowl at gmail.com
Tue Aug 12 13:32:41 EDT 2014


Our take on this is that IPython's magic functions are a feature of the
IPython kernel. This kernel runs code written in 'IPython syntax', which is
a loosely specified superset of Python code, including some features
designed for convenient interactive use (%magics, !shell commands, help?,
etc.). If other kernels want to implement extra syntax for their own
languages to aid interactive use, that's up to them, but we don't expect
them to, and we're not trying to standardise those features.

The same goes for IPython (kernel side) extensions: if other kernels need
an extension system, they should implement that using the tools and
conventions that make sense for that language. We do, however, intend to
build tools to manage pure client side notebook extensions in a
kernel-independent way.

Thomas


On 12 August 2014 10:09, Doug Blank <doug.blank at gmail.com> wrote:

> We are beginning to take our Pure-Python languages out from Calico and
> implement them as stand-alone kernels (based on KernelBase) for Jupyter
> (IPython 3). This includes Scheme, Basic, Logo, Little Computer (LC3,
> assembly language), etc.
>
> Wondering about how magics might be handled in Jupyter (In the Calico
> Kernel, we handle magics in C# before passing the rest of the code to the
> language). Currently, it looks like magics are handled in IPython by the
> Interactive Python Shell. There are many magics that are language
> independent and could be handled more abstractly (via JavaScript or server):
>
> * %%latex
> * %%html
> * %connect_info
> * %%file - create a file, with cell contents
> * %%time - give execution time (not timeit, which figures out how many
> times to run)
> * %logstart
> * many others
>
> In addition, there is the need to allow others to write magics for
> specific kernels, or for general kernels. That would imply some kind of
> %load_ext.
>
> Also, there is generic ! shell execution.
>
> Are there any plans on how to handle these functions in a
> kernel-independent manner? If not, it would be good for kernel authors to
> adopt some standards for magics.
>
> Thanks for any pointers or comments!
>
> -Doug
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140812/15bd43ed/attachment.html>


More information about the IPython-dev mailing list