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

Ipywidgets 8 support #378

Merged
merged 6 commits into from
Aug 12, 2022
Merged

Ipywidgets 8 support #378

merged 6 commits into from
Aug 12, 2022

Conversation

vidartf
Copy link
Member

@vidartf vidartf commented May 19, 2022

Ipywidgets 8 is above to be released, and some changes are needed to support it:

  • We cannot use the .extend() method from the base classes anymore. We should switch to using class ... extends pattern (switched to es2018 throughout).
  • We cannot use _ipython_display_ for the preview anymore. We should switch to _repr_mimebundle_.
  • Add serializers for non-finite floats. Closes JSON serialization of OrbitControls fails with jupyter_client 7.0.3 #366.
  • Dropped support for Python < 3.7, including Python 2.

@codecov-commenter
Copy link

codecov-commenter commented May 19, 2022

Codecov Report

Merging #378 (a7f9cca) into master (a78cb57) will decrease coverage by 0.81%.
The diff coverage is 75.49%.

@@            Coverage Diff             @@
##           master     #378      +/-   ##
==========================================
- Coverage   70.86%   70.04%   -0.82%     
==========================================
  Files          23       23              
  Lines         834      888      +54     
==========================================
+ Hits          591      622      +31     
- Misses        243      266      +23     
Impacted Files Coverage Δ
pythreejs/_base/Three.py 58.62% <14.28%> (-29.38%) ⬇️
pythreejs/traits.py 86.54% <74.50%> (-4.29%) ⬇️
pythreejs/_base/uniforms.py 67.44% <78.57%> (+0.77%) ⬆️
pythreejs/_base/renderable.py 85.96% <100.00%> (+0.25%) ⬆️
pythreejs/animation/AnimationAction.py 73.91% <100.00%> (+1.18%) ⬆️
pythreejs/core/Renderer.py 81.81% <100.00%> (-0.80%) ⬇️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

vidartf added 4 commits May 26, 2022 14:45
jupyter_client has deprecated support for non-finite floats, and aggressively prints to stderr if you try to serialize them.

Notes: We do not need a deserializer, as CFloats will handle the conversion in its validator. We were already relying on this fact, so no change. Similarly, the JS convertFloat[...] functions continue to serialize/deserialize there. This also extends Vector/Matrix/Euler to support IEEE floats.
@vidartf vidartf marked this pull request as ready for review May 26, 2022 13:56
@@ -96,39 +97,36 @@ _.extend(RendererPool.prototype, {
depth: true,
stencil: true,
premultipliedAlpha: true,
preserveDrawingBuffer: false,
preserveDrawingBuffer: true,
Copy link
Member Author

Choose a reason for hiding this comment

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

This fixes a bug for webgl2, which could be seen in the "renderer_limit" notebook

@@ -324,7 +324,7 @@ function nestedDiff(newObj, oldObj) {
} else {
diff = dictDiff(newObj, oldObj);
}
var all = _.flatten([diff.added, diff.removed, diff.kept]);
var all = [...diff.added, ...diff.removed, ...diff.kept];
Copy link
Member Author

Choose a reason for hiding this comment

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

This fixes a bug for listening to certain arrays in dicts structures.

@vidartf
Copy link
Member Author

vidartf commented Jun 16, 2022

@akaszynski Do you want to do a review / test this?

@LtAirman
Copy link

LtAirman commented Jul 2, 2022

Hello vidartf,

I’m a newbie programmer working with Jupyter Notebook and pythreejs.

All 3 of my project files at https://github.com/LtAirman/ChargeFieldTopics stopped working this morning. They no longer display the pythreejs rendered scene.

Over the last few months the cell setting up the rendered scene displayed a UserWarning, due to non JSON compliant infinite values. I believe you identified the problem, involving the pythreejs orbital camera, in issues 366 and 378 which I’ve been following.

It was my impression this non-finite number problem would be corrected with the upcoming ipywidget 8 release, seeing no rendered output at all is an awful surprise. I assume it's the same issue. What do I do now?

I’d appreciate any guidance or information you might provide in this matter.

@LtAirman
Copy link

LtAirman commented Jul 3, 2022

Update, happy to report my projects' pythreejs rendered outputs are now working properly.

@LtAirman
Copy link

LtAirman commented Jul 3, 2022

Along with the UserWarning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSON serialization of OrbitControls fails with jupyter_client 7.0.3
3 participants