Skip to content

Commit

Permalink
Merge pull request #119 from blink1073/test-upgrade-script
Browse files Browse the repository at this point in the history
Upgrade extensions for JupyterLab 3.0
  • Loading branch information
jtpio authored Sep 15, 2020
2 parents e7054af + ea78b87 commit ab5aefa
Show file tree
Hide file tree
Showing 115 changed files with 2,772 additions and 411 deletions.
28 changes: 16 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ jobs:
restore-keys: |
${{ runner.os }}-pip-
- name: Install the Python dependencies
run: python -m pip install jupyterlab
run: |
python -m pip install --upgrade pip
python -m pip install jupyter_packaging
python -m pip install --pre jupyterlab
- name: Install the NPM dependencies
run: |
cd ${EXAMPLE_FOLDER}
Expand All @@ -91,9 +94,12 @@ jobs:
- name: Build and check by extension
run: |
cd ${EXAMPLE_FOLDER}
jlpm run build
jupyter labextension install .
pip install -e .
jupyter labextension list 1>labextensions 2>&1
cat labextensions
cat labextensions | grep -i "@jupyterlab-examples/*.*OK"
python -m jupyterlab.browser_check
pip uninstall -y $(python setup.py --name)
env:
EXAMPLE_FOLDER: ${{ matrix.example }}
shell: bash
Expand Down Expand Up @@ -145,8 +151,9 @@ jobs:
${{ runner.os }}-pip-
- name: Install the Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install jupyter_packaging
python -m pip install jupyterlab
python -m pip install --pre jupyterlab
- name: Install the NPM dependencies
run: |
cd advanced/server-extension
Expand All @@ -161,31 +168,29 @@ jobs:
cd advanced/server-extension
python setup.py sdist
pip install jlab_ext_example --pre --find-links=dist --no-cache-dir
jupyter lab build
python -m jupyterlab.browser_check
- name: Check extension as dev
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS')
run: |
jupyter serverextension list 1>serverextensions 2>&1
jupyter server extension list 1>serverextensions 2>&1
cat serverextensions | grep "jlab_ext_example.*OK"
jupyter labextension list 1>labextensions 2>&1
cat labextensions | grep "@jupyterlab-examples/server-extension.*OK"
- name: Clean extension installation
run: |
pip uninstall -y jlab_ext_example
jupyter lab clean
jupyter serverextension list
jupyter server extension list
jupyter labextension list
- name: Build extension as dev
run: |
cd advanced/server-extension
pip install -e .
jupyter serverextension enable --py jlab_ext_example
jupyter labextension install .
jupyter server extension enable --py jlab_ext_example
- name: Check extension as dev
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS')
run: |
jupyter serverextension list 1>serverextensions 2>&1
jupyter server extension list 1>serverextensions 2>&1
cat serverextensions | grep "jlab_ext_example.*OK"
jupyter labextension list 1>labextensions 2>&1
cat labextensions | grep "@jupyterlab-examples/server-extension.*OK"
Expand Down Expand Up @@ -231,12 +236,11 @@ jobs:
restore-keys: |
${{ runner.os }}-pip-
- name: Install the Python dependencies
run: python -m pip install jupyterlab
run: python -m pip install --pre jupyterlab
- name: Bootstrap the jlpm deps
run: jlpm
- name: Build all the extensions
run: |
jlpm build-ext
jlpm lint:check
jlpm install-ext
jlpm build-jlab
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ node_modules/
*.lock
# Ensure embedme does not run ont node_modules README.md files.
**/node_modules/**/README.md

static
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
**/node_modules
**/lib
**/package.json
**/static
22 changes: 22 additions & 0 deletions advanced/kernel-messaging/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
include LICENSE
include README.md
include pyproject.toml
include jupyter-config/jupyterlab_examples_kernel_messaging.json

include package.json
include ts*.json

graft jupyterlab_examples_kernel_messaging/static

# Javascript files
graft src
graft style
prune **/node_modules
prune lib

# Patterns to exclude from any directory
global-exclude *~
global-exclude *.pyc
global-exclude *.pyo
global-exclude .git
global-exclude .ipynb_checkpoints
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

import json
import os.path as osp

from ._version import __version__

HERE = osp.abspath(osp.dirname(__file__))

with open(osp.join(HERE, 'static', 'package.json')) as fid:
data = json.load(fid)

def _jupyter_labextension_paths():
return [{
'src': 'static',
'dest': data['name']
}]



Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
version_info = (0, 1, 0)
__version__ = ".".join(map(str, version_info))
54 changes: 33 additions & 21 deletions advanced/kernel-messaging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,40 +25,52 @@
"url": "https://github.com/jupyterlab/extension-examples.git"
},
"scripts": {
"build": "tsc",
"clean": "rimraf lib tsconfig.tsbuildinfo",
"install-ext": "jupyter labextension install . --no-build",
"prepare": "jlpm run clean && jlpm run build",
"build": "jlpm run build:lib",
"build:all": "jlpm run build:lib && jlpm run build:labextension",
"build:labextension": "jupyter labextension build .",
"build:lib": "tsc",
"clean": "jlpm run clean:lib",
"clean:all": "jlpm run clean:lib && jlpm run clean:labextension",
"clean:labextension": "rimraf jupyterlab_examples_kernel_messaging/static",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"eslint": "eslint . --ext .ts,.tsx --fix",
"eslint:check": "eslint . --ext .ts,.tsx",
"watch": "tsc -w"
"install:extension": "jupyter labextension develop --overwrite .",
"prepare": "jlpm run clean && jlpm run build",
"watch": "run-p watch:src watch:labextension",
"watch:labextension": "jupyter labextension watch .",
"watch:src": "tsc -w"
},
"dependencies": {
"@jupyterlab/application": "^2.0.0",
"@jupyterlab/launcher": "^2.0.0",
"@jupyterlab/mainmenu": "^2.0.0",
"@jupyterlab/nbformat": "^2.0.0",
"@lumino/algorithm": "^1.2.3",
"@lumino/coreutils": "^1.3.1",
"@jupyterlab/application": "~3.0.0-beta.4",
"@jupyterlab/launcher": "~3.0.0-beta.4",
"@jupyterlab/mainmenu": "~3.0.0-beta.4",
"@jupyterlab/nbformat": "~3.0.0-beta.4",
"@lumino/algorithm": "^1.3.3",
"@lumino/coreutils": "^1.5.3",
"@lumino/datagrid": "^0.5.2",
"@lumino/disposable": "^1.3.1",
"@lumino/widgets": "^1.11.0"
"@lumino/disposable": "^1.4.3",
"@lumino/widgets": "^1.14.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^2.21.0",
"@typescript-eslint/parser": "^2.21.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"@jupyterlab/builder": "^3.0.0-beta.4",
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"eslint": "^7.5.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-jsdoc": "^22.0.0",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.18.3",
"rimraf": "^3.0.0",
"typescript": "~3.7.5"
"npm-run-all": "^4.1.5",
"prettier": "^1.19.0",
"rimraf": "^3.0.2",
"typescript": "~3.9.0"
},
"sideEffects": [
"style/*.css"
],
"jupyterlab": {
"extension": true
"extension": true,
"outputDir": "jupyterlab_examples_kernel_messaging/static"
}
}
}
3 changes: 3 additions & 0 deletions advanced/kernel-messaging/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["jupyter_packaging~=0.7.0", "jupyterlab~=3.0.0b4", "setuptools>=40.8.0", "wheel"]
build-backend = "setuptools.build_meta"
85 changes: 85 additions & 0 deletions advanced/kernel-messaging/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
"""
jupyterlab_examples_kernel_messaging setup
"""
import os

from jupyter_packaging import (
create_cmdclass, install_npm, ensure_targets,
combine_commands, get_version,
)
import setuptools

HERE = os.path.abspath(os.path.dirname(__file__))

# The name of the project
name="jupyterlab_examples_kernel_messaging"

# Get our version
version = get_version(os.path.join(name, "_version.py"))

lab_path = os.path.join(HERE, name, "static")

# Representative files that should exist after a successful build
jstargets = [
os.path.join(HERE, "lib", "index.js"),
os.path.join(HERE, name, "static", "package.json"),
]

package_data_spec = {
name: [
"*"
]
}

labext_name = "@jupyterlab-examples/kernel-messaging"

data_files_spec = [
("share/jupyter/labextensions/%s" % labext_name, lab_path, "*.*"),
]

cmdclass = create_cmdclass("jsdeps",
package_data_spec=package_data_spec,
data_files_spec=data_files_spec
)

cmdclass["jsdeps"] = combine_commands(
install_npm(HERE, build_cmd="build:all", npm=["jlpm"]),
ensure_targets(jstargets),
)

with open("README.md", "r") as fh:
long_description = fh.read()

setup_args = dict(
name=name,
version=version,
url="https://github.com/jupyterlab/extension-examples.git",
author="Project Jupyter Contributors",
description="minimal lab example",
long_description= long_description,
long_description_content_type="text/markdown",
cmdclass= cmdclass,
packages=setuptools.find_packages(),
install_requires=[
"jupyterlab~=3.0.0b4",
],
zip_safe=False,
include_package_data=True,
python_requires=">=3.6",
license="BSD-3-Clause",
platforms="Linux, Mac OS X, Windows",
keywords=["Jupyter", "JupyterLab"],
classifiers=[
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Framework :: Jupyter",
],
)


if __name__ == "__main__":
setuptools.setup(**setup_args)
22 changes: 22 additions & 0 deletions advanced/kernel-output/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
include LICENSE
include README.md
include pyproject.toml
include jupyter-config/jupyterlab_examples_kernel_output.json

include package.json
include ts*.json

graft jupyterlab_examples_kernel_output/static

# Javascript files
graft src
graft style
prune **/node_modules
prune lib

# Patterns to exclude from any directory
global-exclude *~
global-exclude *.pyc
global-exclude *.pyo
global-exclude .git
global-exclude .ipynb_checkpoints
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

import json
import os.path as osp

from ._version import __version__

HERE = osp.abspath(osp.dirname(__file__))

with open(osp.join(HERE, 'static', 'package.json')) as fid:
data = json.load(fid)

def _jupyter_labextension_paths():
return [{
'src': 'static',
'dest': data['name']
}]



Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
version_info = (0, 1, 0)
__version__ = ".".join(map(str, version_info))
Loading

0 comments on commit ab5aefa

Please sign in to comment.