-
-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Group.tree method #2433
Added Group.tree method #2433
Conversation
5949610
to
f844ce6
Compare
There was a
If we're OK with those limitations then this should be good to go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @TomAugspurger!
async def group_tree_async(group: AsyncGroup, max_depth: int | None = None) -> TreeRepr: | ||
tree = rich.tree.Tree(label=f"[bold]{group.name}[/bold]") | ||
nodes = {"": tree} | ||
members = sorted([x async for x in group.members(max_depth=max_depth)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @d-v-b who is looking at making this faster 🚀
A simple object with a tree-like repr for the Zarr Group. | ||
|
||
Note that this object and it's implementation isn't considered part | ||
of Zarr's public API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Adds a
Group.tree
method for pretty printing a hierarchy.For now the old
expand
keyword, which I think controlled whether the tree was expanded by default in the HTML output, is not implemented.We have one design choice to make: should
.tree
return an object with a custom__repr__
, or should it return the string itself? My preference, implemented here, is returning the object. That makes it easier to pipe into other applications other than the Python REPL. The cost is a bit more expansion of the public API.Closes #2406