Pura: embedded visualization framework

Does your Trio-based program have interesting state that you’d like to visualize and interact with in realtime? (Draw graphical shapes and text, use input from the mouse and keyboard.)

Shouldn’t it be possible to do this by pointing a browser at an HTTP port served by the app? The draw function is implemented simply in Python, local to the code it’s inspecting. It’s stateless and non-async, so it can inspect the state of your async program atomically for an instant in time.

And for accessibility, shouldn’t the drawing framework follow an established API (Processing) for making visual form in code?

And since this view is for development only, shouldn’t the solution use zero runtime resources when there are no clients? How about supporting an arbitrary number of client connections?

Pura does this. It’s a proof of concept announced in passing at PyCon JP 2019. At GROOVE X I’m not sure how we’d get by without it for development of our robot.

I’ve just spent some time updating the public repo with bug fixes. The library has no known bugs, performs well, has very high utility, and is used routinely by programmers and non-technical people.

That said, Pura is not published to PyPi, and has some uncomfortable integration points (like using a non-standard HTTP server implementation). These can be addressed, and perhaps even generalize it to other async frameworks… but first there has to be some interest or use outside of GROOVE X. So take a look!

4 Likes