Description
The primary reason for the experimental file format supported by .NET Interactive Notebooks is that there are a few design decisions to be worked out to enable the Microsoft Python extension for Visual Studio Code and the .NET Interactive Notebooks extension to work well together. Until a design is agreed upon, we want to avoid introducing potential compatibility issues into .ipynb
.
Here are some of the challenges:
- There is not an agreed-upon convention for polyglot notebooks in the
.ipynb
file format that also takes into account:- single-process polyglot kernels, and
- multiple kernels (whether polyglot or not) within a single notebook.
- There isn't currently a clear way to indicate which VS Code extension should handle a given .
ipynb
file, and Python clearly takes precedence.
I'd like to get people's thoughts on the experimental .dib
file format (example below) that the .NET Interactive Visual Studio Code extension supports.
.ipynb
is also supported, as well as conversion between the two.
These are the goals we've had in mind that led to the current state of the design:
-
It should be trivial to author and read in a simple text editor without special tooling and without concern about escaping, e.g. not JSON, XML, etc.
-
It should be copy-pasteable between different contexts, e.g. a bare script file, a notebook cell, or another .NET Interactive host (e.g. https://github.com/CodeConversations/CodeConversations)
-
It should be able to contain multiple languages, including languages not yet supported by .NET Interactive.
-
It should be amenable to a good tooling experience, including completions and other language services even when multiple languages are present.
-
It should be able to be opened as a notebook (as currently implemented by the .NET Interactive VS Code extension).
-
It should be executable as an automation script. In the simple case this need not be a polyglot script, but it should be able to take advantage of the full capabilities of .NET Interactive, e.g. magic commands, NuGet support, extensibility, variable sharing.
-
When in automated mode, it should be able to advertise and consume command line arguments in a readable, simple-to-author manner.
-
When in interactive mode (e.g. notebook, REPL), the command line inputs should be able to be collected from the user via a prompt or trivially configured inline the code.
-
Here's a simple example of the format:
#!powershell
Write-Output "Hello from PowerShell!"
#!fsharp
let hello = "Hello from F#"
hello |> Console.WriteLine
#!csharp
#r "nuget:Humanizer,2.8.1"
using Humanizer;
#!share --from fsharp hello
Console.WriteLine(hello.Replace("F#", "C#").Transform(To.TitleCase));