Skip to content

Commit

Permalink
Use Jupyter labextension cookiecutter
Browse files Browse the repository at this point in the history
  • Loading branch information
twavv committed Sep 9, 2021
1 parent b4622cd commit 80b4473
Show file tree
Hide file tree
Showing 31 changed files with 1,440 additions and 135 deletions.
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"private": true,
"workspaces": [
"./webio_jupyterlab_provider",
"./packages/*"
]
}
11 changes: 0 additions & 11 deletions packages/jupyter-lab-provider/README.md

This file was deleted.

44 changes: 0 additions & 44 deletions packages/jupyter-lab-provider/package.json

This file was deleted.

16 changes: 0 additions & 16 deletions packages/jupyter-lab-provider/tsconfig.json

This file was deleted.

10 changes: 0 additions & 10 deletions packages/jupyter-lab-provider/webpack.config.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"packages": [
"blink-provider",
"generic-http-provider",
"jupyter-lab-provider",
"jupyter-notebook-provider",
"mux-provider",
"webio"
Expand Down
1 change: 0 additions & 1 deletion packages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"dependencies": {
"@webio/blink-provider": "file:blink-provider",
"@webio/generic-http-provider": "file:generic-http-provider",
"@webio/jupyter-lab-provider": "file:jupyter-lab-provider",
"@webio/jupyter-notebook-provider": "file:jupyter-notebook-provider",
"@webio/mux-provider": "file:mux-provider",
"@webio/webio": "file:webio"
Expand Down
4 changes: 0 additions & 4 deletions packages/webio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
"build-prod": "npm run build && webpack -p"
},
"devDependencies": {
<<<<<<< HEAD
"typescript": "^4.4.2",
=======
"typescript": "^4.3.2",
>>>>>>> eac891b (WIP: JupyterLab 3 compatibility)
"webpack": "^4.35.3"
},
"gitHead": "a17bcee97d64897d0e9b429a8551f19eedc47091"
Expand Down
7 changes: 6 additions & 1 deletion src/providers/ijulia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ function main()
@warn "IJulia doesn't have register_mime; WebIO may not work as expected. Please upgrade to IJulia v1.13.0 or greater."
end

# TODO: this actually doesn't really *do* anything (I think...)
# Seems it ended up just being left here mostly as an accident of history.
# It would probably just be better to display a single bundle containing both
# an empty WebIO node AND text/html with information about how to install the
# WebIO extension (probably linking to the docs).
script_id = "webio-setup-$(rand(UInt64))"
warning_div_id = "webio-warning-$(rand(UInt64))"
setup_script = js"""
Expand Down Expand Up @@ -69,7 +74,7 @@ function main()
return;
}
} else if (window.location.pathname.includes("/lab")) {
// Guessing JupyterLa
// Guessing JupyterLab
console.log("Jupyter Lab detected; make sure the @webio/jupyter-lab-provider labextension is installed.");
hide();
return;
Expand Down
5 changes: 5 additions & 0 deletions webio_jupyterlab_provider/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
dist
coverage
**/*.d.ts
tests
24 changes: 24 additions & 0 deletions webio_jupyterlab_provider/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended'
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module'
},
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
curly: ['error', 'all'],
eqeqeq: 'error',
'prefer-arrow-callback': 'error'
}
};
1 change: 1 addition & 0 deletions webio_jupyterlab_provider/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.yarn/**/* binary
96 changes: 96 additions & 0 deletions webio_jupyterlab_provider/.github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Build

on:
push:
branches: main
pull_request:
branches: '*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '14.x'
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
architecture: 'x64'


- name: Setup pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-3.8-${{ hashFiles('package.json') }}
restore-keys: |
pip-3.8-
pip-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-
- name: Install dependencies
run: python -m pip install -U jupyterlab~=3.1 check-manifest
- name: Build the extension
run: |
set -eux
jlpm
jlpm run eslint:check
python -m pip install .
jupyter labextension list 2>&1 | grep -ie "webio-jupyterlab-provider.*OK"
python -m jupyterlab.browser_check
check-manifest -v
pip install build
python -m build --sdist
cp dist/*.tar.gz myextension.tar.gz
pip uninstall -y myextension jupyterlab
rm -rf myextension
- uses: actions/upload-artifact@v2
with:
name: myextension-sdist
path: myextension.tar.gz

test_isolated:
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
architecture: 'x64'
- uses: actions/download-artifact@v2
with:
name: myextension-sdist
- name: Install and Test
run: |
set -eux
# Remove NodeJS, twice to take care of system and locally installed node versions.
sudo rm -rf $(which node)
sudo rm -rf $(which node)
pip install myextension.tar.gz
pip install jupyterlab
jupyter labextension list 2>&1 | grep -ie "webio-jupyterlab-provider.*OK"
python -m jupyterlab.browser_check --no-chrome-test
123 changes: 123 additions & 0 deletions webio_jupyterlab_provider/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
*.bundle.*
lib/
node_modules/
*.egg-info/
.ipynb_checkpoints
*.tsbuildinfo

# Ignore the built JS extension files
webio_jupyterlab_provider/labextension

# Ignore Yarn files (note: we're not using zero installs)
.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*

# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# End of https://www.gitignore.io/api/python

# OSX files
.DS_Store
Loading

0 comments on commit 80b4473

Please sign in to comment.