Maybe just use ipycanvas instead - it's on PyPI :) It works the same way except it's not a hack. I found it after I posted.
I went through:
- matplotlib animations (super slow, not live)
- writing an image with PIL and updating display (flickers)
- custom html+canvas code
- ipycanvas
I call display() on the canvas and then run the draw update loop on the canvas later in the same cell. That way the canvas is first displayed and then "live" updated.
It interoperates with python by being passed data to the draw call.
Usage like: c = Canvas(); c.draw(xs); xs is a numpy array of shape (N, 2), the points to draw on the canvas.
It's not fancy. But it drew animations faster than matplotlib (I ran this for thousands of frames, just to watch the simulation).