宣布.NET Jupyter Notebooks

Jupyter Notebooks has been the significant player in the interactive development space for many years, and Notebooks have played a vital role in the continued popularity of languages like Python, R, Julia, and Scala. Interactive experiences like this give users with a lightweight tool (I like to say "interactive paper") for learning, iterative development, and data science and data manipulation.

多年来,Jupyter Notebook在交互式开发领域一直是重要的参与者,并且在Python,R,Julia和Scala等语言的持续流行中,Notebook发挥了至关重要的作用。 这样的交互式体验为用户提供了一个轻量级的工具(我喜欢说“交互式纸”),用于学习,迭代开发以及数据科学和数据操作。

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!

Rick Minerich Colin Gravill和许多其他贡献者的开创性工作中 F#社区多年来一直在Juypter Notebooks中享受F#

As Try .NET has grown to support more interactive C# and F# experiences across the web with runnable code snippets, and an interactive documentation generator for .NET Core with the dotnet try global tool, we're happy to take that same codebase to the next level, by announcing C# and F# in Jupyter notebooks.

随着Try .NET通过可运行的代码片段支持Web上更多的交互式C#和F#体验,以及使用dotnet try全局工具的.NET Core交互式文档生成器,我们很高兴将相同的代码库扩展到下一个级别,通过在Jupyter笔记本中宣布C#和F#。

.NET在Jupyter Notebooks中 (.NET in Jupyter Notebooks)

Even better you can start playing with it today, locally or in the cloud!


.NET在本地的Anaconda中 (.NET in Anaconda locally)

安装.NET内核 (Install the .NET Kernel)

Please note: If you have the dotnet try global tool already installed, you will need to uninstall the older version and get the latest before grabbing the Jupyter kernel-enabled version of the dotnet try global tool.

请注意:如果您已经安装了dotnet try全局工具,则在获取启用了Jupyter内核功能的dotnet try全局工具之前,需要卸载较旧的版本并获取最新版本。

  • Check to see if Jupyter is installed


    jupyter kernelspec list

    jupyter kernelspec list

  • Install the .NET kernel!


    dotnet try jupyter install

    dotnet try jupyter install

    dotnet try jupyter install
  • Test installation


    jupyter kernelspec list

    jupyter kernelspec list

    You should see the .net-csharp and .net-fsharp listed.


jupyter kernelspec list
  • To start a new notebook, you can either type jupyter lab Anaconda prompt or launch a notebook using the Anaconda Navigator.

    要启动新笔记本,您可以键入jupyter lab Anaconda提示符,也可以使用Anaconda Navigator启动笔记本。

  • Once Jupyter Lab has launched in your preferred browser, you have the option to create a C# or a F# notebook

    在首选浏览器中启动Jupyter Lab后,您可以选择创建C#或F#笔记本

.NET C# and F# in Jupyter Notebooks
  • Now you can write .NET and and prose side by side, and just hit Shift-Enter to run each cell.


    Example C# code in Jupyter Notebooks

For more information on our APIs via C# and F#, please check out our documentation on the binder side or in the dotnet/try repo in the NotebookExamples folder.

有关通过C#和F#提供的API的更多信息,请在资料一侧或NotebookExamples文件夹中的dotnet / try存储库中查看我们的文档。

C# and F# samples and docs

特征 (Features)

To explore some of the features that .NET notebooks ships with, I put together dashboard for the Nightscout GitHub repo.

为了探究.NET笔记本电脑附带的某些功能,我为Nightscout GitHub存储库放了一块仪表板。

HTML output : By default .NET notebooks ship with several helper methods for writing HTML. From basic helpers that enable users to write out a string as HTML or output Javascript to more complex HTML with PocketView. Below I'm using the display() helper method.

HTML输出:默认情况下,.NET笔记本随附了一些用于编写HTML的辅助方法。 从基本的帮助程序开始,这些帮助程序使用户可以将字符串写为HTML或将Javascript输出到使用PocketView的更复杂HTML。 下面我正在使用display()辅助方法。


