[IPython-dev] loading a static JS file when loading an IPython extension in the notebook

Nicholas Bollweg nick.bollweg at gmail.com
Fri Jul 11 09:38:32 EDT 2014

Here's the most recent thread on that:

I captured some of the pattens into a cookiecutter template:

You can use this pattern, even if you aren't using widgets, though.

The key chores are:

   - make sure your static files, in a folder, get copied on install
   - when you are ready to use your JS, copy static into the
nbextensions directory
   (in the users profile) with IPython.html.nbextensions.install_nbextension
   - display them (and/or any css) with display

Here is the file I use for encapsulating those steps:
It gets called each time an instance of a class is instantiated. It was
suggested that this is preferable over loading it at import time.

Hope this helps!

On Thu, Jul 10, 2014 at 8:48 AM, Cyrille Rossant <cyrille.rossant at gmail.com>

> Hi,
> What is the best way to write an IPython extension such that
> `%load_ext myext` loads `myscript.js` in the current notebook? If
> possible, I'd prefer to avoid asking users to make manual changes to
> custom.js or similar.
> Thanks,
> Cyrille
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140711/6fb2fc09/attachment.html>

More information about the IPython-dev mailing list