Skip to main content

This package adds python support to the Debug Visualizer.

Installation Instructions

The Debug Visualizer is required. To install the extension for python, your're required to install the package within your debug enviroment:

pip install vscodedebugvisualizer

supported Types

Numpy Array / PyTorch Tensors / Tensorflow Tensors

All Tensors are converted to numpy arrays and treated alike.

If there multiple dimensions only the last 2 dimensons are visualized, the longer dimension ist treated as x axis. The X axe is downsampled to 1000 points and the y axe only shows the first 10 rows.

Dataframes

Dataframes are transformed to data tables.

Add your own representation/data extractor

Asuming you have a specific Type in your project you want to visualize. You can create a file debugvisualizer.py in your project root directory, that will be injected into the debug process.

Asuming we want to visualize the class Person:

class Person:
    def __init__(self, name, parents=None) -> None:
        self.name = name
        self.parents = [] if parents is None else parents

    def addParent(self, parent: "Person"):
        self.parents.append(parent)

In debugvisualizer.py you can access all available visualizer with the from vscodedebugvisualizer import globalVisualizationFactory. To support your Type you need to create an class that has checkType(anytype) -> Boolean and visualize(self, data) -> None defined. checkType should return True if the given object is supported by the Visualizer. visualize returns a json string that is supported by the visualizer client (see playground).

Finally you need to add the visualizer to the globalVisualizationFactory with globalVisualizationFactory.addVisualizer(YourVisualizer()).

For the Person-Example:

from Person import Person
from pandas.io import json
from vscodedebugvisualizer import globalVisualizationFactory


class PersonVisualizer:
    def checkType(self, t):
        """ checks if the given object `t` is an instance of Person """
        return isinstance(t, Person)

    def visualizePerson(self, person: Person, nodes=[], edges=[]):
        if person.name in [n["id"] for n in nodes]:
            return nodes, edges

        nodes.append(
            {
                "id": person.name,
                "label": person.name,
            }
        )

        for p in person.parents:
            nodes, edges = self.visualizePerson(p, nodes, edges)
            edges.append(
                {
                    "from": p.name,
                    "to": person.name,
                }
            )

        return nodes, edges

    def visualize(self, person: Person):
        jsonDict = {
            "kind": {"graph": True},
            "nodes": [],
            "edges": [],
        }

        self.visualizePerson(person, jsonDict["nodes"], jsonDict["edges"])

        return json.dumps(jsonDict)


globalVisualizationFactory.addVisualizer(PersonVisualizer())

For more visualization examples check out the visualizer playground

Metadata

Release files for vscodedebugvisualizer 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vscodedebugvisualizer 0.2.1
File Size Uploaded Provenance Actions
vscodedebugvisualizer-0.2.1.tar.gz 11.0 kB Without provenance Details for vscodedebugvisualizer-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vscodedebugvisualizer 0.2.1
File Interpreter ABI Platform Actions
vscodedebugvisualizer-0.2.1-py3-none-any.whl Python 3 none any Details for vscodedebugvisualizer-0.2.1-py3-none-any.whl

Total release size: 24.6 kB

Release files / vscodedebugvisualizer-0.2.1.tar.gz

Download URL vscodedebugvisualizer-0.2.1.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
715b16fe44dcf179f621bae13792a7552a32700b82c52cc18d371b3f991e48b4
BLAKE2b-256 checksum
How to use checksums
981578ba826da84318fcddeca4c01cd43e26865105bb33223fcab1b12326da37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / vscodedebugvisualizer-0.2.1-py3-none-any.whl

Download URL vscodedebugvisualizer-0.2.1-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
593a16d77c313b93471cfa7a4701b479c6aebbe6f27f7dc7f446db9c811e2ed7
BLAKE2b-256 checksum
How to use checksums
b6c45ecc7e1b8abb6258a9c5d38673435e1d0800e8d62c377d629af0f2b16d04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Security for vscodedebugvisualizer 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page