Skip to content

Commit e87cfde

Browse files
DenisaCGhbcarlos
andauthored
Registering a new toolbox and adding the ipylgbst blocks (#2)
* Registering a new toolbox and adding the blocks * Ignore source map warnings and fix extension configuration * bump jupyterlab-blockly version and update python generator for Blockly * Update jupyterlab-blobkly * small fix in connection function * modified example and split blocks into 2 toolboxes * update ipylgbst version and add examples * update yarn file * Pin ipywidgets and jupyterlab-blockly * Adds yarn cache to gitignore * Pin JupyterLab v3 on CI --------- Co-authored-by: Carlos Herrero <26092748+hbcarlos@users.noreply.github.com>
1 parent a3ccc4d commit e87cfde

14 files changed

+3196
-1002
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
1919

2020
- name: Install dependencies
21-
run: python -m pip install -U jupyterlab
21+
run: python -m pip install -U jupyterlab~=3.6.0
2222

2323
- name: Lint the extension
2424
run: |
@@ -41,7 +41,7 @@ jobs:
4141
4242
pip install build
4343
python -m build
44-
pip uninstall -y "jupyterlab_blockly_ipylgbst" jupyterlab
44+
pip uninstall -y "jupyterlab_blockly_ipylgbst" jupyterlab~=3.6.0
4545
4646
- name: Upload extension packages
4747
uses: actions/upload-artifact@v3
@@ -72,7 +72,7 @@ jobs:
7272
sudo rm -rf $(which node)
7373
sudo rm -rf $(which node)
7474
75-
pip install jupyterlab jupyterlab_blockly_ipylgbst*.whl
75+
pip install jupyterlab~=3.6.0 jupyterlab_blockly_ipylgbst*.whl
7676
7777
7878
jupyter labextension list

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jupyterlab_blockly_ipylgbst/_version.py
1414
# Created by https://www.gitignore.io/api/python
1515
# Edit at https://www.gitignore.io/?templates=python
1616

17+
.yarn
18+
1719
### Python ###
1820
# Byte-compiled / optimized / DLL files
1921
__pycache__/

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ The `jlpm` command is JupyterLab's pinned version of
4747
`yarn` or `npm` in lieu of `jlpm` below.
4848

4949
```bash
50-
micromamba create -n blockly-ipylgbst -c conda-forge python nodejs=18 yarn pre-commit jupyterlab==3.6 jupyter-packaging jupyterlab-language-pack-es-ES jupyterlab-language-pack-fr-FR ipykernel xeus-python xeus-lua
50+
micromamba create -n blockly-ipylgbst -c conda-forge python nodejs=18 pre-commit jupyterlab==3.6 jupyter-packaging jupyterlab-language-pack-es-ES jupyterlab-language-pack-fr-FR ipykernel xeus-python xeus-lua
5151
micromamba activate blockly-ipylgbst
5252
# Clone the repo to your local environment
5353
# Change directory to the jupyterlab-blockly-ipylgbst directory

examples/demo-multiple-tasks.jpblockly

Whitespace-only changes.

examples/demo.jpblockly

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"blocks":{"languageVersion":0,"blocks":[{"type":"ipylgbst_connect","id":"3lCIiC9F7~S86nK|$ZeK","x":334,"y":108,"inputs":{"DO":{"block":{"type":"ipylgbst_set_led","id":"e:zf*ZO[R{3%{p8^dC^A","fields":{"COLOR":"LedColor.green"},"next":{"block":{"type":"ipylgbst_move_forward","id":"ePkn/4dk:#cFBE;H{yLO","inputs":{"SPEED":{"block":{"type":"math_number","id":".uds)=_yI(R0_Hj2%0}%","fields":{"NUM":10}}},"TIME":{"block":{"type":"math_number","id":"${=}]+1#8e3#A1-1!BT8","fields":{"NUM":2}}}},"next":{"block":{"type":"ipylgbst_sleep","id":"#sef,)KWodVW)j]$w6yw","inputs":{"TIME":{"block":{"type":"math_number","id":"y^T]~P$KS0UYjU0yC5G$","fields":{"NUM":2}}}},"next":{"block":{"type":"ipylgbst_set_led","id":"uJ[H*cOn`.@U17j]+;dt","fields":{"COLOR":"LedColor.pink"},"next":{"block":{"type":"ipylgbst_move_bacwards","id":"DfVP]@c{.L%q,m2hX6ds","inputs":{"SPEED":{"block":{"type":"math_number","id":"xNl@VVHc_(Hm;,NrLz1K","fields":{"NUM":10}}},"TIME":{"block":{"type":"math_number","id":"m#nR+,e;K@nRPX0_erj,","fields":{"NUM":2}}}}}}}}}}}}}}}}]}}

examples/vernie.jpblockly

Whitespace-only changes.

package.json

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,27 @@
5555
"postinstall": "patch-package"
5656
},
5757
"dependencies": {
58-
"@jupyter-widgets/base": "^6.0.4",
59-
"@jupyter-widgets/jupyterlab-manager": "^5.0.7",
60-
"@jupyterlab/application": "^3.4",
58+
"@jupyterlab/application": "^3.6.3",
6159
"blockly": "^9.2.1",
62-
"jupyterlab-blockly": "^0.3.0-alpha.1",
60+
"jupyterlab-blockly": "^0.3.0-alpha.4",
6361
"patch-package": "^6.4.7",
6462
"postinstall-postinstall": "^2.1.0"
6563
},
64+
"resolutions": {
65+
"@jupyterlab/rendermime-interfaces": "3.6"
66+
},
6667
"devDependencies": {
67-
"@jupyterlab/builder": "^3.4.0",
68-
"@typescript-eslint/eslint-plugin": "^4.8.1",
69-
"@typescript-eslint/parser": "^4.8.1",
70-
"eslint": "^7.14.0",
71-
"eslint-config-prettier": "^6.15.0",
72-
"eslint-plugin-prettier": "^3.1.4",
68+
"@jupyterlab/builder": "^3.6.0",
69+
"@typescript-eslint/eslint-plugin": "^5.12.1",
70+
"@typescript-eslint/parser": "^5.12.1",
71+
"eslint": "^8.9.0",
72+
"eslint-config-prettier": "^8.4.0",
73+
"eslint-plugin-prettier": "^4.0.0",
74+
"eslint-plugin-react": "^7.30.0",
7375
"npm-run-all": "^4.1.5",
74-
"prettier": "^2.1.1",
76+
"prettier": "^2.5.1",
7577
"rimraf": "^3.0.2",
78+
"source-map-loader": "^4.0.1",
7679
"stylelint": "^14.3.0",
7780
"stylelint-config-prettier": "^9.0.4",
7881
"stylelint-config-recommended": "^6.0.0",
@@ -91,22 +94,14 @@
9194
"jupyterlab": {
9295
"extension": true,
9396
"outputDir": "jupyterlab_blockly_ipylgbst/labextension",
94-
"sharedPackages": {
95-
"jupyterlab-blockly": {
96-
"bundled": false,
97-
"singleton": true
98-
},
99-
"blockly": {
100-
"bundled": false,
101-
"singleton": true
102-
}
103-
}
97+
"webpackConfig": "./webpack.config.js"
10498
},
10599
"eslintIgnore": [
106100
"node_modules",
107101
"dist",
108102
"coverage",
109-
"**/*.d.ts"
103+
"**/*.d.ts",
104+
"examples"
110105
],
111106
"eslintConfig": {
112107
"extends": [

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ classifiers = [
2323
"Programming Language :: Python :: 3.11",
2424
]
2525
dependencies = [
26-
"jupyterlab~=3.6",
27-
"jupyterlab-blockly>=0.3.0-alpha.1,<0.4",
28-
"ipywidgets==7.6.0"
26+
"jupyterlab~=3.6.0",
27+
"ipywidgets~=7.6.0",
28+
"jupyterlab-blockly>=0.3.0a4, <0.4",
29+
"ipylgbst>=0.2.1, <0.3",
2930
]
3031
dynamic = ["version", "description", "authors", "urls", "keywords"]
3132

src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import {
55

66
import { IBlocklyRegistry } from 'jupyterlab-blockly';
77

8+
import BlocklyIpylgbst from './ipylgbst_blocks_and_toolbox';
9+
810
/**
911
* Initialization data for the jupyterlab-blockly-ipylgbst extension.
1012
*/
@@ -16,6 +18,9 @@ const plugin: JupyterFrontEndPlugin<void> = {
1618
console.log(
1719
'JupyterLab extension jupyterlab-blockly-ipylgbst is activated!'
1820
);
21+
22+
blockly.registerToolbox('ipylgbst', BlocklyIpylgbst.Toolbox);
23+
blockly.registerToolbox('ipylgbst async', BlocklyIpylgbst.Toolbox_async);
1924
}
2025
};
2126

0 commit comments

Comments
 (0)