-
Notifications
You must be signed in to change notification settings - Fork 7
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
Provide more metadata for HDF5 types #85
Conversation
@@ -123,7 +123,74 @@ def parse_slice_member(slice_member: str) -> Union[slice, int]: | |||
|
|||
|
|||
def sorted_dict(*args: Tuple[str, Any]): | |||
return dict(sorted(args)) | |||
return dict(sorted(args, key=lambda entry: entry[0])) |
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.
Sorting on the first item of each tuple only (i.e. the future dictionary keys) to avoid errors with nested dictionaries.
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 all right to me !
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.
LGTM!
No issue for me to break the REST API, since jupyterlab-h5web pinpoints h5grove version it's using.
Just need to make a major release next time.
I've added a test that covers all the advanced types (vlen, array, ref, enum, etc.) and I've updated the API schema. |
47c65de
to
69ac664
Compare
The new snapshot test of
H5GroveApi
in H5Web reveals that a lot of advanced HDF5 types are incorrectly parsed or simply marked as unknown.This is due to the fact that h5grove's
/meta/
endpoint currently provides only a very basicdtype
string (or dict ofdtype
strings for compound datasets), which is not sufficient and sometimes inaccurate (e.g.|O
for variable-length ASCII strings instead of|S
).Following h5py's low-level API and taking inspiration from h5wasm, I modify the dataset/attribute metadata response to include a
type
dictionary with all the interesting information about the dataset/attribute's HDF5 type.Unfortunately, the
type
property was already used for the entity kind ("dataset", "group", etc.). I've renamed the existing property tokind
to match what we do in H5Web. I've also moved the previousdtype
property inside the newtype
dictionary (I think it's still worth keeping, as some applications may prefer to avoid parsing the full type metadata). Of course, these are both breaking changes for h5grove, which is not ideal. I'm open to suggestions if that's a no-go.