跳转到主要内容

Blockly扩展,用于JupyterLab控制乐高Boost

项目描述

jupyterlab-lego-boost

Github Actions StatusBinder Blockly扩展,用于JupyterLab控制乐高Boost

Blockly

Blockly 是 Google 开发的一个库,用于构建易于初学者使用的基于积木的编程语言。

文档:https://developers.google.com/blockly/guides/overview 仓库:https://github.com/google/blockly

乐高 Boost 机器人套件

这是一个乐高创意工具箱,提供了一种简单学习编程、工程和机器基本原理的方法。

链接:https://www.lego.com/en-de/product/boost-creative-toolbox-17101

要求

  • JupyterLab >= 4.0.0

安装

要安装扩展,请执行

pip install jupyterlab-lego-boost

卸载

要删除扩展,请执行

pip uninstall jupyterlab-lego-boost

连接到乐高 Boost

注意:在使用扩展之前,请确保通过官方应用程序更新了固件。大多数与连接故障相关的问题都可以通过更新固件轻松解决。有时,每次从官方应用程序连接到 MoveHub 时,都会进行多次固件更新。

为了连接到机器人,您只需要您的 MoveHub 的蓝牙地址,您可以从设备的蓝牙设置中找到它。一旦您有了它,只需在 `examples/demo.jpblockly` 文件中替换它,特别是在连接块中,然后您就可以尝试演示了!

当您运行代码时,确保您按下 MoveHub 上的按钮,使 led 闪烁,这意味着它正在寻找连接。一旦您成功连接到它,led 将变为蓝色。每个代码都需要从使用连接块开始,并以断开连接块结束。

当您想要运行另一个代码片段时,如果您得到错误信息 通信线程不工作,请在运行代码之前手动停止内核并重新启动它。

贡献

开发安装

注意:您需要 NodeJS 来构建扩展包。

jlpm 命令是 JupyterLab 的固定版本的 yarn,它随 JupyterLab 一起安装。您可以使用 yarnnpm 替代下面的 jlpm

micromamba create -n boost -c conda-forge python nodejs jupyterlab jupyterlab-language-pack-es-ES jupyterlab-language-pack-fr-FR ipykernel xeus-python xeus-lua
micromamba activate boost
# Clone the repo to your local environment
# Change directory to the jupyterlab-lego-boost directory
# Install package in development mode
pip install -e .
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Rebuild extension Typescript source after making changes
jlpm build

您可以在不同的终端中同时监视源目录并运行 JupyterLab,以监视扩展源代码的更改并自动重新构建扩展。

# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm watch
# Run JupyterLab in another terminal
jupyter lab

当监视命令运行时,每次保存的更改都将立即在本地上构建并可供您在运行的 JupyterLab 中使用。刷新 JupyterLab 以在浏览器中加载更改(您可能需要等待几秒钟以重建扩展)。

默认情况下,jlpm build 命令为该扩展生成源映射,以便更容易使用浏览器开发者工具进行调试。要为 JupyterLab 核心扩展也生成源映射,可以运行以下命令

jupyter lab build --minimize=False

开发卸载

pip uninstall jupyterlab-lego-boost

在开发模式下,您还需要删除由 jupyter labextension develop 命令创建的符号链接。要找到其位置,可以运行 jupyter labextension list 以确定 labextensions 文件夹的位置。然后您可以删除该文件夹中的名为 jupyterlab-lego-boost 的符号链接。

打包扩展

RELEASE

项目详情


下载文件

下载您平台上的文件。如果您不确定选择哪个,请了解更多关于 安装软件包 的信息。

源代码分发

jupyterlab_lego_boost-0.1.0a4.tar.gz (2.0 MB 查看哈希值)

上传时间 源代码

构建分发

jupyterlab_lego_boost-0.1.0a4-py3-none-any.whl (1.9 MB 查看哈希值)

上传时间 Python 3

支持