- Notifications
You must be signed in to change notification settings - Fork0
🧐 Easily inspect/visualize objects and variables in your running python code in real time.
License
richstokes/python-objectviewer
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Debugging tool thats lets you easily inspect/visualize objects and variables in your running python code as a tree view.
It uses the Debug Adapter Protocol (DAP) to retrieve the objects in your running python program. It then displays them in a web app.
Every time you refresh the page, it briefly pauses your running code and displays a snapshot of its current state.
On the project you wish to debug, installdebugpy:pipenv install debugpy
From the project you with to debug:
pipenv run python -m debugpy --listen localhost:5678 your-script.py
In another terminal, clone this repo and run:HD_PORT=9000 pipenv run python pov.py
Then open your browser athttp://localhost:9000
By default this will grab the variables of the running program at the time you load/reload the python-objectviewer page. I like this for long-running programs / those that are running in an infinite loop; a quick refresh of this tool and it'll snapshot the current state without needing any modifications of the target program.
If you want to capture the state more precisely you can do something like this in your target program:
# At the start of your programdebugpy.wait_for_client()# At the point in the code you want to capturedebugpy.breakpoint()
The code will then pause at the breakpoint until this tool connects and takes a snapshot of its current state.
About
🧐 Easily inspect/visualize objects and variables in your running python code in real time.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.