···2323 run: |
2424 set -eux
2525 jlpm
2626- jlpm run eslint:check
2626+ jlpm eslint:check
2727 python -m pip install .
28282929 jupyter labextension list
+2
.gitignore
···55.ipynb_checkpoints
66*.tsbuildinfo
77jupyterlab_blockly/labextension
88+untitled*
99+Untitled*
810911# Created by https://www.gitignore.io/api/python
1012# Edit at https://www.gitignore.io/?templates=python
+3-3
README.md
···6464# Link your development version of the extension with JupyterLab
6565jupyter labextension develop . --overwrite
6666# Rebuild extension Typescript source after making changes
6767-jlpm run build
6767+jlpm build
6868```
69697070You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.
71717272```bash
7373# Watch the source directory in one terminal, automatically rebuilding when needed
7474-jlpm run watch
7474+jlpm watch
7575# Run JupyterLab in another terminal
7676jupyter lab
7777```
78787979With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).
80808181-By default, the `jlpm run build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:
8181+By default, the `jlpm build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:
82828383```bash
8484jupyter lab build --minimize=False
···5050# The theme to use for HTML and HTML Help pages. See the documentation for
5151# a list of builtin themes.
5252html_theme = 'pydata_sphinx_theme'
5353+html_theme_options = {
5454+ 'github_url': 'https://github.com/quantstack/jupyterlab-blockly',
5555+ 'use_edit_page_button': True,
5656+ 'icon_links': [
5757+ {
5858+ 'name': 'PyPI',
5959+ 'url': 'https://pypi.org/project/jupyterlab-blockly',
6060+ 'icon': 'fa-solid fa-box',
6161+ },
6262+ ],
6363+ 'pygment_light_style': 'github-light',
6464+ 'pygment_dark_style': 'github-dark'
6565+}
6666+html_context = {
6767+ 'github_user': 'quantstack',
6868+ 'github_repo': 'jupyterlab-blockly',
6969+ 'github_version': 'main',
7070+ 'doc_path': 'docs',
7171+}
53725473# Add any paths that contain custom static files (such as style sheets) here,
5574# relative to this directory. They are copied after the builtin static files,
···4848# Link your development version of the extension with JupyterLab
4949jupyter labextension develop . --overwrite
5050# Rebuild extension Typescript source after making changes
5151-jlpm run build
5151+jlpm build
5252```
53535454You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.
+14-14
docs/other_extensions.md
···33The JupyterLab-Blockly extension is ready to be used as a base for other projects: you can register new Blocks, Toolboxes and Generators. It is a great tool for fast prototyping.
4455## Creating a new JupyterLab extension
66-You can easily create a new JupyterLab extension by using a `cookiecutter`. You can read more documentation about `cookiecutters` [here](https://cookiecutter.readthedocs.io/en/latest/), but the process is fairly straight-forward.
66+You can easily create a new JupyterLab extension by using a `cookiecutter`. You can read more documentation about `cookiecutters` [here](https://cookiecutter.readthedocs.io/en/latest/), but the process is fairly straight-forward.
7788After running the following command:
99```
···2020jlpm add jupyterlab-blockly
2121```
22222323-Once it is part of your project, all you need to do is import `IBlocklyRegistry`, as it follows:
2323+Once it is part of your project, all you need to do is import `IBlocklyRegistry`, as it follows:
2424```typescript
2525// src/index.ts
2626···4040 *
4141 * @argument blocks Blocks to register.
4242 */
4343- registerBlocks(blocks: JSONObject[]): void {
4343+ registerBlocks(blocks: BlockDefinition[]): void {
4444 Blockly.defineBlocksWithJsonArray(blocks);
4545 }
4646```
···5656 *
5757 * @argument value Toolbox to register.
5858 */
5959- registerToolbox(name: string, value: JSONObject): void {
5959+ registerToolbox(name: string, value: ToolboxDefinition): void {
6060 this._toolboxes.set(name, value);
6161 }
6262```
···868687878888## Example - JupyterLab-Niryo-One
8989-The [JupyterLab-Niryo-One](https://github.com/QuantStack/jupyterlab-niryo-one/) extension was built on top of JupyterLab-Blockly and poses as the perfect example. The [Github repository](https://github.com/QuantStack/jupyterlab-niryo-one/) gives access to its entire codebase.
8989+The [JupyterLab-Niryo-One](https://github.com/QuantStack/jupyterlab-niryo-one/) extension was built on top of JupyterLab-Blockly and poses as the perfect example. The [Github repository](https://github.com/QuantStack/jupyterlab-niryo-one/) gives access to its entire codebase.
90909191The following code snippet showcases how to register a new toolbox, `BlocklyNiryo.Toolbox`, as `niryo`.
9292```typescript
···158158setup_args = dict(
159159 ...
160160 install_requires=['jupyterlab-blockly>=0.1.1,<0.2']
161161- ...
161161+ ...
162162)
163163```
164164···169169170170"jupyterlab": {
171171 "sharedPackages": {
172172- "jupyterlab-blockly": {
173173- "bundled": false,
174174- "singleton": true
175175- },
176176- "blockly": {
177177- "bundled": false,
178178- "singleton": true
179179- }
172172+ "jupyterlab-blockly": {
173173+ "bundled": false,
174174+ "singleton": true
175175+ },
176176+ "blockly": {
177177+ "bundled": false,
178178+ "singleton": true
179179+ }
180180 }
181181 }
182182```