These are chat archives for ipython/ipython

14th
Mar 2018
Nicholas Schrock
@schrockn
Mar 14 2018 00:10

Hello all. I just have a quick question. I'm attempt to build some custom magics/integration within the context of jupyter notebook. In particular what I would like to do is to be able to access all of the cells that are in the current notebook, as opposed to just the particular cell where the magic is implemented.

To be specific, when this function is invoked:

@register_cell_magic
def the_magic(line, cell):
   # do stuff

My problem would be solved if cell was not just a string with the current cell contents, but instead was an object that had access to the parent notebook and then in turn all the child cells.

My current alternative is to actually parse the current notebook in context from disk and then find the cells that I want to interact with and execute. However this requires the user to save the notebook and it doesn't have the rest of the execution in context, so it causes some unexpected behavior.

If this isn't the correct forum to ask questions like this please redirect me! Thanks

ravi19ved
@ravi19ved
Mar 14 2018 11:29
Started exploring iPython... grt experience sofar..!!