Importing packages : You can load NuGet packages using the following syntax. If you've used Rosyln-powered scripting this #r for a reference syntax will be familiar.

导入软件包:您可以使用以下语法加载NuGet软件包。 如果您使用的是Rosyln支持的脚本,则应该很熟悉#r的参考语法。

#r "nuget:<package name>,<package version>"

#r "nuget:<package name>,<package version>"

For Example


#r "nuget:Octokit, 0.32.0"
#r "nuget:NodaTime, 2.4.6"
using Octokit;
using NodaTime;
using NodaTime.Extensions;
using XPlot.Plotly;

Do note that when you run a cell like this with a #r reference that you'll want to wait as that NuGet package is installed, as seen below with the ... detailed output.


installing nuget packages in Jupyter Notebooks

Object formatters : By default, the .NET notebook experience enables users to display useful information about an object in table format.


The code snippet below will display all opened issues in the nightscout/cgm-remote-monitor repo.

下面的代码段将显示nightscout / cgm-remote-monitor存储库中所有打开的问题。

display(openSoFar.Select(i => new {i.CreatedAt, i.Title, State = i.State.StringValue,  i.Number}).OrderByDescending(d => d.CreatedAt));

With the object formatter feature, the information will be displayed in a easy to read table format.


Querying the Nightscout repository

绘图 (Plotting )

Visualization is powerful storytelling tool and,a key feature of the Jupyter notebook experience. As soon as you import the wonderful XPlot.Plotly F# Visualization Package into your notebooks(using Xplot.Ploty;) you can begin creating rich data visualizations in .NET.

可视化是强大的讲故事工具,是Jupyter笔记本电脑体验的一项关键功能。 一旦将精美的XPlot.Plotly F#可视化包导入到笔记本中(使用Xplot.Ploty;),您就可以开始在.NET中创建丰富的数据可视化。

The graphs are interactive too! Hover over the different data points to see the values.

这些图也是交互式的! 将鼠标悬停在不同的数据点上可以查看值。

Issue report over the last year

学习,创建和共享 (Learn, Create and Share)

To learn, create and share .NET notebooks please check out the following resources:


  • Learn: To learn online checkout the dotnet/try binder image for a zero install experience.

    学习:要学习在线结帐dotnet / try绑定器映像以获得零安装体验。

  • Create: To get started on your machine check out the dotnet/try repo. Select the option highlighted option

    创建:要在您的计算机上开始使用,请检出dotnet / try存储库。 选择选项突出显示的选项

  • Share: If you want to share notebooks you have made using the .NET Jupyter kernel, the easiest way is to generate a Binder image that anyone can run on the web. For more information on how to do this please check out the .NET Jupyter documentation.

    共享:如果要共享使用.NET Jupyter内核制作的笔记本,最简单的方法是生成任何人都可以在网络上运行的Binder图像。 有关如何执行此操作的更多信息,请查阅.NET Jupyter文档

Checkout the online .NET Jupyter Notebook I created for to explore the NightScout GitHub project using C# and the Octokit APIs.

签出我创建的在线.NET Jupyter Notebook ,以使用C#和Octokit API探索NightScout GitHub项目。

We hope you enjoy this new .NET Interactive experience and that you're pleasantly surprised by this evolution of the .NET Try interactive kernel.

我们希望您喜欢这种新的.NET Interactive交互式体验,并且对.NET Try交互式内核的这一发展感到惊喜。

Sponsor: Octopus Deploy wanted me to let you know that Octopus Server is now free for small teams, without time limits. Give your team a single place to release, deploy and operate your software.

赞助商:Octopus Deploy希望我告诉您,Octopus Server现在免费供小型团队使用,没有时间限制。 给您的团队一个发布,部署和操作软件的地方

翻译自: https://www.hanselman.com/blog/announcing-net-jupyter-notebooks


  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页
钱包余额 0