Skip to content
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

Anywidget #44

Merged
merged 45 commits into from
Aug 27, 2024
Merged

Anywidget #44

merged 45 commits into from
Aug 27, 2024

Conversation

justinlaughlin
Copy link
Contributor

Context

  • Jupyter has made a lot of breaking changes recently (1, 2) which seems to have broken our plugin:
    • Binder notebooks aren't working
    • Plugin doesn't work on a fresh install
    • I think if dependencies are set to certain versions the plugin can work (I'm not certain but I think that is why the Colab notebooks still work?); I haven't been able to replicate
  • We have been using the javascript widget cookiecutter template. I tried transferring over to the latest recommended templates (Copier typescript template) but could not get it to work.
  • From this cookiecutter I found out about anywidget which seems to abstract away most of the widget complexity.
  • This branch is a rewrite of our widget using anywidget and can be defined using only 1) the emscripten compiled glvis hosted on npm, 2) a single javascript file, and 3) a single python file.
  • We won't need the glvis-jupyter npm repo.
  • In my opinion, anywidget will be a much cleaner implementation than any of the alternatives available at the moment
  • There are large visualization packages that also use anywidget (e.g. pyobsplot)
  • (This is true for all widgets now, I believe) The widget is pip installed like any other normal python package, and doesn't require steps from before such as jupyter nbextension enable.
  • The work in this branch is related to Issue 43

Notebooks

I haven't tested much beyond our example notebooks, but they seem to all be working (also, I have not been able to run the widget except through Colab otherwise). I updated the Binder badges on this branch and they seem to work, feel free to test it out. Once this is pushed to pypi it will affect the Colab notebooks so I'm holding off on that for now.

justinlaughlin and others added 28 commits February 7, 2024 16:14
… are now obsolete (e.g. glvis-jupyter on npm)
@justinlaughlin justinlaughlin marked this pull request as draft April 4, 2024 18:22
@justinlaughlin
Copy link
Contributor Author

This changes/deletes a lot of things so I'm converting to draft for now until there is some feedback

@justinlaughlin justinlaughlin marked this pull request as ready for review June 18, 2024 18:57
@justinlaughlin justinlaughlin requested a review from v-dobrev June 20, 2024 03:07
@tzanio
Copy link
Member

tzanio commented Jun 24, 2024

@justinlaughlin do you understand why we get this conflicts and how to resolve them?

Screenshot 2024-06-24 at 3 57 42 PM

@justinlaughlin
Copy link
Contributor Author

@justinlaughlin do you understand why we get this conflicts and how to resolve them?

Screenshot 2024-06-24 at 3 57 42 PM

It looks like package-lock.json got updated in main while this PR deletes package-lock.json. A lot of files including this one are deleted because they are no longer necessary thanks to anywidget. glvis/widget.js (which pulls from the npm mirror of glvis-js) contains all of the necessary javascript. There is a diagram in this branch's README that might be helpful.

I submitted another commit which just deletes package-lock.json

Copy link
Member

@tzanio tzanio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating this @justinlaughlin !

@justinlaughlin
Copy link
Contributor Author

Regarding 6ba5116, it turns out you can simply point to github instead of npm using esm. From what I tested it seems to work. This simplifies things a lot as we no longer need to host the npm mirror of glvis-js 😄.

update binder links
version 1.0.0
@justinlaughlin justinlaughlin merged commit 549101f into main Aug 27, 2024
@tzanio tzanio deleted the anywidget branch August 27, 2024 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants