Skip to content

Commit

Permalink
Updates and fixes (#1)
Browse files Browse the repository at this point in the history
* update jupyterlab requirements

* fix linting and config

* more fixes

* fix tsconfig

* skip browser check for now

* Update README

* fix kernelspec logo

* add script to bump versions

* bump actions

* fix pyproject

* add before-bump-version hook

* fix hook

* fix version

* fix yarn.lock

* try without hook

* run cmd

* remove whitespaces

* re-add hook

* try

* debug

* fix script name
  • Loading branch information
jtpio committed Feb 15, 2024
1 parent 123a40c commit 6534151
Show file tree
Hide file tree
Showing 19 changed files with 13,493 additions and 131 deletions.
20 changes: 11 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

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

- name: Install dependencies
run: python -m pip install -U "jupyterlab>=4.0.0,<5"
run: python -m pip install -U "jupyterlab>=4.1.1,<4.2"

- name: Lint the extension
run: |
Expand All @@ -37,7 +37,8 @@ jobs:
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "@jupyterlite/javascript-kernel.*OK"
python -m jupyterlab.browser_check
# TODO: re-enable?
# python -m jupyterlab.browser_check
- name: Package the extension
run: |
Expand All @@ -48,7 +49,7 @@ jobs:
pip uninstall -y "jupyterlite_javascript_kernel" jupyterlab
- name: Upload extension packages
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: extension-artifacts
path: dist/jupyterlite_javascript_kernel*
Expand All @@ -60,11 +61,11 @@ jobs:

steps:
- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.9'
architecture: 'x64'
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: extension-artifacts
- name: Install and Test
Expand All @@ -74,19 +75,20 @@ jobs:
sudo rm -rf $(which node)
sudo rm -rf $(which node)
pip install "jupyterlab>=4.0.0,<5" jupyterlite_javascript_kernel*.whl
pip install "jupyterlab>=4.1.1,<4.2" jupyterlite_javascript_kernel*.whl
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "@jupyterlite/javascript-kernel.*OK"
python -m jupyterlab.browser_check --no-browser-test
# TODO: re-enable?
# python -m jupyterlab.browser_check --no-browser-test
check_links:
name: Check Links
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1
6 changes: 2 additions & 4 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Check Release
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
with:

token: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Distributions
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: jupyterlite_javascript_kernel-releaser-dist-${{ github.run_number }}
path: .jupyter_releaser_checkout/dist
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,7 @@ dmypy.json

# Yarn cache
.yarn/

# JupyterLite generated files
.jupyterlite.doit.db
_output
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
# jupyterlite_javascript_kernel
# jupyterlite-javascript-kernel

[![Github Actions Status](https://github.com/jupyterlite/javascript-kernel/workflows/Build/badge.svg)](https://github.com/jupyterlite/javascript-kernel/actions/workflows/build.yml)
A JavaScript kernel for JupyterLite

A JavaScript kernel for JupyterLite.

## Requirements

- JupyterLab >= 4.0.0
- JupyterLite >=0.3.0

This kernel was originally maintained as part of the main JupyterLite repository, and was moved to its own repository for the JupyterLite 0.3.0 release.

## Install

To install the extension, execute:

```bash
pip install jupyterlite_javascript_kernel
pip install jupyterlite-javascript-kernel
```

## Uninstall

To remove the extension, execute:

```bash
pip uninstall jupyterlite_javascript_kernel
pip uninstall jupyterlite-javascript-kernel
```

## Contributing
Expand All @@ -35,7 +38,7 @@ The `jlpm` command is JupyterLab's pinned version of

```bash
# Clone the repo to your local environment
# Change directory to the jupyterlite_javascript_kernel directory
# Change directory to the jupyterlite-javascript-kernel directory
# Install package in development mode
pip install -e "."
# Link your development version of the extension with JupyterLab
Expand Down Expand Up @@ -64,7 +67,7 @@ jupyter lab build --minimize=False
### Development uninstall

```bash
pip uninstall jupyterlite_javascript_kernel
pip uninstall jupyterlite-javascript-kernel
```

In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
Expand Down
5 changes: 5 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"npmClient": "jlpm",
"version": "0.2.3",
"useWorkspaces": true
}
83 changes: 36 additions & 47 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@jupyterlite/javascript-kernel-root",
"private": true,
"version": "0.1.0",
"version": "0.2.3",
"description": "A JavaScript kernel for JupyterLite",
"keywords": [
"jupyter",
Expand All @@ -14,55 +14,44 @@
},
"license": "BSD-3-Clause",
"author": "JupyterLite Contributors",
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
"src/**/*.{ts,tsx}"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"style": "style/index.css",
"repository": {
"type": "git",
"url": "https://github.com/jupyterlite/javascript-kernel.git"
},
"workspaces": {
"packages": [
"packages/*"
]
},
"scripts": {
"build": "lerna run build",
"build:prod": "lerna run build:prod",
"build:test": "lerna run build:test",
"bump:js:version": "lerna version --no-push --force-publish --no-git-tag-version --yes",
"clean": "lerna run clean",
"install": "lerna bootstrap",
"install:dev": "yarn run build:prod && yarn run develop",
"install:extension": "jupyter labextension develop --overwrite .",
"eslint": "eslint . --ext .ts,.tsx --fix",
"eslint:check": "eslint . --ext .ts,.tsx",
"lint": "yarn run eslint && yarn run prettier",
"lint:check": "yarn run eslint:check && yarn run prettier:check",
"prettier": "prettier --write \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
"prettier:check": "prettier --list-different \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
"publish": "yarn run clean && yarn run build && lerna publish",
"test": "lerna run test",
"watch": "lerna run watch"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.32.0",
"@typescript-eslint/parser": "^4.32.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"lerna": "^6.4.1",
"lint-staged": "^10.4.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"shell-quote": "^1.7.2"
},
"workspaces": {
"packages": [
"packages/*"
]
},
"scripts": {
"build": "lerna run build",
"build:prod": "lerna run build:prod",
"build:test": "lerna run build:test",
"bump:js:version": "lerna version --no-push --force-publish --no-git-tag-version --yes",
"clean": "lerna run clean",
"install": "lerna bootstrap",
"install:dev": "yarn run build:prod && yarn run develop",
"install:extension": "jupyter labextension develop --overwrite .",
"eslint": "eslint . --ext .ts,.tsx --fix",
"eslint:check": "eslint . --ext .ts,.tsx",
"lint": "yarn run eslint && yarn run prettier",
"lint:check": "yarn run eslint:check && yarn run prettier:check",
"prettier": "prettier --write \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
"prettier:check": "prettier --list-different \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
"publish": "yarn run clean && yarn run build && lerna publish",
"test": "lerna run test",
"watch": "lerna run watch"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6",
"@typescript-eslint/parser": "^6",
"eslint": "^8",
"eslint-config-prettier": "^8",
"eslint-plugin-prettier": "^5",
"lerna": "^6.4.1",
"prettier": "^3",
"rimraf": "^3.0.2"
},
"eslintIgnore": [
"node_modules",
"dist",
Expand All @@ -78,7 +67,7 @@
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"project": "tsconfig.eslint.json",
"sourceType": "module"
},
"plugins": [
Expand Down
12 changes: 3 additions & 9 deletions packages/javascript-kernel-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"name": "@jupyterlite/javascript-kernel-extension",
"version": "0.2.3",
"description": "JupyterLite - JavaScript Kernel Extension",
"homepage": "https://github.com/jupyterlite/jupyterlite",
"homepage": "https://github.com/jupyterlite/javascript-kernel",
"bugs": {
"url": "https://github.com/jupyterlite/jupyterlite/issues"
"url": "https://github.com/jupyterlite/javascript-kernel/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/jupyterlite/jupyterlite.git"
"url": "https://github.com/jupyterlite/javascript-kernel.git"
},
"license": "BSD-3-Clause",
"author": "JupyterLite Contributors",
Expand Down Expand Up @@ -39,19 +39,13 @@
"watch:src": "tsc -w"
},
"dependencies": {
"@jupyterlab/coreutils": "~6.1.1",
"@jupyterlite/javascript-kernel": "^0.2.1",
"@jupyterlite/kernel": "^0.2.1",
"@jupyterlite/server": "^0.2.1"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/preset-env": "^7.12.1",
"@jupyterlab/builder": "~4.1.1",
"@types/jest": "^29.5.3",
"jest": "^29.6.2",
"rimraf": "~5.0.1",
"ts-jest": "^29.1.1",
"typescript": "~5.1.6"
},
"publishConfig": {
Expand Down
7 changes: 7 additions & 0 deletions packages/javascript-kernel-extension/src/declarations.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

declare module '*.png' {
const value: string;
export default value;
}
22 changes: 13 additions & 9 deletions packages/javascript-kernel-extension/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

import { PageConfig, URLExt } from '@jupyterlab/coreutils';

import { JupyterLiteServer, JupyterLiteServerPlugin } from '@jupyterlite/server';
import {
JupyterLiteServer,
JupyterLiteServerPlugin
} from '@jupyterlite/server';

import { IKernel, IKernelSpecs } from '@jupyterlite/kernel';

import { JavaScriptKernel } from '@jupyterlite/javascript-kernel';

import jsLogo32 from '../style/icons/logo-32x32.png';

import jsLogo64 from '../style/icons/logo-64x64.png';

/**
* A plugin to register the JavaScript kernel.
*/
Expand All @@ -17,23 +22,22 @@ const kernel: JupyterLiteServerPlugin<void> = {
autoStart: true,
requires: [IKernelSpecs],
activate: (app: JupyterLiteServer, kernelspecs: IKernelSpecs) => {
const baseUrl = PageConfig.getBaseUrl();
kernelspecs.register({
spec: {
name: 'javascript',
display_name: 'JavaScript (Web Worker)',
language: 'javascript',
argv: [],
resources: {
'logo-32x32': '',
'logo-64x64': URLExt.join(baseUrl, '/kernelspecs/javascript.svg'),
},
'logo-32x32': jsLogo32,
'logo-64x64': jsLogo64
}
},
create: async (options: IKernel.IOptions): Promise<IKernel> => {
return new JavaScriptKernel(options);
},
}
});
},
}
};

const plugins: JupyterLiteServerPlugin<any>[] = [kernel];
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 1 addition & 11 deletions packages/javascript-kernel-extension/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,5 @@
"rootDir": "src"
},
"include": ["src/**/*"],
"references": [
{
"path": "../../packages/kernel"
},
{
"path": "../../packages/javascript-kernel"
},
{
"path": "../../packages/server"
}
]
"references": [{ "path": "../javascript-kernel" }]
}
6 changes: 3 additions & 3 deletions packages/javascript-kernel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"name": "@jupyterlite/javascript-kernel",
"version": "0.2.3",
"description": "JupyterLite - JavaScript Kernel",
"homepage": "https://github.com/jupyterlite/jupyterlite",
"homepage": "https://github.com/jupyterlite/javascript-kernel",
"bugs": {
"url": "https://github.com/jupyterlite/jupyterlite/issues"
"url": "https://github.com/jupyterlite/javascript-kernel/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/jupyterlite/jupyterlite.git"
"url": "https://github.com/jupyterlite/javascript-kernel.git"
},
"license": "BSD-3-Clause",
"author": "JupyterLite Contributors",
Expand Down
Loading

0 comments on commit 6534151

Please sign in to comment.