Skip to content

Javascript inconsistent between PyPI and npm/unpkg #291

Closed

Description

@jeffyjefflabs

Environment

  • Operating System: Ubuntu
  • Python Version: 3.7.4
  • How did you install Qgrid: pip
  • Python packages: qgrid 1.2.0, notebook 6.0.3, voila 0.1.20
  • Jupyter lab packages (if applicable): N/A

Description of Issue

Qgrid widget does not display in Voila in certain scenarios. Please see ongoing discussion at voila-dashboards/voila#72. A couple people identified a workaround where they changed the first line of qgrid/index.js from this (which is what you get from PyPI):

define(["@jupyter-widgets/base","base/js/dialog"], ...

to this (which is what you get from unpkg.com):

define(["@jupyter-widgets/base"], ...

Reproduction Steps

  1. Install voila and qgrid and enable extensions
  2. Turn off your internet to prevent Voila's fallback to unpkg.com
  3. Qgrid widget will not display

What steps have you taken to resolve this already?

See my recent comment in the Voila thread.

Anything else?

We love qgrid but would prefer to avoid patching it! :)

Activity

  1. gerrymanoim commented on Feb 18, 2020

    @gerrymanoim
    Contributor

    Hey @jeffyjefflabs - thank you for reporting this (and apologies for the late response). This is currently fixed on master. Once we get through #287 (comment), we'll cut a new release.

  2. gerrymanoim commented on Feb 25, 2020

    @gerrymanoim
    Contributor

    This is now released - let us know if it is still an issue.

  3. jeffyjefflabs commented on Feb 28, 2020

    @jeffyjefflabs
    Author

    Looks good to me, thanks!

  4. jeffyjefflabs commented on Mar 6, 2020

    @jeffyjefflabs
    Author

    @gerrymanoim did this get reverted somehow? I definitely tested it last week and it worked, but now it seems broken again. Am I losing my mind?

    Fresh pip install, pip freeze shows 1.3.0, but does not work in voila (offline). Index.js line 1:

    define(["@jupyter-widgets/base","base/js/dialog"], function(__WEBPACK_EXTERNAL_MODULE_143__, __WEBPACK_EXTERNAL_MODULE_150__) { return /******/ (function(modules) { // webpackBootstrap
    

    If I remove base/js/dialog from the define, it works in voila. The unpkg.com version does not have base/js/dialog.

    Thanks for the help.

  5. gerrymanoim commented on Mar 6, 2020

    @gerrymanoim
    Contributor

    @jeffyjefflabs - We had to move to a new npm package - see the discussion here: #288.

    The unpkg version for qgrid2 shows the right thing (I believe): https://unpkg.com/qgrid2@1.1.2/dist/index.js The instructions at https://github.com/quantopian/qgrid#jupyterlab-installation should also be referencing qgrid2 now.

    Apologies for the confusion.

  6. jeffyjefflabs commented on Mar 6, 2020

    @jeffyjefflabs
    Author

    Hmm ok so maybe the problem is actually that the nbextension and the labextension are different? The nbextension (installed via pip) contains (in local file nbextensions/qgrid/index.js) define(["@jupyter-widgets/base","base/js/dialog"].... Voila, when configured to server local nbextensions, will try to serve that local file, but since base/js/dialog is provided by the classic notebook and isn't there in Voila, you get an error. If you're offline, game over, qgrid won't work. If you're online, Voila will fallback to unpkg.com, in which case it's actually getting the labextension code instead, which then works.

    Does that sound like a more plausible explanation for what's happening?

  7. gerrymanoim commented on Mar 6, 2020

    @gerrymanoim
    Contributor

    Ah - yes, I think that makes sense?

    I believe that's coming in via https://github.com/quantopian/qgrid/blob/master/js/webpack.config.js#L63 which was added in b3f8379#diff-69efad4a1399d8cd8a26a3771ae156df.

    I'm unclear on what effect that will have, if any, on non-lab users if we just drop that external.

  8. jeffyjefflabs commented on Mar 7, 2020

    @jeffyjefflabs
    Author

    I know my colleagues really like the full-screen feature so I wouldn't want that to go away!

    From this bit of code it seems like at one point base/js/dialog could be conditionally required. But without that external I'm guessing it ends up like the npm version (search for dialog), where it looks like webpack was unhappy about it. I'm not familiar with webpack at all, so I don't know if there's a way to make it play nice here.

  9. gerrymanoim commented on Mar 9, 2020

    @gerrymanoim
    Contributor

    I'm also not all that familiar with webpack, but it seems like it should be possible.

    I've created #298 to track this outside the PR thread. Will try to find some time to research a solution.

  10. jeffyjefflabs commented on Mar 11, 2020

    @jeffyjefflabs
    Author

    Awesome, thanks for continuing to look into it. Fortunately we have a couple workarounds, so we're not dead in the water.

  11. bytesemantics commented on Mar 8, 2021

    @bytesemantics

    Has this now been resolved ? We are impacted by this issue - qgrid not displaying in voila - causing all widgets to not be displayed -> Voila renders a blank screen (no errors).

    I've applied the qgrid/index.js patch temporarily and voila now rendering my dashboard correctly (ipywidgets/qgrid).
    Using:
    python 3.8.1
    qgrid 1.3.1
    voila 0.2.7
    ipywidgets 7.6.3
    jupyter 1.0.0
    jupyter_client 6.1.11
    jupyter_core 4.7.1
    jupyter_server 1.4.1

    Any ideas ? (Thanks in advance)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions