-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
JSON encoding engine instrumentation #3012
Conversation
Every to_json_plotly call runs all three JSON encoders and raises an exception if they don't produce identical results.
awesome! To get a bit more mileage out of our extant tests which don't call |
Yeah, those are good ideas. I'll add that sometime over the next couple of days |
@nicolaskruchten, I added the extra instrumentation points in be81b16 and everything looks the same as far as I can tell. See what you think! |
OK, are you just running these locally or...? CI is failing because |
Yeah, I was running locally. And on CI I was mostly looking at the docs. I had the orjson stuff working on CI, but maybe that's in the other PR. I'll take a look. |
Merged in #3022, and a couple CI fixes and now all existing tests are passing with the instrumented version. |
This PR should not be merged!
This PR is instrumented for testing the new JSON encoding engine being introduced in #2955 (comment). Idea from @nicolaskruchten in #2955 (comment).
With this branch, every call to
to_plotly_json
performs JSON encoding with all three engines, then decodes the result and checks that identical dictionaries are produced. When they are not identical, and exception is raised.Locally, nearly all of the documentation examples work. The two exceptions are
imshow
andml-tsne-umap-projections
. Both of these fail due to difference in how the orjson encoding handles floating-point numbers with precision less than 64 bits.When encoding a
float32
numpy array, thelegacy
andjson
encoders will convert this to a list of regular Python 64-bit floats before encoding them. This results extra digits in the JSON representation. In contrast, theorjson
encoder will only write out the number of digits corresponding to the original 32-bit values.