Announcing .NET Interactive - Try .NET includes .NET Notebooks and more
At Microsoft Ignite 2019, we were happy to announce that the "Try .NET global tool" added support for C# and F# Jupyter notebooks. Last week, the same team that brought you .NET Notebooks announced Preview 2 of the .NET Notebook.
Name Change - .NET interactive
As the scenarios for what was "Try .NET" continued to grow, the team wanted to a name that encompassed all the experiences they have as well as all the experiences they will have in the future. What was the Try .NET family of projects is now .NET interactive.
The F# community has enjoyed F# in Juypter Notebooks from years with the pioneering functional work of Rick Minerich, Colin Gravill and many other contributors! .NET Interactive is a family of tools and kernels that offer support across a variety of experiences as a 1st party Microsoft-supported offering.
.NET interactive is a group of CLI (command line interface) tools and APIs that enable users to create interactive experiences across the web, markdown, and notebooks.
.NET Interactive APIs and Tools
Here is what the command line looks like using the dotnet CLI.
dotnet interactiveglobal tool:
- Used for notebooks (Jupyter and nteract). This came out in late 2019.
dotnet tryglobal tool:
- Used for workshops and offline documentation. Interactive markdown with a backing project. I wrote about this in May 2019.
Installing .NET Interactive
You can start playing with it today, locally or in the cloud! Seriously. Just click and start using it.
Before you install the .NET interactive global tool, please make sure you have the following:
- .NET Core 3.1 SDK
- Jupyter : JupyterLab can be installed using Anaconda or
- For more details on how to do this please checkout the offical Jupyter installation guide.
- Open Anaconda Prompt (windows) or Terminal (macOS).
- Verify that Jupyter ins installed and present on the current path.
> jupyter kernelspec list python3 ~\jupyter\kernels\python3
- Open Windows terminal and install the dotnet interactive global tool:
> dotnet tool install --global Microsoft.dotnet-interactive
- Switch back to Anaconda prompt and install the .NET kernel. To be clear, here we are using the dotnet CLI to let the Jupyter CLI know that we exist!
> dotnet interactive jupyter install [InstallKernelSpec] Installed kernelspec .net-csharp in ~\jupyter\kernels\.net-csharp .NET kernel installation succeeded [InstallKernelSpec] Installed kernelspec .net-fsharp in ~\jupyter\kernels\.net-fsharp .NET kernel installation succeeded [InstallKernelSpec] Installed kernelspec .net-powershell in ~\jupyter\kernels\.net-powershell .NET kernel installation succeeded
- While still in Anaconda prompt, verify that .NET kernel is installed like this
> jupyter kernelspec list .net-csharp ~\jupyter\kernels\.net-csharp .net-fsharp ~\jupyter\kernels\.net-fsharp .net-powershell ~\jupyter\kernels\.net-powershell python3 ~\jupyter\kernels\python3
Now you can just run "
jupyter lab" at the command line and you're ready to go!
More Languages - PowerShell
The .NET kernel now comes PowerShell support too! In Preview 2, the .NET interactive team partnered with PowerShell to enable this scenario. You can read more about the announcement of the PowerShell blog.
The .NET interactive team is looking forward to hearing your thoughts. You can talk to them at https://github.com/dotnet/interactive
Multi .NET language Notebooks
I wanted to highlight one of the hidden gems .NET interactive has had since Preview 1 - multi-language notebooks. That means that users can switch languages in a single notebook. Here is an example of a C#, F#, and PowerShell in a single .ipynb file.
Using one of the language magic commands (
#pwsh) tells the .NET Interactive kernel to run the cell in a specific language. To see a complete list of the available magic commands, enter the
#!lsmagic command into a new cell and run it.
.NET Code in nteract.io
Additionally, you can now write .NET Code in nteract.io. Nteract is an open-source organization that builds SDKs, applications, and libraries that helps people make the most of interactive notebooks and REPLs. We are excited to have our .NET users take advantage of the rich REPL experience nteract provides, including the nteract desktop app.
To get started with .NET Interactive in nteract please download the nteract desktop app and install the .NET kernels.
- Try sample .NET notebooks online using Binder. This also allows you try out .NET Interactive daily builds.
- Create and run .NET notebooks on your machine.
- Share your own .NET notebooks with others online using Binder.
- .NET Interactive with nteract
The team is looking forward to seeing what you build. Moving forward, the team has split
dotnet try and
dotnet interactive tools into separate repos.
- For any issues, feature requests, and contributions to .NET Notebooks, please visit the .NET Interactive repo.
- For any issues, feature requests, and contributions on interactive markdown and trydotnet.js, please visit the Try .NET repo.
Sponsor: Have you tried developing in Rider yet? This fast and feature-rich cross-platform IDE improves your code for .NET, ASP.NET, .NET Core, Xamarin, and Unity applications on Windows, Mac, and Linux.