JupyterLite的Python内核,由Xeus提供支持
项目描述
jupyterlite-xeus-python
运行在浏览器中的 JupyterLite 的 Python 内核 xeus-python。
安装
您可以使用 conda/mamba 安装内核
mamba install -c conda-forge jupyterlite-xeus-python
或使用 pip
pip install jupyterlite-xeus-python
然后构建您的 JupyterLite 网站
jupyter lite build
预安装的包
xeus-python 允许您在 Python 运行时预安装包。您可以通过在 JupyterLite 构建目录中添加一个 environment.yml
文件来预安装包,xeus-python 将自动找到该文件,在运行 jupyter lite build
时预构建环境。
此外,它还会自动安装它找到的任何实验室扩展,例如,安装 ipyleaflet 将使 ipyleaflet 在无需手动安装 jupyter-leaflet 实验室扩展的情况下工作。
假设您想安装 NumPy
、Matplotlib
和 ipycanvas
,可以通过创建以下内容的 environment.yml
文件来实现
name: xeus-python-kernel
channels:
- https://repo.mamba.pm/emscripten-forge
- conda-forge
dependencies:
- numpy
- matplotlib
- ipycanvas
然后您只需要构建 JupyterLite
jupyter lite build
您也可以为该环境文件选择另一个名称(例如 custom.yml
),这样做的话,您将需要将此名称指定给 xeus-python
jupyter lite build --XeusPythonEnv.environment_file=custom.yml
贡献
开发安装
注意:您需要 NodeJS 来构建扩展包。
jlpm
命令是 JupyterLab 预装的 yarn 版本,它随 JupyterLab 一起安装。您可以使用下面的 yarn
或 npm
代替 jlpm
。
# Clone the repo to your local environment
# Change directory to the jupyterlite-xeus-python directory
# Install package in development mode
python -m pip install -e ".[dev]"
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Rebuild extension Typescript source after making changes
jlpm run build
您可以在不同的终端中同时监视源目录并运行 JupyterLab,以便监视扩展源的更改并在自动重新构建扩展的同时运行。
# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm run watch
# Run JupyterLab in another terminal
jupyter lab
在监视命令运行时,每次保存的更改都将立即在本地构建并可供您运行的 JupyterLab 使用。刷新 JupyterLab 以在浏览器中加载更改(您可能需要等待几秒钟以重新构建扩展)。
开发卸载
pip uninstall jupyterlite-xeus-python
在开发模式下,您还需要删除由 jupyter labextension develop
命令创建的符号链接。要找到其位置,您可以使用 jupyter labextension list
来确定 labextensions
文件夹的位置。然后您可以在该文件夹中删除名为 jupyterlite-xeus-python
的符号链接。
打包扩展
见 RELEASE
项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。
源分布
构建分布
哈希值 for jupyterlite_xeus_python-1.0.0-py3-none-any.whl
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 0be2393d3f738ecc920c6b5ec261c83d0ff2a1d79cdf5b8167dcdb95464b7e86 |
|
MD5 | 56dc48daebded862762ef7df3cfec528 |
|
BLAKE2b-256 | d8e6d4fe8e4d9bd31688d393fdb7052bb0c897726f2f8f042a40788353e7b8e3 |