jupyter-sphinx
jupyter-sphinx copied to clipboard
How to specify a jupyter widget which currently not published on npmjs.com
Hi, I am trying to build interactive documentation using jupyter-sphinx, but I am not able to view the output, following are the error I am getting, I think it ie because the widget is not published on npmjs.com 🧐

That's a tough one! We're using the jupyter widget machinery to render everything with the corresponding mimetype. So to see if you can influence that you should probably ask in the widgets repository.
Without interfering with widgets, I think you have the following options. If you have a non-widget way to render your data, you could serve data as a custom mimetype, and include the rendering javascript separately. Or you could return the html that includes the rendering code.
Is there no way to use locally installed jupyter widget extension, like I can install it locally and tell jupyter-sphinx to use it, rather than searching in npmjs.com ?
You'd need to figure out two things:
- How to modify the way the jupyter widgets resolve the extension code
- How to package your extension together with the generated documentation
So what I thik is the call for npmjs.com is made by nbconvert while trying to execute the code cell.
That you wouldn't see in your browser logs. Also the npmjs calls are made by the browser, and therefore are unrelated to nbconvert.
No, I was talking about who initiated it i.e the require.min.js 😅
@akhmerov jupyter-sphinx uses nbconvert to execute jupyter code right?
Correct. To be more precise, it uses nbclient, the former nbconvert execute preprocessor.
It seems we need to set the data-jupyter-widgets-cdn as specified here https://ipywidgets.readthedocs.io/en/latest/embedding.html#the-case-of-custom-widget-libraries , but now the question is how can we set this from an rst file or Sphinx config 🧐
Like we need to find how can we set the data-jupyter-widgets-cdn in the following script tag generated for documentation
<script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="here-map-widget" src="https://unpkg.com/here-map-widget@^0.1.0/dist/index.js"></script>
Hi @omanges is this issue still bothering you ? I'm a new maintainer of the repository and I try to find where I can be useful and where people have dropped the gantlet for a very long time.
Since 2020 did you publish your widgets on npm ? Did you managed to do it on your own ?