Skip to content

Commit 5351915

Browse files
authored
Merge pull request #85 from QuantStack/migrateV4
Migrate to JupyterLab 4
2 parents 4cee142 + 6e91a3b commit 5351915

31 files changed

+11424
-8083
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ setup.py
3333
tsconfig.eslint.json
3434
tsconfig.json
3535
yarn.lock
36+
.yarn.yml
37+
webpack.config.js

.github/workflows/build.yml

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,60 +9,79 @@ on:
99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
12+
1213
steps:
1314
- name: Checkout
14-
uses: actions/checkout@v2
15+
uses: actions/checkout@v3
1516

1617
- name: Base Setup
1718
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
1819

1920
- name: Install dependencies
20-
run: python -m pip install -U jupyterlab~=3.4
21-
22-
- name: Build the extension
21+
run: python -m pip install -U "jupyterlab>=4.0.0,<5"
22+
23+
- name: Lint the extension
2324
run: |
2425
set -eux
2526
jlpm
2627
jlpm eslint:check
28+
29+
- name: Build the extension
30+
run: |
31+
set -eux
2732
python -m pip install .
2833
2934
jupyter labextension list
3035
jupyter labextension list 2>&1 | grep -ie "jupyterlab-blockly-extension.*OK"
3136
python -m jupyterlab.browser_check
37+
38+
- name: Package the extension
39+
run: |
40+
set -eux
3241
3342
pip install build
34-
python -m build --sdist
35-
cp dist/*.tar.gz myextension.tar.gz
43+
python -m build
3644
pip uninstall -y "jupyterlab_blockly" jupyterlab
37-
rm -rf myextension
3845
39-
- uses: actions/upload-artifact@v2
46+
- name: Upload extension packages
47+
uses: actions/upload-artifact@v3
4048
with:
41-
name: myextension-sdist
42-
path: myextension.tar.gz
49+
name: extension-artifacts
50+
path: dist/jupyterlab_blockly*
51+
if-no-files-found: error
4352

4453
test_isolated:
4554
needs: build
4655
runs-on: ubuntu-latest
4756

4857
steps:
49-
- name: Checkout
50-
uses: actions/checkout@v2
5158
- name: Install Python
52-
uses: actions/setup-python@v2
59+
uses: actions/setup-python@v4
5360
with:
54-
python-version: '3.8'
61+
python-version: '3.9'
5562
architecture: 'x64'
56-
- uses: actions/download-artifact@v2
63+
- uses: actions/download-artifact@v3
5764
with:
58-
name: myextension-sdist
65+
name: extension-artifacts
5966
- name: Install and Test
6067
run: |
6168
set -eux
6269
# Remove NodeJS, twice to take care of system and locally installed node versions.
6370
sudo rm -rf $(which node)
6471
sudo rm -rf $(which node)
65-
pip install myextension.tar.gz
66-
pip install jupyterlab
67-
jupyter labextension list 2>&1 | grep -ie "jupyterlab-blockly-extension.*OK"
72+
73+
pip install "jupyterlab>=4.0.0,<5" jupyterlab_blockly*.whl
74+
75+
76+
jupyter labextension list
77+
jupyter labextension list 2>&1 | grep -ie "jupyterlab-blockly.*OK"
6878
python -m jupyterlab.browser_check --no-browser-test
79+
80+
check_links:
81+
name: Check Links
82+
runs-on: ubuntu-latest
83+
timeout-minutes: 15
84+
steps:
85+
- uses: actions/checkout@v3
86+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
87+
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1

.github/workflows/check-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ jobs:
2626
- name: Upload Distributions
2727
uses: actions/upload-artifact@v3
2828
with:
29-
name: jupyter-releaser-dist-${{ github.run_number }}
29+
name: jupyterlab_blockly-releaser-dist-${{ github.run_number }}
3030
path: |
3131
.jupyter_releaser_checkout/dist

.github/workflows/enforce-label.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Enforce PR label
2+
3+
on:
4+
pull_request:
5+
types: [labeled, unlabeled, opened, edited, synchronize]
6+
jobs:
7+
enforce-label:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
pull-requests: write
11+
steps:
12+
- name: enforce-triage-label
13+
uses: jupyterlab/maintainer-tools/.github/actions/enforce-label@v1

.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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ htmlcov/
5858
.coverage.*
5959
.cache
6060
nosetests.xml
61+
coverage/
6162
coverage.xml
6263
*.cover
6364
.hypothesis/
@@ -112,3 +113,6 @@ dmypy.json
112113

113114
# OSX files
114115
.DS_Store
116+
117+
# Yarn cache
118+
.yarn/

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
**/node_modules
33
**/style
44
**/package.json
5+
!/package.json
56
**/tsconfig.json
67
**/patches
78
**/scripts

