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.
在Microsoft Ignite 2019上,我们很高兴地宣布“试用.NET全局工具”增加了对C#和F#Jupyter笔记本的支持。 上周,带给您.NET笔记本的同一团队宣布了.NET Notebook的Preview 2。
名称更改-.NET交互式 (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.
随着“ Try .NET”场景的不断增长,团队希望其名称能够涵盖他们所拥有的所有经验以及将来的所有经验。 Try .NET项目系列现在是.NET交互式的。
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.
在Rick Minerich , Colin Gravill和许多其他贡献者的开创性工作中, F#社区多年来一直在Juypter Notebooks中享受F# ! .NET Interactive是一系列工具和内核,它们作为第一方Microsoft支持的产品提供了多种体验的支持。
.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交互式是一组CLI(命令行界面)工具和API,使用户能够在Web,降价和笔记本上创建交互式体验。
.NET Interactive API和工具 (.NET Interactive APIs and Tools)
Here is what the command line looks like using the dotnet CLI.
使用dotnet CLI的命令行如下所示。
dotnet interactive
global tool:dotnet interactive
全局工具:Used for notebooks (Jupyter and nteract). This came out in late 2019.
用于笔记本电脑(Jupyter和nteract)。 这是在2019年末发布的。
dotnet interactive
global tool:dotnet interactive
全局工具:dotnet try
global tool:dotnet try
全局工具:Used for workshops and offline documentation. Interactive markdown with a backing project. I wrote about this in May 2019.
用于研讨会和离线文档。 带有支持项目的交互式降价。 我在2019年5月撰写了有关此内容的文章。
dotnet try
global tool:dotnet try
全局工具:trydotnet.js
APItrydotnet.js
APICurrently, only used internally at Microsoft, this API is used on the .NET page and C# documentation. Maybe one day I can use it on my blog? And yours?
当前,此API仅在Microsoft内部使用,在.NET页和C#文档中使用。 也许有一天我可以在我的博客上使用它? 你的呢?
trydotnet.js
APItrydotnet.js
API
安装.NET Interactive (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交互式全局工具之前,请确保您具有以下内容:
Jupyter : JupyterLab can be installed using Anaconda or
conda
orpip
.Jupyter :可以使用Anaconda或
conda
或pip
安装JupyterLab。For more details on how to do this please checkout the offical Jupyter installation guide.
有关如何执行此操作的更多详细信息,请查阅Jupyter官方安装指南。
Jupyter : JupyterLab can be installed using Anaconda or
conda
orpip
.Open Anaconda Prompt (windows) or Terminal (macOS).
打开Anaconda Prompt (Windows)或Terminal(macOS)。
- Verify that Jupyter ins installed and present on the current path. 验证Jupyter ins是否已安装并存在于当前路径中。
Open Anaconda Prompt (windows) or Terminal (macOS).
打开Anaconda Prompt (Windows)或Terminal(macOS)。
> jupyter kernelspec list
python3 ~\jupyter\kernels\python3
Open Windows terminal and install the dotnet interactive global tool:
打开Windows终端并安装dotnet交互式全局工具:
> 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!
切换回Anaconda提示符并安装.NET内核。 明确地说,这里我们使用dotnet CLI来让Jupyter CLI知道我们已经存在!
> 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 仍然在Anaconda提示符下时,验证是否已这样安装.NET内核
> 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!
现在,您可以在命令行中运行“ jupyter lab
”,您就可以开始了!
更多语言-PowerShell (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.
.NET内核现在也支持PowerShell! 在预览版2中,.NET交互式团队与PowerShell合作以启用此方案。 您可以阅读有关PowerShell博客公告的更多信息。
The .NET interactive team is looking forward to hearing your thoughts. You can talk to them at https://github.com/dotnet/interactive
.NET交互式团队期待听到您的想法。 您可以在https://github.com/dotnet/interactive与他们交谈
多种.NET语言笔记本(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.
我想强调一下.NET交互自预览版1以来隐藏的瑰宝之一-多国语言笔记本。 这意味着用户可以在一个笔记本中切换语言。 这是单个.ipynb文件中的C#,F#和PowerShell的示例。
Using one of the language magic commands (#!csharp
, #!fsharp
,#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.
使用一种语言魔术命令( #!csharp
, #!fsharp
, #!fsharp
#pwsh
)告诉.NET Interactive内核以特定语言运行单元。 要查看可用魔术命令的完整列表,请在新单元格中输入#!lsmagic
命令并运行它。
nteract.io中的.NET代码 (.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.
此外,您现在可以在nteract.io中编写.NET代码。 Nteract是一个开放源代码组织,其构建SDK,应用程序和库,以帮助人们充分利用交互式笔记本和REPL。 我们很高兴能够让.NET用户利用nteract提供的丰富REPL体验,包括nteract桌面应用程序。
To get started with .NET Interactive in nteract please download the nteract desktop app and install the .NET kernels.
要在nteract中开始使用.NET Interactive,请下载nteract桌面应用程序并安装.NET内核。
学到更多 (Learn More)
Try sample .NET notebooks online using Binder. This also allows you try out .NET Interactive daily builds.
使用Binder在线尝试示例.NET笔记本。 这也使您可以尝试.NET Interactive的每日构建。
Share your own .NET notebooks with others online using Binder.
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.
团队期待看到您的构建。 向前迈进,团队将dotnet try
和dotnet interactive
工具划分为单独的存储库。
For any issues, feature requests, and contributions to .NET Notebooks, please visit the .NET Interactive repo.
如有任何问题,功能要求以及对.NET Notebook的贡献,请访问.NET Interactive库。
For any issues, feature requests, and contributions on interactive markdown and trydotnet.js, please visit the Try .NET repo.
对于任何问题,功能要求以及对交互式markdown和trydotnet.js的贡献,请访问Try .NET库。
翻译自: https://www.hanselman.com/blog/announcing-net-interactive-try-net-includes-net-notebooks-and-more