ipywidgets
ipywidgets copied to clipboard
IEEE float serializers
Problem
There are issues with using the default Python serialization for floats, as it might write invalid JSON including plain-text NaN, Infinity, -Infinity values. See e.g. https://github.com/jupyter-widgets/ipywidgets/issues/1531
and https://github.com/jupyter-widgets/pythreejs/issues/366 for examples of places where it might make sense to have support for IEEE values.
Proposed Solution
Add a set of convenience serializers (and possibly a separate trait type if that makes things easier?) for transmitting full IEEE float values. This would probably entail encoding nan/inf as strings (enum values).
Additional context
A very timely additional question is whether any of the core widgets should switch to using such a serialization. This would change the protocol for these widgets in a non-backwards compatible manner, making it a candidate for 8.0 (e.g. for https://github.com/jupyter-widgets/ipywidgets/issues/1531).
This is a related issue in ipykernel/jupyter_client: https://github.com/jupyter/jupyter_client/pull/708