[IPython-dev] Kernel-independent magics?
Doug Blank
doug.blank at gmail.com
Tue Aug 12 14:04:35 EDT 2014
On Tue, Aug 12, 2014 at 1:32 PM, Thomas Kluyver <takowl at gmail.com> wrote:
> 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.
>
Ok, thanks for the quick response. That makes sense as many IPython magics
are intricately interwoven with Python.
I think that there is a role for a simplified, non-interwoven, standard set
of magics. Ok, we'll port our C# magic handler to Python, and share that
for use with those extending the KernelBase. Then a Python-based kernel can
easily get some nice/simple meta commands.
> 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.
>
Sounds good! That should help on the front end.
-Doug
>
> 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
>>
>>
>
> _______________________________________________
> 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/e84bc3fb/attachment.html>
More information about the IPython-dev
mailing list