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
Possibility to control the link access/creation property lists from the high level interface #2257
Comments
possible implementation in #2258 |
Thanks! Could you remind me why you're interested in this? I have a vague memory that we discussed it already, but I don't remember where. HDF5's property lists are sort of like a workaround for C not having keyword arguments or optional arguments. So the h5py high-level API has tended to expose them as Python keyword arguments rather than expecting the user to create and pass around property list wrappers directly. (Of course, if you use the low-level API, you will be working with property list objects). I'd be interested to work out if we can stick to that pattern here. |
the problem is the default lapl has read/write access mode set. so even if you open a file with mode="r", if you access an external link, the file pointed to by this link will be opened with mode read/write (if file permissions are allowing it). |
It would seem reasonable to me to have externally referenced files default to whatever mode closest matches the the mode of the main one (with some option to override the mode separately at the high level). |
I agree that that makes sense, but I'm also confused - the HDF5 docs suggest that this should already be the default:
And h5py doesn't seem to override that: Lines 129 to 135 in 06d9d0d
Am I missing somewhere that we're setting that to something different? Or is this a bug? (I'm more and more convinced that making references to separate files transparent, as external links, external datasets or virtual datasets, is a mistake. 🤔 ) |
At least for me, following an external link from a read-only file seems to do the right thing (the second file is also read-only):
|
My bad: I got it wrong, let me reformulate. The problem is when you want to modify a file that contains external links to other files that you know wont be modified. For example, let's copy a dataset from an external file via a link:
In that example, the file
Currently, one way to achieve this is to make the file |
Thanks, that makes more sense now. 🙂
This looks nicer as a high-level API than the rather cryptic |
Currently, link access/creation property lists are global instances created when loading the library via
default_lapl
/default_lcpl
.It would be cool if individual groups could have the possibility to override these properties. Ideally, these properties would be passed on to groups returned by
__getitem__
One possible implementation would be to be to override the properties
_lapl
and_lcpl
inGroup
: they would default to the global property lists and use the ones optionally provided in the constructor.The
__init__
function ofGroup
andFile
would then need to be modified by adding 2 optional arguments:lapl
andlcpl
. The rest of the library should not be affected. By default, the behavior of the library should be unchanged.The text was updated successfully, but these errors were encountered: