Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Provide an equivalent of curio.monitor #413
Yeah, it would! I'm surprised we don't have an issue open for this already.
I do think we should use a slightly different architecture: in curio the monitor is a single piece of monolithic code that's built into the core library, has a hardcoded mechanism for connecting, and has a small fixed set of commands, which are implemented using internal, non-public APIs. It's an awesome and useful proof-of-concept/demo, and we should provide a similar experience, but I'd like to do it in a way that lets monitor implementations evolve independently from the core trio library.
A lot of the groundwork for this is already there: Trio provides lots of introspection APIs. (Probably there are some gaps, but we can sort that out as we go.) For example, here's a little experiment in printing nice task trees from a live program, and there are lots of other things you can do – show task tracebacks, visualizing execution traces, etc. So I think the next step here would be for someone -- could be anyone -- to start building something and see how it goes. The curio monitor implementation is not very big.
In the longer run I think it'd be really neat to have a monitor interface that's an IPython REPL + magic commands for stuff like introspecting the task tree. But that's going to take some non-trivial work in IPython and python-prompt-toolkit to make them async/trio friendly (CC @Carreau).
There are three older (somewhat dead) monitoring projects that I know of, and my concept test from earlier this week https://github.com/Tronic/trio-web-monitor in case anyone is interested.
What is needed is someone willing to maintain the project long term, and then perhaps take the best elements of each of the existing implementations (then it is already a lot better than curio monitor or any other Python debugger for that matter). I am willing to participate if someone else shows up to cooperate but I won't take sole responsibility over it.