-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This cookiecutter example for general jupyter extension #96
Comments
I'm not really a JS expert either, but using webpack to transpile to the desired target platform is a really common practice. As a general rule though for this repo, the less you modify the internals and scripts the better (especially since you're just starting out). As soon as you leave the beaten path, it will be much harder for maintainers to help debug any issues you may encounter. |
Hi @Naman-ntc are you trying to build a widget (works in jupyter notebook + jupyterlab) or a jupyter notebook or jupyterlab specific extension? Widgets from this repo will only work if you have an active python kernel, while extensions can work without an active kernel. If you are making a pure jlab extension then you can use the sibling cookiecutter: https://github.com/jupyterlab/extension-examples/tree/master/react-widget There is also a repo of examples for that cookiecutter including one that uses react which you may find helpful: https://github.com/jupyterlab/extension-examples/tree/master/react-widget |
Hi @ianhi, To answer your question -- I was thinking of building a javascript extension but now I will reconsider |
I think it's easiest to think of widgets as subset of extensions. Behind the scenes the leverage the extension system to create an display themselves, but they can only be created by the user by calling some python. Whereas extensions would always be available in the JLab interface whether or not you are working in a notebook. So for example jupyterlab-git is an extension: https://github.com/jupyterlab/jupyterlab-git#jupyterlab-git but jupyterlab-sidecar is a widget: https://github.com/jupyter-widgets/jupyterlab-sidecar#usage Which of these seems more like what you want will decide which cookiecutter you should use. |
Yeah that makes sense. |
Yeah, the cookiecutter/ipywidgets do some things behind the scenes to allow them to behave as either a notebook extension or a jupyterlab extension. But in general extensions will only work for one frontend as they have different APIs |
I see. Thanks alot |
Just a note to users trying to add react to widgets --
My webpack config rules look like the following
|
Hi,
I am fairly new to js development and these questions might be trivial. I am trying to build a React-based jupyter extension.
However, the standard notebook extension tutorials follow the AMD module syntax and I can't use my react components since they are written in ES6 format. I believe I can follow the webpack scripts used in this cookie-cutter for converting my react app into the required AMD format.
1.) Do you think this is a good idea and whether it will work? It would be great if you can suggest changes to this approach or if you know of any other approach.
2.) extension.js & index.js seem to be written as commonjs. Will the webpack scripts work out of box in for es6 react components?
The text was updated successfully, but these errors were encountered: