[IPython-dev] Sharing Custom Widgets

Jonathan Frederic jon.freder at gmail.com
Mon Apr 21 19:26:10 EDT 2014


Hi Pierre,

My responses are inline below,

Cheers,
Jon


On Mon, Apr 21, 2014 at 3:32 PM, Pierre Villeneuve <
pierre.villeneuve at gmail.com> wrote:

> I am working on a Notebook project where I want to build an HTML view of
> my analysis results, potentially including a good bit of JavaScript.
>  Initially I had decided my display would not need to communicate with
> anything in Python land and would simply be an isolated interactive
> display.  It's not done yet, and I am still struggling with the JavaScript
> parts.  Currently I display my HTML and run my JavaScript via IPython's
> rich display functions.
>
> I really like the new Widget system and I am considering switching over as
> I have new ideas for possible interaction with my display.  I have looked
> through a number of examples for custom widget's, but it's not clear how
> one might share a custom widget for use by other users.  I see that I can
> define everything in a couple of Notebook cells, and then require the user
> to step through and execute them.  Or I could require the user to place
> files inside their .profile's  static/custom folder, but that seems awkward.
>
>
AFAIK the later is the "official" way to redistribute custom JS/CSS.
 Personally, I prefer to include the JS in the same directory is my
notebooks, I think it's easier for the user that way.  It's kind of a hack,
but you can see how I do it in https://github.com/jdfreder/ipython-d3 .
 The idea is to include a .py and .js file next to the notebook.  The .py
file has a function that pushes the .js to the page using the display
framework.  For the user, this means all they have to do is create a
notebook in the same directory and do something like `import custompython;
custompython.publishjs()`.


> Does there exist a prescription for how I might package a custom widget
> for simple installation by a remote users?  From my simple investigation so
> far, it looks like RequireJS looks for JavaScript modules in two places:
> the default ipython/html folder, or under the user's profile static folder.
>  It would be nice if there was a mechanism to specify an additional folder,
> e.g. a static folder I define as part of my package that gets installed by
> the user.
>

We don't have a nice way to package IPython notebook extensions yet...


>
> Thanks for any advice.
>
> *Pierre Villeneuve*
> pierre.villeneuve at gmail.com
>
>
> _______________________________________________
> 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/20140421/755b3643/attachment.html>


More information about the IPython-dev mailing list