Python Debug Visualizer - Automatic data structure visualization for VS Code debugging
Project description
pydebugvisualizer
Python Debug Visualizer - Automatic data structure visualization for VS Code debugging.
Installation
pip install pydebugvisualizer
For data science support:
pip install pydebugvisualizer[datascience]
Supported Data Types
Built-in Types
list- Tree, table (for list of dicts), grid (for 2D lists)dict- Tree, table (for dict of dicts), key-value tableset,frozenset- Grid, treetuple- Grid, treestr- Text with syntax highlighting, JSON parsing
Data Science (optional)
- NumPy
ndarray- Line plots, heatmaps, grids - Pandas
DataFrame,Series- Tables, line plots - Matplotlib figures - PNG/SVG images
Custom Data Structures
The analyzer automatically detects:
- Linked lists (singly and doubly linked)
- Binary trees
- N-ary trees
- Graphs
Custom Visualization Protocol
Define __visualize__() on your classes to provide custom visualization:
class BinaryTree:
def __init__(self, value, left=None, right=None):
self.value = value
self.left = left
self.right = right
def __visualize__(self):
def build_node(node):
if node is None:
return {"items": [{"text": "∅"}], "children": []}
return {
"items": [{"text": str(node.value)}],
"children": [
build_node(node.left),
build_node(node.right)
]
}
return {
"kind": {"tree": True},
"root": build_node(self)
}
Visualization Schemas
The __visualize__() method should return a dict with one of these formats:
Tree
{
"kind": {"tree": True},
"root": {
"items": [{"text": "Node Label", "emphasis": "style1"}],
"children": [...] # Nested tree nodes
}
}
Graph
{
"kind": {"graph": True},
"nodes": [
{"id": "1", "label": "Node 1", "color": "#ff0000"},
{"id": "2", "label": "Node 2"}
],
"edges": [
{"from": "1", "to": "2", "label": "edge"}
]
}
Table
{
"kind": {"table": True},
"rows": [
{"col1": "value1", "col2": "value2"},
{"col1": "value3", "col2": "value4"}
]
}
Grid
{
"kind": {"grid": True},
"columnLabels": [{"label": "A"}, {"label": "B"}],
"rows": [
{"label": "Row 1", "columns": [{"content": "1"}, {"content": "2"}]}
]
}
Plotly Chart
{
"kind": {"plotly": True},
"data": [{"type": "scatter", "x": [1,2,3], "y": [4,5,6]}],
"layout": {"title": "My Chart"}
}
Text
{
"kind": {"text": True},
"text": "Hello, World!",
"fileName": "example.py" # Optional, for syntax highlighting
}
Image (PNG)
{
"kind": {"imagePng": True},
"base64Data": "iVBORw0KGgo..." # Base64 encoded PNG
}
SVG
{
"kind": {"svg": True},
"text": "<svg>...</svg>"
}
Extending with Custom Extractors
from pydebugvisualizer import BaseExtractor, register_extractor, ExtractionCandidate, ExtractorPriority
class MyExtractor(BaseExtractor):
@property
def id(self):
return "custom.mytype"
@property
def name(self):
return "My Custom Type"
@property
def priority(self):
return ExtractorPriority.HIGH
def can_extract(self, value, context):
return isinstance(value, MyClass)
def get_extractions(self, value, context):
return [ExtractionCandidate(
extractor_id=self.id,
extractor_name=self.name,
priority=self.priority,
extract=lambda: {"kind": {"text": True}, "text": str(value)}
)]
# Register the extractor
register_extractor(MyExtractor())
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydebugvisualizer-0.1.0.tar.gz.
File metadata
- Download URL: pydebugvisualizer-0.1.0.tar.gz
- Upload date:
- Size: 22.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4610dfcc13e0c892bdb4bf5a5430276147a7ee529ceb870fbec976fa4b076eed
|
|
| MD5 |
598f49b821ce3588d01dd66e94c290fd
|
|
| BLAKE2b-256 |
2580cb17076e05d7323455c9ba88aec28ee22918502f0dffa50f2005d48eac98
|
File details
Details for the file pydebugvisualizer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pydebugvisualizer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37ee79dad10a5a8d130e350c4cb08f039809e76733039ab6194a8efd6a8976e9
|
|
| MD5 |
c2e748212f605370800cdaf322191643
|
|
| BLAKE2b-256 |
7288376f70c686f1d6b3a4bbc3a772151e9bd9f3271dc1b019a699859d69c02b
|