【发布时间】:2018-09-20 15:36:04
【问题描述】:
使用 Jupyter Notebooks,我可以拥有一个单元格
%%javascript IPython.notebook.kernel.execute('x = 42')
然后,在文档的其他地方,带有x 的 Python 代码单元将显示它按预期绑定到 42。
我正在尝试用 JupyterLab 制作类似的东西。我知道我应该编写一个插件而不是使用 ad-hoc JS,这很好,但我没有从笔记本中找到类似于全局 IPython 的内核接口:
import { JupyerLab, JupyterLabPlugin } from '@jupyterlab/application';
const extension: JupyterLabPlugin<void> = {
// ...
requires: [],
activate: (app: JupyterLab) => {
// can I get to Python evaluation through app?
// by adding another class to `requires` above?
}
}
export default extension;
【问题讨论】:
标签: javascript python typescript jupyter-lab