Writing IPython Notebook Extensions That Can Perform Analysis Per Cell

I am trying to write an extension for IPython notebook that will run code analysis on each cell and then output messages through the logger (this could be a PEP8 analysis for example to take a simple example). The trick is that I want to be able to load the extension once at the top of the laptop and apply it to all cells.

It is possible to define custom linear and cellular magic (see here ), but you need to put a magic command in each cell, whereas I would like for all code cells.

I also found that it is possible to register a class that pre-filters the code input using ip.prefilter_manager.registre_transformer

, but that works based on a string that is not good enough.

Does anyone have any suggestions on how to register a function that can parse the contents of all cells when they are executed and add log messages to the output of a given cell?

I know there is a PEP8 extension for IPython notebook, but that requires a magic %% pep8 command to be placed in each cell, and I want to change it to be a more global setting in notebook.

+3
python ipython ipython-notebook


source to share


No one has answered this question yet

Check out similar questions:

752
How to make matplotlib laptop IP address
542
Using IPython notebooks under version control
72
Running IPython / Jupyter notebook not interactively
71
how to dynamically update a graph in a loop in ipython notebook (in one cell)
50
Make multiple charts in one IPython Notebook cell
26
Using IPython console next to IPython notebook
12
Testing IPython Notebooks
4
Create IPython notebooks with cells already filled
1
IPython notebook: How to write cellular magic that can access notebook variables?
1
No access to laptop variables in ipython cell_magic



All Articles
Loading...
X
Show
Funny
Dev
Pics