Skip to content

Add B2Info Script for instant container inspection - #803

Open
nikprasa31 wants to merge 2 commits into
Blosc:mainfrom
nikprasa31:b2info
Open

nikprasa31 wants to merge 2 commits into
Blosc:mainfrom
nikprasa31:b2info

Conversation

@nikprasa31

@nikprasa31 nikprasa31 commented Nov 17, 2026 •

Copy link
Copy Markdown

Closes #716

About the changes

The b2info Script helps us quickly inspect containers of type: .b2nd (NDArray), .b2frame (SChunk), .b2d (DictStore), .b2z (TreeStore)
without decompressing data.

Arguments

  1. Default output Shows the summary of the container, for examples please refer : doc/guides/b2info.md
    b2info <path>
  2. Tree output (--tree): For TreeStore helps us visualize the hierarchy of the nodes and for DictStore helps list out the keys
    for example for DictStore
    b2info store.b2d --tree

TreeStore

b2info tree.b2z --tree
type     : TreeStore
urlpath  : tree.b2z
mode     : r
format   : b2z
entries  : 7
contents : /
           ├── labels
           └── sim
               ├── run1
               │   ├── pressure
               │   └── velocity
               └── run2
                   └── pressure

DictStore

type     : DictStore
urlpath  : store.b2d
mode     : r
format   : b2d
entries  : 3
contents : /big
           /small
           /temps
  1. Attributes(--attrs): Adds the user attributes/ metadata to output.
    b2info store.b2d --attrs

  2. JSON (--json): Converts the output to JSON. While converting attrs to json, added support for certain types such as bytes, NaN etc on how they will be converted to json values
    b2info store.b2d --json

Errors

Follow error cases are covered

  1. path doesnt exists
  2. Non Blosc2 file
  3. Remote URL
  4. Using --tree on an NDArray or SChunk, which have no hierarchy

AI Usage Policy

AI disclosure: AI was used to draft code, documentation and test scenarios. Have personally reviewed, understood every change. PR description is written by self.

@FrancescAlted FrancescAlted left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is looking good. Some suggestions:

  • Try to handle invalid .b2z files without a traceback. Catch it and add a --json regression test that checks exit code 1, empty stdout, and a short stderr message.
  • Don’t build the tree unless --tree is requested. Make the default text summary count the same visible entries without sorting or rendering them.

Finally, one smaller JSON suggestion: escape user dictionaries containing __type__ with the existing tagged dict encoding. Otherwise a real dictionary like {"__type__": "bytes", "base64": "YQ=="} is indistinguishable from encoded bytes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UTILS] Implement b2info CLI tool for instant container inspection

2 participants