How to display Python object using JavaScript in JupyterLab


I’m currently developing a custom widget using ipywidgets (GitHub). This widget takes a Python object which is a Graph, and displays it in Jupyter Notebooks as an SVG where it provides the ability to listen to clicks etc.
This all works fine, but now I want to have a simpler representation of the Python object. I currently do this by overwriting repr_html and then returning a html-string.

This works great for the notebook, but it won’t work for JupyterLab as explained here.

My idea was to integrate a custom mime-renderer to deal with this problem but failed with setting it up, since the cookiecutter is deprecated and not maintained for JS anymore.

So my question is, whether there is a better solution than using a custom mime-renderer, and if there isn’t how would I integrate a custom mime-renderer into my existing widget.

Sorry that I couldn’t link more, but apparently new users can only add two links to a post.

Thanks in advance!

did you try to install your extension as a normal extension rather than nbextension?
checked your code everything looks good but for LTS I suggest you switch to typescript and use typing on both sides(FE, BE). First link your extension without building then build jlab and check again