Skip to content

richstokes/python-objectviewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

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.

Screenshot

Screenshot

Setup

On the project you wish to debug, install debugpy:
pipenv install debugpy

Start debugpy server

From the project you with to debug:

pipenv run python -m debugpy --listen localhost:5678 your-script.py 

Run python-objectviewer

In another terminal, clone this repo and run: HD_PORT=9000 pipenv run python pov.py

Then open your browser at http://localhost:9000

 

Notes

By default this will grab the variables of the running program at the time you load/reload the python-objectviewer page.

If you want to capture the state more precisely you can do something like this in your target program:

# At the start of your program debugpy.wait_for_client() # At the point in the code you want to capture debugpy.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

Stars

Watchers

Forks

Languages