[IPython-dev] Static code analysis of IPython Notebook cell

Thomas Wiecki thomas.wiecki at gmail.com
Mon Jul 7 12:41:31 EDT 2014


Thanks, I think the wrapper kernel will give me more freedom.

Once I have the kernel.json, how can I launch an IPython NB with this new
kernel? Couldn't find a way to link to the json file.


On Mon, Jul 7, 2014 at 3:47 PM, Thomas Kluyver <takowl at gmail.com> wrote:

> On 7 July 2014 00:20, Thomas Wiecki <thomas.wiecki at gmail.com> wrote:
>
>> With my limited understanding of the IPyNB internals I would see three
>> ways this could be achieved:
>> * There is a hook in the IPyNB I can use like the magic
>> * I have to change the IPyNB client code to do the analysis before it's
>> sent to the kernel.
>> * I change the kernel to do the analysis.
>>
>> Which of these is the best? Can someone point me to the relevant code
>> section I would need to make changes to?
>
>
> I think you can make use of the hooks already in the kernel. If you're
> just checking the AST, it's fairly straightforward: just register an AST
> transformer as described here:
> http://ipython.org/ipython-doc/dev/config/inputtransforms.html#ast-transformations
> . It doesn't need to do any transformations: you can simply inspect the
> code and return it unchanged. Or you can replace it all with Pass() to
> prevent the cell from executing. It would still look as if it had executed
> from the frontend, though.
>
> Thomas
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>


-- 
Thomas Wiecki
PhD candidate, Brown University
Quantitative Researcher, Quantopian Inc, Boston
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140707/c55d5cda/attachment.html>


More information about the IPython-dev mailing list