feat(anywidget): Reduce Backbone dependency, implement minimal JS runtime over comm #479
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an experiment to further reduce anywidget's dependency on
@jupyter-widgets/base
(and thus Backbone). The idea is that by managing the comm ourselves, we can more readily implement adapters for other popular frontend frameworks without the overhead/dependency of another framework. Additionally, this would allow us to configure things like serializers custom serializers.However, it's increasingly clear just how coupled classic Backbone-based widgets are with the rest of the Jupyter ecosystem. This PR is kind of massive, so I'm not sure how viable it is. There are many rough edges with trying to understand the boundaries between widget manager and DOMWidgetView/DOMWidgetModel, and expected APIs.
So far my approach has been manually looking at the ipywidgets source code and only exposing public APIs on the
Model
andView
that are used by the WidgetManager. We will only go forward with this PR if we are able to faithfully implement anywidget's current API.My hope is that we can have different, "mode"s for anywidgets, one of which could be more low-level and for front-end framework authors. For example, the existing Backbone widgets could be implemented with this like: