Validate notebooks once per fetch or save #724
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some prior network analyses found that each fetch and save of a notebook file resulted in double validation, presumably so the server could set a helpful message on the notebook model returned to the user since the validation performed within
nbformat
's read or write methods did not return any indication of a validation error.nbformat
was recently updated to enable applications to ask for validation error status on the initial read/write calls, thereby enabling notebook to skip its second call to validate the notebook. This pull request leverages those updated signatures now available innbformat 5.2.0
.The existing
validate_notebook_model()
, however, will still callnbformat.validate()
if aNone
validation_error
parameter is provided. This was done in order to preserve existing functionality from potential calls by server extensions. The message generation code is shared by both by raising the exception present in thevalidation_error
dictionary.(The CI failures do not appear to be related to these changes.)