marimo-team / marimo

A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git.
https://marimo.io
Apache License 2.0
8.05k stars 290 forks source link

Wrap list and dictionary output #2977

Open wasimsandhu opened 3 days ago

wasimsandhu commented 3 days ago

Description

The values for my dictionary keys are really long and it's awkward to scroll a string horizontally to read it.

Suggested solution

Can cell outputs for lists and dictionaries be wrapped by default?

Alternative

A toggle in the cell output (or context menu) to wrap cell output.

Additional context

No response

mscolnick commented 3 days ago

Without viewing long lists all that much, i feel like not wrapping as the default seems better. It is more often you are aren't look at all the values and i think it would clutter up the output area in every case, instead of just when you want to read it. Open to change my mind if you can share some examples.

wasimsandhu commented 3 days ago

I agree that it would make scanning all key-values harder if wrapped by default. A toggle in the right hand corner would be better then.

I can't share my actual data, but I am dealing with tables with 100+ columns, and each column has lots of text. This is what it looks like when I try to view a selected row as a dict:

Image

It would be really helpful if it was wrapped, similar to what viewing a large JSON document in a web page looks like.

mscolnick commented 3 days ago

Yea, this can be hard to parse, maybe we can support different views. You can check out https://jsonhero.io/ for some inspiration

wasimsandhu commented 3 days ago

I was thinking a "Wrap text" toggle on the right hand corner would suffice for my use case. Can open a PR later this week if so, otherwise we can scope it out some more