Custom rendering from python object

Hey, I have some python calculations which are being done and all the data is being stored as possibly a json or a string object.
I would like to create a custom renderer for this, such that it reads this json object and renders a react widget.
How can I do the same?
For example I have:
The above json saved in a variable, and I would like to render it using my own react widget rather than the text/plain method shown below using kernelSpy

Customising the default renderer for a generic type like a dict is possible, but highly recommended against for the simple reason that it’s not performant or cooperative with other people intending to do the same.

Instead, if you want to render data, I’d advise either creating a custom type for which you can register a MIME renderer, or to create a dedicated function that invokes IPython.display for your special dict.

1 Like