Skip to content

Commit 1e80c33

Browse files
committed
wip
1 parent 88d6131 commit 1e80c33

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,18 @@ pipenv run python -m debugpy --listen localhost:5678 your-script.py
2626
In another terminal, clone this repo and run:
2727
`HD_PORT=9000 pipenv run python pov.py`
2828

29-
Then open your browser at [http://localhost:9000](http://localhost:9000)
29+
Then open your browser at [http://localhost:9000](http://localhost:9000)
30+
31+
32+
## Notes
33+
By default this will grab the variables of the running program at the time you load/reload the python-objectviewer page.
34+
35+
If you want to capture the state more precisely you can do something like this in your target program:
36+
37+
```python
38+
# At the start of your program
39+
debugpy.wait_for_client()
40+
41+
# At the point in the code you want to capture
42+
debugpy.breakpoint()
43+
```

pov.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ def render_variable_tree(variables):
4949
if var_type in VARIABLE_TYPES_TO_FILTER:
5050
continue
5151

52+
# Truncate long values
53+
if len(value) > 100:
54+
value = f"{value[:100]} ..."
55+
5256
# Render one node for the variable
5357
with hd.scope(v):
5458
# print(f"DEBUG: Rendering variable: {name} with value: {value}")

0 commit comments

Comments
 (0)