These are chat archives for ipython/ipython

3rd
Oct 2016
Nahuel
@D3f0
Oct 03 2016 01:53
Can I add something to the ipython kernel namespace from a cell_magic function?
I'm writing a cell magic that takes a chuck of C code and runs gcc on it, and I want to have some nice API to do some performance analysis,
as for now, this API is _.run() but I'd like to take some info from the cell and add an object
I know this is not explicit assignment though I think it could be quite useful to the user
any thoughts? or maybe any extensions out there that I can check out? Currently I'm using ipython-sql extension code as source of inspiration
but this codebase does not seem to add anything to the user local namespace
Min RK
@minrk
Oct 03 2016 09:10
@D3f0 you can access the IPython user namespace as get_ipython().user_ns. Adding a variable can be get_ipython()).user_ns['name'] = x