-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add support for h5py >=3.0.0. #411
Conversation
Codecov Report
@@ Coverage Diff @@
## master #411 +/- ##
==========================================
- Coverage 76.40% 76.35% -0.05%
==========================================
Files 45 45
Lines 7136 7139 +3
==========================================
- Hits 5452 5451 -1
- Misses 1684 1688 +4
Continue to review full report at Codecov.
|
Hi!
environment.yml
and I get the same error from pytest. |
Sounds like the takeaway is that this works except for the known issue in #281. I appreciate the extensive testing! |
@bdice Ah, OK I wasn't sure if that error was already known, but I should've checked the issues first! Haha, I don't know about extensive testing. :) I'm not sure how to check that strings are working correctly. (I assuming that I should test if strings work as statepoint keys/values?) I tried:
and it seemed to work fine with both versions of h5py. Is there a better way to test? |
@jennyfothergill signac uses h5py for the H5Store class. This can be accessed with |
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. I'm still not sure if I'm checking this correctly, but with h5py==2.10 and h5py>=3 both print <class 'str'>
:
from signac import H5Store
with H5Store('file.h5') as h5s:
h5s['foo'] = 'bar'
print(type(h5s.foo))
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! Thanks Jenny for that thorough review!
Description
This PR adds support for h5py major version 3 and should be merged before #409 (to show that the code functions both before and after the upgrade).
The h5py package changed its default handling of strings in version 3. See this page for info: https://docs.h5py.org/en/latest/strings.html
This PR adds a shim to detect string data, so that it can be returned as
str
and notbytes
. I tested this locally with h5py 2.10.0 and 3.0.0, and it should work for older versions of h5py as well (that's why I used the older functioncheck_dtype
instead ofcheck_string_dtype
, which was added in 2.10).Types of Changes
1The change breaks (or has the potential to break) existing functionality.
Checklist:
If necessary:
Example for a changelog entry:
Fix issue with launching rockets to the moon (#101, #212).