.yarnrc.yml

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

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) 2022, quantstack
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: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Repo: https://github.com/google/blockly
1616

1717
## Requirements
1818

19-
- JupyterLab == 3.6
19+
- JupyterLab >= 4.0.0
2020

2121
## Install
2222

@@ -25,6 +25,10 @@ To install the extension, execute:
2525
```bash
2626
conda install -c conda-forge jupyterlab-blockly
2727
```
28+
or
29+
```bash
30+
pip install jupyterlab-blockly
31+
```
2832

2933
#### Kernels
3034

@@ -41,6 +45,10 @@ To remove the extension, execute:
4145
```bash
4246
conda uninstall -c conda-forge jupyterlab-blockly
4347
```
48+
or
49+
```bash
50+
pip install jupyterlab-blockly
51+
```
4452

4553
## Contributing
4654

@@ -53,7 +61,7 @@ The `jlpm` command is JupyterLab's pinned version of
5361
`yarn` or `npm` in lieu of `jlpm` below.
5462

5563
```bash
56-
micromamba create -n blockly -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
64+
micromamba create -n blockly -c conda-forge python nodejs=18 pre-commit jupyterlab jupyter-packaging jupyterlab-language-pack-es-ES jupyterlab-language-pack-fr-FR ipykernel xeus-python xeus-lua
5765
micromamba activate blockly
5866
# Clone the repo to your local environment
5967
# Change directory to the jupyterlab_blockly directory

RELEASE.md

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,31 @@ 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
15-
pip install build twine
14+
pip install build twine hatch
15+
```
16+
17+
Bump the version using `hatch`. By default this will create a tag.
18+
See the docs on [hatch-nodejs-version](https://github.com/agoose77/hatch-nodejs-version#semver) for details.
19+
20+
```bash
21+
hatch version <new-version>
22+
```
23+
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
1634
```
1735

1836
To create a Python source package (`.tar.gz`) and the binary package (`.whl`) in the `dist/` directory, do:
@@ -40,22 +58,20 @@ npm publish --access public
4058

4159
## Automated releases with the Jupyter Releaser
4260

43-
The extension repository should already be compatible with the Jupyter Releaser.
44-
45-
Check out the [workflow documentation](https://github.com/jupyter-server/jupyter_releaser#typical-workflow) for more information.
61+
The extension repository should already be compatible with the Jupyter Releaser. But
62+
the GitHub repository and the package managers need to be properly set up. Please
63+
follow the instructions of the Jupyter Releaser [checklist](https://jupyter-releaser.readthedocs.io/en/latest/how_to_guides/convert_repo_from_repo.html).
4664

4765
Here is a summary of the steps to cut a new release:
4866

49-
- Fork the [`jupyter-releaser` repo](https://github.com/jupyter-server/jupyter_releaser)
50-
- Add `ADMIN_GITHUB_TOKEN`, `PYPI_TOKEN` and `NPM_TOKEN` to the Github Secrets in the fork
5167
- Go to the Actions panel
52-
- Run the "Draft Changelog" workflow
53-
![Draft Changelog](assets/run_draft_changelog.png)
54-
- Merge the Changelog PR
55-
![Merge Draft Changelog PR](assets/merge_changelog.png)
56-
- Using the info from the draft changelong PR, run the "Full Release" workflow
57-
![Full Release info](assets/info_full_release.png)
58-
![Full Release](assets/run_full_release.png)
68+
- Run the "Step 1: Prep Release" workflow
69+
- Check the draft changelog
70+
- Run the "Step 2: Publish Release" workflow
71+
72+
> [!NOTE]
73+
> Check out the [workflow documentation](https://jupyter-releaser.readthedocs.io/en/latest/get_started/making_release_from_repo.html)
74+
> for more information.
5975
6076
## Publishing to `conda-forge`
6177

binder/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ channels:
1212
dependencies:
1313
# runtime dependencies
1414
- python >=3.8,<3.12.0a0
15-
- jupyterlab >=3.5,<4.0.0a0
15+
- jupyterlab >=4.0.0,<5.0.0a0
1616
# labextension build dependencies
1717
- nodejs >=18,<19
1818
- pip

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# -- Project information -----------------------------------------------------
1818

1919
project = 'jupyterlab-blockly'
20-
copyright = '2022, Denisa Checiu'
20+
copyright = '2024, QuantStack'
2121
author = 'Denisa Checiu'
2222

2323
# The full version, including alpha/beta/rc tags

0 commit comments

Comments
 (0)