-
Notifications
You must be signed in to change notification settings - Fork 521
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
API: raise if kwds are ignored in require_dataset #897
Conversation
This raises if user kwds will be silently ignored.
I feel this should be a warning rather than an exception, as I'm not sure why someone would use |
Perhaps as a way to make sure the existing dataset is compatible with the one intended to be used/extended/overwritten? I have to acknowledge I did not understand the idea behind the PR until reading your post. If the idea is to make sure the required dataset is compatible with what it was requested and therefore expected by the user, then I think the idea to raise an exception makes perfect sense. |
BTW, what is the behavior of HDF5 itself? |
@vasole If I feel that warning is a change which avoids breaking anything while also highlighting potential problems, while we decide what the correct behaviour (and intent) should be. |
Punting to next release. |
I don't think this makes sense as-is. If you know the dataset shouldn't already exist, you'd use Perhaps instead we could do some combination of:
|
I'm dropping the 2.10 milestone for this, as it hasn't been changed for a long time, and I think there are issues with it as stands. |
Do we want to make any backward-incompatible changes to require_dataset for 3.0? E.g. checking more parameters against the existing dataset? I'm in favour of leaving it as is. Shape and dtype are the fundamental properties of a dataset. If we start checking more properties of existing datasets, I don't think there's any good reason not to check all specified properties, and that sounds like it would be hard to get right - e.g. if you specify gzip compression with the default level, and the existing dataset has a different compression level, should it throw an error? I'd say leave it up to application code to check the specific things it cares about. |
Coming back to this, I suspect the right path forward is start checking the extra kwargs and seeing if they match the settings on the dset and raise if That would still leave the case that started me down this path 5 years ago un-resolved (as with a bit more hind-sight being able to provide a fill dataset that is non-constant may be useful). |
I'm inclined to say it's not worth it - it's not clear to me precisely what it's useful to check (e.g. issue #2018, and my last comment), and this PR has hung around for years without generating any enthusiasm. None of the links from other issues are 'this PR would solve the problem you describe'. Maybe we just accept that If you do still want to check more inputs, a new |
Yeah, I think I'm going to give up on this one 😞 I agree that any changes that would make me happy would be quite backwards incompatible and the work required to make them opt-in is just not worth it. |
This raises if user kwds will be silently ignored.
This is prompted by a mailing list question about automatically resizing when I noticed the new data is simply ignored!
A better solution may be to check all of the kwargs?
A less disruptive change would be to put a huge warning in the docstring.