Skip to content

Python object inspector for the Jupyter Notebook #7873

Open
@allefeld

Description

@allefeld

I'm not entirely sure this is the right place, if not sorry & please redirect me.
It is a mixture between a feature suggestion and a request for comments.

When working with JavaScript, I very much appreciate the object inspector that comes with Chrome's Developer Tools Console:
image

I think it would be great to have something like that for use within a Python notebook.
So I started to make a very rough draft:
inspector

This draft implementation creates HTML for the nested list and shows it using IPython.display.HTML. It also injects some CSS for styling and JavaScript to make list items expandable / collapsable. So far so good.

The problem is that Python object hierarchies are huge (actually infinite, because every object's __class__ is also an object with a __class__, etc.), so I have to limit the hierarchy to a few levels.

A better approach would be to dynamically generate subtrees when items are expanded. For that I would need to make the Python implementation aware of JavaScript click events. I tried ipyevents, but it does not give event target information, and the required ipywidgets.HTML (instead of IPython.display.HTML) apparently messes with my CSS & JS.

Questions:

  • Just to be sure, no such interactive object inspector exists yet, right? I checked but I may have missed something. There is the variable inspector extension, but it doesn't allow exploring object hierarchies in the way I have in mind.

  • What would be the most straightforward way to send detailed JS event information to Python, or to request additional HTML elements from Python? I know that an extension could do this, but is there a way short of that complexity?

  • Any other comments / recommendations?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions