Support nested objects/recursion in `mo.inspect`

Open
#11,071 3 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@kirangadhave is already working on this.

Since Oct 2, 2026.

Assessment

This issue has not been assessed yet.

Description

enhancement needs discussion
Description

mo.inspect is one of my favourite underrated marimo features. However, quite often I'm dealing with lists of objects, for which inspect just prints the default representation for each child. It'd be great to be able to expand nested objects to view their details in the same way.

Simple example code:

class Point:
    def __init__(self, x: float, y: float):
        self.x = x
        self.y = y


class Line:
    def __init__(self, p1: Point, p2: Point):
        self.p1 = p1
        self.p2 = p2

    @property
    def length(self) -> float:
        return ((self.p2.x - self.p1.x) ** 2 + (self.p2.y - self.p1.y) ** 2) ** 0.5


lines = [Line(Point(0, 0), Point(i, i)) for i in range(5)]

mo.inspect(lines)

Current marimo output:

Image

For reference, I am thinking of something similar to the console.log implementation of most browsers, e.g. Chrome:

Image

Firefox:

Image
Are you willing to submit a PR? (You must receive approval from the team before submitting a PR.)
  • Yes
Alternatives

No response

Additional context

No response

Dominant language
Python
Stars
22.9k
Forks
1.3k
Avg merge
1d 10h
Merged PRs (30d)
380

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from marimo-team/marimo

All issues in marimo-team/marimo

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.