Skip to content

Conversation

@ivilata
Copy link
Collaborator

@ivilata ivilata commented Mar 13, 2024

This extends the work in #28 with on-the-fly translation of attributes in HDF5 datasets. The msgpacked attributes are cached for efficiency. Preliminary tests have been performed with basic attributes like strings, but the machinery may need extra work for other attribute types (as is the case with cat2import, which now shares code with this).

@ivilata ivilata requested a review from FrancescAlted March 13, 2024 08:38
@ivilata ivilata self-assigned this Mar 13, 2024
@github-actions
Copy link

github-actions bot commented Mar 13, 2024

Qodana for Python

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

Copy link
Member

@FrancescAlted FrancescAlted left a comment

Choose a reason for hiding this comment

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

Looks pretty good. I have some comments. In particular, can you try with https://github.com/lebedov/msgpack-numpy and see if that would support attributes like in h5py? Thanks!

# This small workaround avoids Blosc2's strict type packing,
# so we can handle value subclasses like `numpy.bytes_`
# (e.g. for Fortran-style string attributes added by PyTables).
pvalue = msgpack.packb(avalue, default=blosc2_ext.encode_tuple)
Copy link
Member

Choose a reason for hiding this comment

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

This can handle most of the Python values, but NumPy objects are not supported. May be using https://github.com/lebedov/msgpack-numpy could be a solution here?

Copy link
Member

Choose a reason for hiding this comment

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

Can you do a test with https://github.com/lebedov/msgpack-numpy and see if that would work for Caterva2?

Copy link
Member

Choose a reason for hiding this comment

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

Better merge this first and do this in another PR

Copy link
Member

@FrancescAlted FrancescAlted left a comment

Choose a reason for hiding this comment

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

Better merge this and tackle further development later on.

@ivilata ivilata merged commit 6953ac2 into main Mar 13, 2024
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.

3 participants