pygame-web / pygbag

python and pygame wasm for everyone ( packager + test server + simulator )
https://github.com/pygame-web
MIT License
338 stars 39 forks source link

pdb-like debugging workflow? #69

Open gabriel-v opened 1 year ago

gabriel-v commented 1 year ago

I get it that pdb doesn't work in browsers because we don't have subprocess and we apparently need it. We also don't have stdin, which I think is used for the pdb REPL.

But I can't figure out how to obtain a debugger workflow where I can python shell myself in the middle of anything, anywhere.

Somebody, somewhere, worked around this - maybe we can field some quick hack in the pythonrc to get some kind of debugger shell / breakpoint REPL?

pmp-p commented 1 year ago

Actually you can have function tracing and REPL all the time. i use tracing to detect infinite loop when porting code. REPL is not so usefull while running a game.

pdb style break could work in async functions ( spinlock + yield ) allowing variable inspection. That would be more interesting for REPL use and not very hard to use when code reloading is implemented.

breaking in non async is not always possible on worker-less cpython ( afaik only WaPy can do that on main thread) so it's not worth the work since in the future python code will get more and more compiled to wasm ( mypyc ).