[IPython-dev] writing notebook extensions compatible with IPython.load_extensions

Max Linke max_linke at gmx.de
Sun Jun 29 11:26:38 EDT 2014


On Sun, 2014-06-29 at 17:07 +0200, Matthias Bussonnier wrote:
> Hi Max
> 
> Le 29 juin 2014 à 15:39, Max Linke a écrit :
> 
> > `IPython.load_extensions('test');`.
> 
> Where do you do that ? 

in ~/.ipython/profile_default/static/custom/custom.js

> It is probably just a race condition : 
> 
> > 	$([IPython.events]).on('app_initialized.NotebookApp',function(){
> >     	   IPython.load_extensions('test');
> > 	});
> 
> 
> 
> Should work as  IPython.load_extensions is just a simple wrapper around require.

For this 'Table of Content' extension I just need to load it with
`IPython.load_extensions('toc')`

https://github.com/minrk/ipython_extensions/blob/master/nbextensions/toc.js#L125

I see that he also has the IPython.event in here but I don't really
understand what he is doing. Does this define IPython.toolbar if it is
undefined and then calls `toc_button` again afterwards?

Any explanation for what he is defining in L17 would also be nice.

Sorry if these questions are dump. I've never used javascript before.





More information about the IPython-dev mailing list