hdmf icon indicating copy to clipboard operation
hdmf copied to clipboard

[Feature]: Call set_modified at the end of field setter methods to make appending easier

Open rly opened this issue 10 months ago • 2 comments

What would you like to see added to HDMF?

Currently, when appending a group or dataset (and probably also links and maybe attributes?) to existing files, the user needs to open the file in append mode, set the field that doesn't exist yet on the parent container, and call AbstractContainer.set_modified on the parent container, and then call io.write(file). Calling set_modified seems like an unnecessary extra step for the user. It should just be called every time a field is set to a new value.

See https://github.com/NeurodataWithoutBorders/pynwb/pull/2032#issuecomment-2641001159

What solution would you like?

Change the field setter in AbstractContainer: https://github.com/hdmf-dev/hdmf/blob/dev/src/hdmf/container.py#L83-L91 to call self.set_modified() at the end.

Do you have any interest in helping implement the feature?

Yes.

rly avatar Feb 07 '25 08:02 rly

@rly Is this something we want to implement for the next release?

mavaylon1 avatar Feb 20 '25 19:02 mavaylon1

Yes

rly avatar Feb 20 '25 19:02 rly