You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is related to #235 but provides for an alternative path. There are instances when users would want to fixup the notebook, so we should provide a way for them to do so.
Right now, if you have a validation error for non-unique cells, you will get a validation error informing you that a cell had a duplicate cell_id, and also the notebook that you passed in will be modified with only the first instance of a non-unique cell. I agree with the approach @Carreau outlines in #235, but want it to be possible to opt-in to fixing the validation errors that are fixable (such as replacing all non-unique cell ids with unique ones). I think it would makes sense to do this via a new repair kwarg that would default to False, and keep with either current behavior, or non-modifying behavior as per #235, but when repair=True we would fix up the errors and do a best effort of massaging the notebook into one that is compliant with a given nbformat version.
The text was updated successfully, but these errors were encountered:
Sorry for the late reply, the problem with the kwarg, and the approach of fixing in validate is the following.
notebook = get_notebook()
notebook_backup = deepcopy(notebook)
do_stuff(notebook) # like for example compute signature.
validate(notebook)
assert notebook_backup == notebook
This is an assumption many codebase do, that validate is not mutating notebook, and that validate()/do_stuff() can be reordered. And no keyword are going to fix that.
This is related to #235 but provides for an alternative path. There are instances when users would want to fixup the notebook, so we should provide a way for them to do so.
Right now, if you have a validation error for non-unique cells, you will get a validation error informing you that a cell had a duplicate cell_id, and also the notebook that you passed in will be modified with only the first instance of a non-unique cell. I agree with the approach @Carreau outlines in #235, but want it to be possible to opt-in to fixing the validation errors that are fixable (such as replacing all non-unique cell ids with unique ones). I think it would makes sense to do this via a new
repair
kwarg that would default toFalse
, and keep with either current behavior, or non-modifying behavior as per #235, but whenrepair=True
we would fix up the errors and do a best effort of massaging the notebook into one that is compliant with a given nbformat version.The text was updated successfully, but these errors were encountered: