These are chat archives for ipython/ipython

14th
Nov 2014
Scott Sanderson
@ssanderson
Nov 14 2014 00:50
You can use Type(Bool) can't you?
Sylvain Corlay
@SylvainCorlay
Nov 14 2014 00:51
Correct
Lion Krischer
@krischer
Nov 14 2014 12:07
Hi all, whats the best way to deal with fairly complex _repr_html_() methods that requires some JavaScript libraries loaded from some CDN? In the past I did this by creating iframes so nothing messes with the JS of the notebook itself. Is there a better way? Can the Widgets somehow be used for this? I would also really like this to work on nbviewer.
Related question: How to package custom IPython widgets?
Jason Grout
@jasongrout
Nov 14 2014 15:16
Just wanted to run an idea by people here before making a PR. I'd like to make an optional parameter for the install_nbextension command for the name of the directory in the ipythondir/nbextension/ tree. Currently, if I want to make a package and install it using the command, I have to make sure that the directory I'm installing is named the same as what I'd like the nbextension directory to be. This makes the directory structure in my package awkward. For example, I might have a package mypackage, and a directory containing the javascript code in mypackage/nbextension. If I just try to install that directory directly, the nbextension directory is nbextension/nbextension. So I end up doing something like mypackage/nbextension/mypackage/... in my package. I'd rather have ipythondir/nbextension/mypackage point to mypackage/nbextension.
(if that is too confusing, I'll just make the change and submit a PR)
Jason Grout
@jasongrout
Nov 14 2014 15:33
@krischer - we're still working that out
one way to do it is to make a normal setuptools python package, and then have a separate install_nbextension command that installs the nbextension. The user needs to run that command to install the javascript part

clearer query about my comment above: the install_nbextension docs says

    files : list(paths or URLs)
        One or more paths or URLs to existing files directories to install.
        These will be installed with their base name, so '/path/to/foo'
        will install to 'nbextensions/foo'.
        Archives (zip or tarballs) will be extracted into the nbextensions directory.

I want to specify a nbextension name, instead of having it always be the basename.

Jason Grout
@jasongrout
Nov 14 2014 15:54
I put in an issue about this: ipython/ipython#6939. I also looked at the code, and realized it is a bigger undertaking than I originally thought because of things like installing URLs and zipfiles, checking installation of packages, etc. Still doable, of course, but not in the few minutes that I have now.
Scott Sanderson
@ssanderson
Nov 14 2014 17:27
@krischer you might want to take a look at github.com/quantopian/qgrid for a project that's doing something that sounds similar to what you're doing
not sure that the solution we found is the best/canonical way to do it, but it's what worked for us
Jonathan Frederic
@jdfreder
Nov 14 2014 17:28
Huzzah!!! Widget promises promise resolved! ipython/ipython#6818 passing
Min RK
@minrk
Nov 14 2014 20:15
Terrific, thanks @jdfreder
Sylvain Corlay
@SylvainCorlay
Nov 14 2014 21:13
yeah awesome @jdfreder . As soon as it is merged, I will try upgrading our widgets to the latest IPython.
Jason Grout
@jasongrout
Nov 14 2014 21:31
I'm giving a talk next week in PyData NYC on IPython widgets - I'm glad this is going to make it into master before I talk (I'm going to be talking at least a little about the changes coming in IPython 3.0)
Jonathan Frederic
@jdfreder
Nov 14 2014 21:42
@jasongrout sounds sweet
I wish I could see, I'm guessing it will be recorded? I'll watch online :P
Jason Grout
@jasongrout
Nov 14 2014 22:20
yep, it's going to be recorded.
Jason Grout
@jasongrout
Nov 14 2014 22:26
I'd like to get my viewlist stuff in sometime next week, if possible. I'll work on making it work on top of the promises.
Jonathan Frederic
@jdfreder
Nov 14 2014 22:27
I have no problem expediting the viewlist stuff once promises get merged.
brb
Thomas Kluyver
@takluyver
Nov 14 2014 22:32
speaking of promises, who wants to push the button on #6924? :)
Min RK
@minrk
Nov 14 2014 22:46
button pushed
Thomas Kluyver
@takluyver
Nov 14 2014 22:53
awesome, that unblocks me on two other PRs