-
Notifications
You must be signed in to change notification settings - Fork 947
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
Add default pack_models
#3738
Add default pack_models
#3738
Conversation
👈 Launch a binder notebook on branch bollwyvl/ipywidgets/gh-3735-default-serializer |
I've taken this out of draft and updated the notes a bit: probably don't have time to dig into the packaging file... more |
.binder/requirements.txt
Outdated
@@ -9,10 +9,3 @@ pandas | |||
scikit-image | |||
scikit-learn | |||
sympy | |||
|
|||
# checking https://github.com/jupyter-widgets/ipywidgets/issues/3735 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed these here, and opened this issue: jupyter-widgets/team-compass#20
@bollwyvl thank you for taking a look at this! I wonder if instead of having a I'll see if I can at least add a test to make this not happen again. |
In code, what I propose: -const deepcopy =
- globalThis.structuredClone || ((x: any) => JSON.parse(JSON.stringify(x)));
+const deepcopyJSON = (x: JSONValue) => JSON.parse(JSON.stringify(x));
+
+const deepcopy = globalThis.structuredClone || deepcopyJSON; @@ -572,7 +574,7 @@ export class WidgetModel extends Backbone.Model {
if (serialize == null && keySerializers.deserialize === unpack_models) {
// handle https://github.com/jupyter-widgets/ipywidgets/issues/3735
- serialize = pack_models;
+ serialize = deepcopyJSON; I do like you pack_models and I think we should ship it, and use it, so we don't rely on the JSON trick in the ipywidget code base. This asymmetry has confused me many many times. |
b4d793b
to
746151e
Compare
I can't push at the moment, due to github issues (last tried a few minutes ago) but i'm up for anything that reduces active breakage in many downstreams. Feel free to continue/fork this however you can! |
1c8621a
to
48a4cb6
Compare
5531823
to
ace563b
Compare
a2e5703
to
56c2844
Compare
meeseeksdev please backport to 7.x |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove the If these instructions are inaccurate, feel free to suggest an improvement. |
* However, the default serialize method will have the same effect, when | ||
* `unpack_models` is used as the deserialize method. | ||
* This is to ensure backwards compatibility, see: | ||
* https://github.com/jupyter-widgets/ipywidgets/pull/3738/commits/f9e27328bb631eb5247a7a6563595d3e655492c7#diff-efb19099381ae8911dd7f69b015a0138d08da7164512c1ee112aa75100bc9be2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This URL seems to be broken? Maybe due to a rebase?
References
Changes
IPY_MODEL_
magic string to a constantunpack_models
pack_models
serializer
that's a neighbor ofdeserialize: unpack_models
JSONExt.emptyObject
in some places to avoid allocating new objectsQuestions
widget_serialization
to mirror the backend API?