[IPython-dev] Where should bugfix PRs go, and how would I include a javascript fix in my package?

Jonathan Frederic jon.freder at gmail.com
Mon Aug 3 13:26:19 EDT 2015


Hey Matt,

Nice to see you on the ML.  Please submit the PR to ipython/ipywidgets, if
it needs to be backported, we will handle that.

You're question about hooking up the JS, within the confines of a PYPI
package, is a good one.  I think I rushed over that material because of the
time constraint.  You'll need to use the nbextension API, either calling
out to it in your setup.py (see jdfreder/jupyter-pip) or in a python file
that's a part of your package.  The second option would make install a two
step process  i.e. `install.py`, installation would then be `pip install -e
. && python -m reducer.install`.

Once you get that part figured out, your JS should be available on the
page.  You can then subclass accordion using code like this:
```python
class Accordion(ipywidgets.Accordion):
        _view_module = Unicode("nbextensions/reducer/accordion", sync=True)
        _view_name = Unicode("AccordionView", sync=True)
```
where the above points to AccordionView in nbextensions/reducer/accordion.js

Cheers,
Jon

On Sun, Aug 2, 2015 at 8:30 PM, Matt Craig <mattwcraig at gmail.com> wrote:

> Hi,
>
> A couple of questions:
>
> 1. I've got a fix to a couple of issues that come up when
> Accordion widgets are nested. I've read the contributing guide on
> github and am wondering whether I should make the PR on master in
> ipython/ipython (since the issue occurs in ipython 3.2) or in
> ipython/ipywidgets (since that is the Future)?
>
> 2. In a nutshell, the fixes, in the javascript for AccordionView, ensure
> that titles and show/hide events are not propagated to Accordions that are
> children of an Accordion. I'd like to include this fix in the package I'm
> using the Accordions in (reducer <https://github.com/mwcraig/reducer>).
> I'm fine with creating a custom Accordion python class that is used instead
> of the ipython Accordion if the user is using a version of ipytohn that
> doesn't contain the fix in 1.
>
> My question: How do I connect my python accordion to my modified version
> of the javascript AccordionView?
>
> To be clear, I'm already distributing this as a python package on pypi.
> Also, I went to the advanced jupyter tutorial at SciPy 2015, so
> if the answer is I should go back and read hose materials more closely,
> just tell me :).
>
> Matt Craig
>
>
> _______________________________________________
> 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/20150803/b5aa6cea/attachment.html>


More information about the IPython-dev mailing list