我们如何使用 ThebeLab 来执行由带有 ielixir 内核的 Jupyter Notbook 支持的代码单元
How might we use ThebeLab to execute a code cell which is backed by a Jupyter Notbook with an ielixir kernel
我正在尝试使用 Thebe Lab 从 jupyter 笔记本 运行 嵌入 ielixir 内核的代码单元,以便我可以在网站上创建一系列交互式 Elixir 练习。为了实现这个目标,我从文档中获取了最小的启动器,并更改了第一个 <script>
标记中的 binderOptions
以及末尾 <pre>
标记中的默认代码部分。
示例代码如下:
<body>
<script type="text/x-thebe-config">
{
requestKernel: true,
binderOptions: {
name: "Elixir",
repo: "J0/binder-el",
kernelName: "ielixir",
path: "./.local/share/jupyter/kernels/ielixir",
},
}
</script>
<script src="https://unpkg.com/thebelab@latest/lib/index.js"></script>
<button id="activateButton" style="width: 150px; height: 75px; font-size: 1.5em;">Activate</button>
<script>
var bootstrapThebe = function() {
thebelab.bootstrap();
}
document.querySelector("#activateButton").addEventListener('click', bootstrapThebe)
</script>
<pre data-executable="true" >IO.puts("Hello world")</pre>
</body>
存储库J0/binder-el is a repository with a single Dockerfile containing the setup required to run an Elixir kernel as per the ielixir repository。我在使用 binder.org
之前已经对其进行了测试,并且能够在我创建的笔记本中成功执行 IO.puts("Hello world")
。
不幸的是,尽管我指定了 kernelName: ielixir
,但 运行 按钮似乎执行了一个 ipython
内核,这让我感到有些困惑。这是屏幕截图:
我只是想知道我是否遗漏了什么,或者是否有人对我如何修改现有设置以支持 ielixir 内核提出建议。
我也创建了一个 discussion thread on the thebelabs repository,但我认为 post 这里的问题是值得的,因为论坛似乎相对不活跃。
谢谢!
事实证明,您需要配置两个选项。
- 您需要保留数据语言标签。
<pre data-executable="true" data-language="ielixir">IO.puts("Hello world")</pre>
- 内核选项和Binder选项需要单独指定
<script type="text/x-thebe-config">
{
requestKernel: true,
binderOptions: {
repo: "J0/binder-el",
},
kernelOptions: {
name: "Elixir",
kernelName: "ielixir",
}
}
</script>
<script src="https://unpkg.com/thebelab@latest/lib/index.js"></script>
请注意 kernelName
而不是 name
应该是 ielixir
。之后它应该工作!将写一篇博客 post 总结过程并尽快更新此线程。
我正在尝试使用 Thebe Lab 从 jupyter 笔记本 运行 嵌入 ielixir 内核的代码单元,以便我可以在网站上创建一系列交互式 Elixir 练习。为了实现这个目标,我从文档中获取了最小的启动器,并更改了第一个 <script>
标记中的 binderOptions
以及末尾 <pre>
标记中的默认代码部分。
示例代码如下:
<body>
<script type="text/x-thebe-config">
{
requestKernel: true,
binderOptions: {
name: "Elixir",
repo: "J0/binder-el",
kernelName: "ielixir",
path: "./.local/share/jupyter/kernels/ielixir",
},
}
</script>
<script src="https://unpkg.com/thebelab@latest/lib/index.js"></script>
<button id="activateButton" style="width: 150px; height: 75px; font-size: 1.5em;">Activate</button>
<script>
var bootstrapThebe = function() {
thebelab.bootstrap();
}
document.querySelector("#activateButton").addEventListener('click', bootstrapThebe)
</script>
<pre data-executable="true" >IO.puts("Hello world")</pre>
</body>
存储库J0/binder-el is a repository with a single Dockerfile containing the setup required to run an Elixir kernel as per the ielixir repository。我在使用 binder.org
之前已经对其进行了测试,并且能够在我创建的笔记本中成功执行 IO.puts("Hello world")
。
不幸的是,尽管我指定了 kernelName: ielixir
,但 运行 按钮似乎执行了一个 ipython
内核,这让我感到有些困惑。这是屏幕截图:
我也创建了一个 discussion thread on the thebelabs repository,但我认为 post 这里的问题是值得的,因为论坛似乎相对不活跃。
谢谢!
事实证明,您需要配置两个选项。
- 您需要保留数据语言标签。
<pre data-executable="true" data-language="ielixir">IO.puts("Hello world")</pre>
- 内核选项和Binder选项需要单独指定
<script type="text/x-thebe-config">
{
requestKernel: true,
binderOptions: {
repo: "J0/binder-el",
},
kernelOptions: {
name: "Elixir",
kernelName: "ielixir",
}
}
</script>
<script src="https://unpkg.com/thebelab@latest/lib/index.js"></script>
请注意 kernelName
而不是 name
应该是 ielixir
。之后它应该工作!将写一篇博客 post 总结过程并尽快更新此线程。