Skip to content

Commit 1f83823

Browse files
authored
Merge pull request #4 from QuantStack/migrateV4
Upgrade to `v0.3.2` of `jupyterlab-blockly`
2 parents e87cfde + 56686de commit 1f83823

15 files changed

+6895
-5461
lines changed

.github/workflows/binder-on-pr.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,25 @@ on:
33
pull_request_target:
44
types: [opened]
55

6+
permissions:
7+
pull-requests: write
68
jobs:
79
binder:
810
runs-on: ubuntu-latest
9-
permissions:
10-
pull-requests: write
1111
steps:
12-
- uses: jupyterlab/maintainer-tools/.github/actions/binder-link@v1
12+
- name: comment on PR with Binder link
13+
uses: actions/github-script@v3
1314
with:
14-
15-
github_token: ${{ secrets.github_token }}
16-
15+
github-token: ${{secrets.GITHUB_TOKEN}}
16+
script: |
17+
var PR_HEAD_USERREPO = process.env.PR_HEAD_USERREPO;
18+
var PR_HEAD_REF = process.env.PR_HEAD_REF;
19+
github.issues.createComment({
20+
issue_number: context.issue.number,
21+
owner: context.repo.owner,
22+
repo: context.repo.repo,
23+
body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${PR_HEAD_USERREPO}/${PR_HEAD_REF}?urlpath=lab/tree/examples/demo.jpblockly) :point_left: Launch a Binder on branch _${PR_HEAD_USERREPO}/${PR_HEAD_REF}_`
24+
})
25+
env:
26+
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
27+
PR_HEAD_USERREPO: ${{ github.event.pull_request.head.repo.full_name }}

.github/workflows/build.yml

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

2020
- name: Install dependencies
21-
run: python -m pip install -U jupyterlab~=3.6.0
22-
21+
run: python -m pip install -U "jupyterlab>=4.0.0,<5"
22+
2323
- name: Lint the extension
2424
run: |
2525
set -eux
2626
jlpm
27-
jlpm run lint:check
27+
jlpm eslint:check
2828
2929
- name: Build the extension
3030
run: |
3131
set -eux
32-
python -m pip install .[test]
32+
python -m pip install .
3333
3434
jupyter labextension list
3535
jupyter labextension list 2>&1 | grep -ie "jupyterlab-blockly-ipylgbst.*OK"
3636
python -m jupyterlab.browser_check
37-
37+
3838
- name: Package the extension
3939
run: |
4040
set -eux
4141
4242
pip install build
4343
python -m build
44-
pip uninstall -y "jupyterlab_blockly_ipylgbst" jupyterlab~=3.6.0
44+
pip uninstall -y "jupyterlab_blockly_ipylgbst" jupyterlab
4545
4646
- name: Upload extension packages
4747
uses: actions/upload-artifact@v3
@@ -55,8 +55,6 @@ jobs:
5555
runs-on: ubuntu-latest
5656

5757
steps:
58-
- name: Checkout
59-
uses: actions/checkout@v3
6058
- name: Install Python
6159
uses: actions/setup-python@v4
6260
with:
@@ -72,13 +70,12 @@ jobs:
7270
sudo rm -rf $(which node)
7371
sudo rm -rf $(which node)
7472
75-
pip install jupyterlab~=3.6.0 jupyterlab_blockly_ipylgbst*.whl
73+
pip install "jupyterlab>=4.0.0,<5" jupyterlab_blockly_ipylgbst*.whl
7674
7775
7876
jupyter labextension list
7977
jupyter labextension list 2>&1 | grep -ie "jupyterlab-blockly-ipylgbst.*OK"
80-
python -m jupyterlab.browser_check --no-chrome-test
81-
78+
python -m jupyterlab.browser_check --no-browser-test
8279
8380
check_links:
8481
name: Check Links

.github/workflows/check-release.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,27 @@ on:
55
pull_request:
66
branches: ["*"]
77

8+
permissions:
9+
contents: write
10+
811
jobs:
912
check_release:
1013
runs-on: ubuntu-latest
1114
steps:
1215
- name: Checkout
1316
uses: actions/checkout@v3
17+
1418
- name: Base Setup
1519
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
16-
- name: Install Dependencies
17-
run: |
18-
pip install -e .
20+
1921
- name: Check Release
2022
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
2123
with:
22-
2324
token: ${{ secrets.GITHUB_TOKEN }}
2425

2526
- name: Upload Distributions
2627
uses: actions/upload-artifact@v3
2728
with:
28-
name: jupyterlab_blockly_ipylgbst-releaser-dist-${{ github.run_number }}
29-
path: .jupyter_releaser_checkout/dist
29+
name: jupyterlab_blockly_ipylgbst_one-releaser-dist-${{ github.run_number }}
30+
path: |
31+
.jupyter_releaser_checkout/dist

.github/workflows/prep-release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "Step 1: Prep Release"
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version_spec:
6+
description: "New Version Specifier"
7+
default: "next"
8+
required: false
9+
branch:
10+
description: "The branch to target"
11+
required: false
12+
post_version_spec:
13+
description: "Post Version Specifier"
14+
required: false
15+
since:
16+
description: "Use PRs with activity since this date or git reference"
17+
required: false
18+
since_last_stable:
19+
description: "Use PRs with activity since the last stable git tag"
20+
required: false
21+
type: boolean
22+
jobs:
23+
prep_release:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
27+
28+
- name: Prep Release
29+
id: prep-release
30+
uses: jupyter-server/jupyter_releaser/.github/actions/prep-release@v2
31+
with:
32+
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
33+
version_spec: ${{ github.event.inputs.version_spec }}
34+
post_version_spec: ${{ github.event.inputs.post_version_spec }}
35+
branch: ${{ github.event.inputs.branch }}
36+
since: ${{ github.event.inputs.since }}
37+
since_last_stable: ${{ github.event.inputs.since_last_stable }}
38+
39+
- name: "** Next Step **"
40+
run: |
41+
echo "Optional): Review Draft Release: ${{ steps.prep-release.outputs.release_url }}"

.github/workflows/publish-release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: "Step 2: Publish Release"
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
branch:
6+
description: "The target branch"
7+
required: false
8+
release_url:
9+
description: "The URL of the draft GitHub release"
10+
required: false
11+
steps_to_skip:
12+
description: "Comma separated list of steps to skip"
13+
required: false
14+
15+
jobs:
16+
publish_release:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
# This is useful if you want to use PyPI trusted publisher
20+
# and NPM provenance
21+
id-token: write
22+
steps:
23+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
24+
25+
- name: Populate Release
26+
id: populate-release
27+
uses: jupyter-server/jupyter_releaser/.github/actions/populate-release@v2
28+
with:
29+
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
30+
branch: ${{ github.event.inputs.branch }}
31+
release_url: ${{ github.event.inputs.release_url }}
32+
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}
33+
34+
- name: Finalize Release
35+
id: finalize-release
36+
env:
37+
# The following are needed if you use legacy PyPI set up
38+
# PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
39+
# PYPI_TOKEN_MAP: ${{ secrets.PYPI_TOKEN_MAP }}
40+
# TWINE_USERNAME: __token__
41+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
42+
uses: jupyter-server/jupyter_releaser/.github/actions/finalize-release@v2
43+
with:
44+
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
45+
release_url: ${{ steps.populate-release.outputs.release_url }}
46+
47+
- name: "** Next Step **"
48+
if: ${{ success() }}
49+
run: |
50+
echo "Verify the final release"
51+
echo ${{ steps.finalize-release.outputs.release_url }}
52+
53+
- name: "** Failure Message **"
54+
if: ${{ failure() }}
55+
run: |
56+
echo "Failed to Publish the Draft Release Url:"
57+
echo ${{ steps.populate-release.outputs.release_url }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,6 @@ dmypy.json
118118

119119
# OSX files
120120
.DS_Store
121+
122+
# Yarn cache
123+
.yarn

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2023, Denisa Checiu
3+
Copyright (c) 2024, QuantStack
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# jupyterlab-blockly-ipylgbst
22

3-
[![Github Actions Status](https://github.com/QuantStack/jupyterlab-blockly-ipylgbst/workflows/Build/badge.svg)](https://github.com/QuantStack/jupyterlab-blockly-ipylgbst/actions/workflows/build.yml)[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/QuantStack/jupyterlab-blockly-ipylgbst/main?urlpath=lab)
3+
[![Github Actions Status](https://github.com/QuantStack/jupyterlab-blockly-ipylgbst/workflows/Build/badge.svg)](https://github.com/QuantStack/jupyterlab-blockly-ipylgbst/actions/workflows/build.yml)[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/QuantStack/jupyterlab-blockly-ipylgbst/main?urlpath=lab/tree/examples/demo.jpblockly)
44
Blockly extension for JupyterLab to control the Lego Boost, using the ipylgbst library.
55

66
## Blockly
@@ -18,7 +18,7 @@ Link: https://www.lego.com/en-de/product/boost-creative-toolbox-17101
1818

1919
## Requirements
2020

21-
- JupyterLab == 3.6
21+
- JupyterLab >= 4.0.0
2222

2323
## Install
2424

@@ -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 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 jupyterlab 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

RELEASE.md

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ The extension can be published to `PyPI` and `npm` manually or using the [Jupyte
66

77
### Python package
88

9-
This extension can be distributed as Python
10-
packages. All of the Python
11-
packaging instructions in the `pyproject.toml` file to wrap your extension in a
12-
Python package. Before generating a package, we first need to install `build`.
9+
This extension can be distributed as Python packages. All of the Python
10+
packaging instructions are in the `pyproject.toml` file to wrap your extension in a
11+
Python package. Before generating a package, you first need to install some tools:
1312

1413
```bash
1514
pip install build twine hatch
@@ -22,6 +21,18 @@ See the docs on [hatch-nodejs-version](https://github.com/agoose77/hatch-nodejs-
2221
hatch version <new-version>
2322
```
2423

24+
Make sure to clean up all the development files before building the package:
25+
26+
```bash
27+
jlpm clean:all
28+
```
29+
30+
You could also clean up the local git repository:
31+
32+
```bash
33+
git clean -dfX
34+
```
35+
2536
To create a Python source package (`.tar.gz`) and the binary package (`.whl`) in the `dist/` directory, do:
2637

2738
```bash
@@ -49,17 +60,49 @@ npm publish --access public
4960

5061
The extension repository should already be compatible with the Jupyter Releaser.
5162

52-
Check out the [workflow documentation](https://github.com/jupyter-server/jupyter_releaser#typical-workflow) for more information.
63+
Check out the [workflow documentation](https://jupyter-releaser.readthedocs.io/en/latest/get_started/making_release_from_repo.html) for more information.
5364

5465
Here is a summary of the steps to cut a new release:
5566

56-
- Fork the [`jupyter-releaser` repo](https://github.com/jupyter-server/jupyter_releaser)
57-
- Add `ADMIN_GITHUB_TOKEN`, `PYPI_TOKEN` and `NPM_TOKEN` to the Github Secrets in the fork
67+
- Add tokens to the [Github Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) in the repository:
68+
- `ADMIN_GITHUB_TOKEN` (with "public_repo" and "repo:status" permissions); see the [documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
69+
- `NPM_TOKEN` (with "automation" permission); see the [documentation](https://docs.npmjs.com/creating-and-viewing-access-tokens)
70+
- Set up PyPI
71+
72+
<details><summary>Using PyPI trusted publisher (modern way)</summary>
73+
74+
- Set up your PyPI project by [adding a trusted publisher](https://docs.pypi.org/trusted-publishers/adding-a-publisher/)
75+
- The _workflow name_ is `publish-release.yml` and the _environment_ should be left blank.
76+
- Ensure the publish release job as `permissions`: `id-token : write` (see the [documentation](https://docs.pypi.org/trusted-publishers/using-a-publisher/))
77+
78+
</details>
79+
80+
<details><summary>Using PyPI token (legacy way)</summary>
81+
82+
- If the repo generates PyPI release(s), create a scoped PyPI [token](https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#saving-credentials-on-github). We recommend using a scoped token for security reasons.
83+
84+
- You can store the token as `PYPI_TOKEN` in your fork's `Secrets`.
85+
86+
- Advanced usage: if you are releasing multiple repos, you can create a secret named `PYPI_TOKEN_MAP` instead of `PYPI_TOKEN` that is formatted as follows:
87+
88+
```text
89+
owner1/repo1,token1
90+
owner2/repo2,token2
91+
```
92+
93+
If you have multiple Python packages in the same repository, you can point to them as follows:
94+
95+
```text
96+
owner1/repo1/path/to/package1,token1
97+
owner1/repo1/path/to/package2,token2
98+
```
99+
100+
</details>
101+
58102
- Go to the Actions panel
59-
- Run the "Draft Changelog" workflow
60-
- Merge the Changelog PR
61-
- Run the "Draft Release" workflow
62-
- Run the "Publish Release" workflow
103+
- Run the "Step 1: Prep Release" workflow
104+
- Check the draft changelog
105+
- Run the "Step 2: Publish Release" workflow
63106
64107
## Publishing to `conda-forge`
65108

binder/environment.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ channels:
1111

1212
dependencies:
1313
# runtime dependencies
14-
- python >=3.8,<3.9.0a0
15-
- jupyterlab >=3,<4.0.0a0
14+
- python >=3.10,<3.11.0a0
15+
- jupyterlab >=4,<5.0.0a0
1616
# labextension build dependencies
1717
- nodejs >=18,<19
1818
- pip
1919
- wheel
20+
# packages needed for build to succeed
21+
- certipy
22+
- async_generator
2023
# additional packages for demos
2124
# - ipywidgets

0 commit comments

Comments
 (0)