Repository navigation
Run notebook post-processors on every open and save - #116
Merged
Merged
Conversation
Post-processors were only run by the VS Code host and by verso convert on open. The browser editor that verso serve starts skipped them when opening a file, opening from content, and saving, and so did verso run, verso export, and the REPL's startup load, .load, .save and .convert. The same file and extensions therefore produced a different notebook depending on where it was opened: an extension's documented hook had no effect, and the built-in Jupyter post-processors never ran, so a .NET Interactive notebook's #!fsharp or #!sql cells stayed C# cells in the browser and ran as C# under verso run. A shared helper now runs the matching post-processors (CanProcess true, in Priority order) after every deserialize and before every serialize, and every host goes through it. The native format is still reported to post-processors as verso-native on save, as the VS Code host did, so existing processors see no change there. verso convert also now runs PreSerializeAsync before writing its output, since that is a save. Tests cover the browser editor's open, open-from-content and save paths, and verso run on a Polyglot notebook; each fails on the previous code. Fixes #113. Signed-off-by: Torrey Betts <[email protected]>
Closed
1 of 2 tasks
SummarySummary
CoverageVerso - 82.1%
Verso.Abstractions - 84.2%
Verso.Ado - 81.4%
Verso.Blazor - 30.9%
Verso.Blazor.Shared - 61.9%
Verso.Cli - 41.4%
Verso.DataFrame - 82.3%
Verso.FSharp - 81.9%
Verso.Host - 56%
Verso.Http - 74.7%
Verso.JavaScript - 52.7%
Verso.PowerShell - 64.7%
Verso.Python - 78.1%
Verso.Sample.Diagram - 80.1%
Verso.Sample.Dice - 82.2%
Verso.Sample.Slides - 58.8%
Verso.Sample.Sparkline - 67.3%
Verso.Testing - 79.7%
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Post-processors were only run by the VS Code host and by verso convert on open. The browser editor that verso serve starts skipped them when opening a file, opening from content, and saving, and so did verso run, verso export, and the REPL's startup load, .load, .save and .convert. The same file and extensions therefore produced a different notebook depending on where it was opened: an extension's documented hook had no effect, and the built-in Jupyter post-processors never ran, so a .NET Interactive notebook's #!fsharp or #!sql cells stayed C# cells in the browser and ran as C# under verso run.
A shared helper now runs the matching post-processors (CanProcess true, in Priority order) after every deserialize and before every serialize, and every host goes through it. The native format is still reported to post-processors as verso-native on save, as the VS Code host did, so existing processors see no change there. verso convert also now runs PreSerializeAsync before writing its output, since that is a save.
Tests cover the browser editor's open, open-from-content and save paths, and verso run on a Polyglot notebook; each fails on the previous code. Fixes #113.