Skip to content

Commit aa28114

Browse files
jtpiofcollonval
authored andcommitted
Update all examples
Update eslint-plugin-jsdoc Update jupyter_packaging on CI Update .eslintrc.js Lint and align prettier versions Update author
1 parent b534037 commit aa28114

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+1699
-1471
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
- name: Install the Python dependencies
9090
if: steps.filter.outputs.extension == 'true'
9191
run: |
92-
python -m pip install --upgrade pip jupyter_packaging~=0.7.9 jupyterlab~=3.0
92+
python -m pip install --upgrade pip jupyter_packaging~=0.10 jupyterlab~=3.0
9393
- name: Install the NPM dependencies
9494
if: steps.filter.outputs.extension == 'true'
9595
run: |
@@ -179,7 +179,7 @@ jobs:
179179
- name: Install the Python dependencies
180180
if: steps.filter.outputs.extension == 'true'
181181
run: |
182-
python -m pip install --upgrade pip jupyter_packaging~=0.7.9 jupyterlab~=3.0
182+
python -m pip install --upgrade pip jupyter_packaging~=0.10 jupyterlab~=3.0
183183
- name: Install the NPM dependencies
184184
if: steps.filter.outputs.extension == 'true'
185185
run: |
@@ -262,7 +262,7 @@ jobs:
262262
restore-keys: |
263263
${{ runner.os }}-pip-
264264
- name: Install the Python dependencies
265-
run: python -m pip install jupyter_packaging~=0.7.9 jupyterlab~=3.0 pytest pytest-check-links
265+
run: python -m pip install jupyter_packaging~=0.10 jupyterlab~=3.0 pytest pytest-check-links
266266
- name: Bootstrap the jlpm deps
267267
run: jlpm
268268
- name: Build all the extensions

command-palette/.eslintrc.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,49 @@ module.exports = {
55
'plugin:@typescript-eslint/recommended',
66
'plugin:jsdoc/recommended',
77
'plugin:prettier/recommended',
8-
'plugin:react/recommended'
8+
'plugin:react/recommended',
99
],
1010
parser: '@typescript-eslint/parser',
1111
parserOptions: {
1212
project: 'tsconfig.json',
13-
sourceType: 'module'
13+
sourceType: 'module',
1414
},
1515
plugins: ['@typescript-eslint', 'jsdoc'],
1616
rules: {
17-
'@typescript-eslint/interface-name-prefix': [
17+
'@typescript-eslint/naming-convention': [
1818
'error',
19-
{ prefixWithI: 'always' }
19+
{
20+
selector: 'interface',
21+
format: ['PascalCase'],
22+
custom: {
23+
regex: '^I[A-Z]',
24+
match: true,
25+
},
26+
},
2027
],
2128
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
2229
'@typescript-eslint/no-explicit-any': 'off',
23-
'@typescript-eslint/camelcase': 'warn',
2430
'@typescript-eslint/no-namespace': 'off',
2531
'@typescript-eslint/no-use-before-define': 'off',
2632
'@typescript-eslint/quotes': [
2733
'error',
2834
'single',
29-
{ avoidEscape: true, allowTemplateLiterals: false }
35+
{ avoidEscape: true, allowTemplateLiterals: false },
3036
],
3137
curly: ['error', 'all'],
3238
eqeqeq: 'error',
3339
'jsdoc/require-param-type': 'off',
3440
'jsdoc/require-property-type': 'off',
3541
'jsdoc/require-returns-type': 'off',
3642
'jsdoc/no-types': 'warn',
37-
'prefer-arrow-callback': 'error'
43+
'prefer-arrow-callback': 'error',
3844
},
3945
settings: {
4046
jsdoc: {
41-
mode: 'typescript'
47+
mode: 'typescript',
4248
},
4349
react: {
44-
version: 'detect'
45-
}
46-
}
50+
version: 'detect',
51+
},
52+
},
4753
};

command-palette/package.json

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@
1212
"url": "https://github.com/jupyterlab/extension-examples/issues"
1313
},
1414
"license": "BSD-3-Clause",
15-
"author": "Project Jupyter Contributors",
15+
"author": {
16+
"name": "Project Jupyter Contributors",
17+
"email": ""
18+
},
1619
"files": [
1720
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
18-
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
21+
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
22+
"style/index.js"
1923
],
2024
"main": "lib/index.js",
2125
"types": "lib/index.d.ts",
@@ -30,41 +34,43 @@
3034
"build:labextension": "jupyter labextension build .",
3135
"build:labextension:dev": "jupyter labextension build --development True .",
3236
"build:lib": "tsc",
33-
"build:prod": "jlpm run build:lib && jlpm run build:labextension",
37+
"build:prod": "jlpm run clean && jlpm run build:lib && jlpm run build:labextension",
3438
"clean": "jlpm run clean:lib",
3539
"clean:all": "jlpm run clean:lib && jlpm run clean:labextension",
3640
"clean:labextension": "rimraf jupyterlab_examples_command_palette/labextension",
3741
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
3842
"eslint": "eslint . --ext .ts,.tsx --fix",
3943
"eslint:check": "eslint . --ext .ts,.tsx",
40-
"install:extension": "jupyter labextension develop --overwrite .",
44+
"install:extension": "jlpm run build",
4145
"prepare": "jlpm run clean && jlpm run build:prod",
4246
"watch": "run-p watch:src watch:labextension",
4347
"watch:labextension": "jupyter labextension watch .",
4448
"watch:src": "tsc -w"
4549
},
4650
"dependencies": {
47-
"@jupyterlab/application": "^3.0.0-rc.15"
51+
"@jupyterlab/application": "^3.0.10"
4852
},
4953
"devDependencies": {
50-
"@jupyterlab/builder": "^3.0.0-rc.15",
51-
"@typescript-eslint/eslint-plugin": "^2.27.0",
52-
"@typescript-eslint/parser": "^2.27.0",
53-
"eslint": "^7.5.0",
54-
"eslint-config-prettier": "^6.10.1",
55-
"eslint-plugin-jsdoc": "^22.0.0",
56-
"eslint-plugin-prettier": "^3.1.2",
54+
"@jupyterlab/builder": "^3.0.0",
55+
"@typescript-eslint/eslint-plugin": "^4.8.1",
56+
"@typescript-eslint/parser": "^4.8.1",
57+
"eslint": "^7.14.0",
58+
"eslint-config-prettier": "^6.15.0",
59+
"eslint-plugin-jsdoc": "^34.0.0",
60+
"eslint-plugin-prettier": "^3.1.4",
5761
"eslint-plugin-react": "^7.18.3",
5862
"npm-run-all": "^4.1.5",
59-
"prettier": "^1.19.0",
63+
"prettier": "^2.1.1",
6064
"rimraf": "^3.0.2",
6165
"typescript": "~4.1.3"
6266
},
6367
"sideEffects": [
64-
"style/*.css"
68+
"style/*.css",
69+
"style/index.js"
6570
],
6671
"jupyterlab": {
6772
"extension": true,
6873
"outputDir": "jupyterlab_examples_command_palette/labextension"
69-
}
74+
},
75+
"styleModule": "style/index.js"
7076
}

command-palette/pyproject.toml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
[build-system]
2-
requires = ["jupyter_packaging~=0.7.9", "jupyterlab>=3.0.0rc15,==3.*", "setuptools>=40.8.0", "wheel"]
3-
build-backend = "setuptools.build_meta"
2+
requires = ["jupyter_packaging~=0.10,<2", "jupyterlab~=3.0"]
3+
build-backend = "jupyter_packaging.build_api"
4+
5+
[tool.jupyter-packaging.options]
6+
skip-if-exists = ["jupyterlab_examples_command_palette/labextension/static/style.js"]
7+
ensured-targets = ["jupyterlab_examples_command_palette/labextension/static/style.js", "jupyterlab_examples_command_palette/labextension/package.json"]
8+
9+
[tool.jupyter-packaging.builder]
10+
factory = "jupyter_packaging.npm_builder"
11+
12+
[tool.jupyter-packaging.build-args]
13+
build_cmd = "build:prod"
14+
npm = ["jlpm"]
15+
16+
[tool.check-manifest]
17+
ignore = ["jupyterlab_examples_command_palette/labextension/**", "yarn.lock", ".*", "package-lock.json"]

command-palette/setup.py

Lines changed: 34 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,79 +2,52 @@
22
jupyterlab_examples_command_palette setup
33
"""
44
import json
5-
import os
5+
from pathlib import Path
66

7-
from jupyter_packaging import (
8-
create_cmdclass, install_npm, ensure_targets,
9-
combine_commands, skip_if_exists
10-
)
117
import setuptools
128

13-
HERE = os.path.abspath(os.path.dirname(__file__))
9+
HERE = Path(__file__).parent.resolve()
1410

1511
# The name of the project
16-
name="jupyterlab_examples_command_palette"
17-
18-
# Get our version
19-
with open(os.path.join(HERE, 'package.json')) as f:
20-
version = json.load(f)['version']
12+
name = "jupyterlab_examples_command_palette"
2113

22-
lab_path = os.path.join(HERE, name, "labextension")
14+
lab_path = (HERE / name / "labextension")
2315

2416
# Representative files that should exist after a successful build
25-
jstargets = [
26-
os.path.join(lab_path, "package.json"),
17+
ensured_targets = [
18+
str(lab_path / "package.json"),
19+
str(lab_path / "static/style.js")
2720
]
2821

29-
package_data_spec = {
30-
name: [
31-
"*"
32-
]
33-
}
34-
3522
labext_name = "@jupyterlab-examples/command-palette"
3623

3724
data_files_spec = [
38-
("share/jupyter/labextensions/%s" % labext_name, lab_path, "**"),
39-
("share/jupyter/labextensions/%s" % labext_name, HERE, "install.json"),
25+
("share/jupyter/labextensions/%s" % labext_name, str(lab_path), "**"),
26+
("share/jupyter/labextensions/%s" % labext_name, str(HERE), "install.json"),
4027
]
4128

42-
cmdclass = create_cmdclass("jsdeps",
43-
package_data_spec=package_data_spec,
44-
data_files_spec=data_files_spec
45-
)
46-
47-
js_command = combine_commands(
48-
install_npm(HERE, build_cmd="build:prod", npm=["jlpm"]),
49-
ensure_targets(jstargets),
50-
)
51-
52-
is_repo = os.path.exists(os.path.join(HERE, ".git"))
53-
if is_repo:
54-
cmdclass["jsdeps"] = js_command
55-
else:
56-
cmdclass["jsdeps"] = skip_if_exists(jstargets, js_command)
29+
long_description = (HERE / "README.md").read_text()
5730

58-
with open("README.md", "r") as fh:
59-
long_description = fh.read()
31+
# Get the package info from package.json
32+
pkg_json = json.loads((HERE / "package.json").read_bytes())
6033

6134
setup_args = dict(
6235
name=name,
63-
version=version,
64-
url="https://github.com/jupyterlab/extension-examples.git",
65-
author="Project Jupyter Contributors",
66-
description="Minimal JupyterLab example adding a new command to the palette.",
67-
long_description= long_description,
36+
version=pkg_json["version"],
37+
url=pkg_json["homepage"],
38+
author=pkg_json["author"]["name"],
39+
author_email=pkg_json["author"]["email"],
40+
description=pkg_json["description"],
41+
license=pkg_json["license"],
42+
long_description=long_description,
6843
long_description_content_type="text/markdown",
69-
cmdclass= cmdclass,
7044
packages=setuptools.find_packages(),
7145
install_requires=[
72-
"jupyterlab>=3.0.0rc15,==3.*",
46+
"jupyter_server>=1.6,<2"
7347
],
7448
zip_safe=False,
7549
include_package_data=True,
7650
python_requires=">=3.6",
77-
license="BSD-3-Clause",
7851
platforms="Linux, Mac OS X, Windows",
7952
keywords=["Jupyter", "JupyterLab", "JupyterLab3"],
8053
classifiers=[
@@ -84,10 +57,24 @@
8457
"Programming Language :: Python :: 3.6",
8558
"Programming Language :: Python :: 3.7",
8659
"Programming Language :: Python :: 3.8",
60+
"Programming Language :: Python :: 3.9",
8761
"Framework :: Jupyter",
8862
],
8963
)
9064

65+
try:
66+
from jupyter_packaging import (
67+
wrap_installers,
68+
npm_builder,
69+
get_data_files
70+
)
71+
post_develop = npm_builder(
72+
build_cmd="install:extension", source_dir="src", build_dir=lab_path
73+
)
74+
setup_args['cmdclass'] = wrap_installers(post_develop=post_develop, ensured_targets=ensured_targets)
75+
setup_args['data_files'] = get_data_files(data_files_spec)
76+
except ImportError as e:
77+
pass
9178

9279
if __name__ == "__main__":
9380
setuptools.setup(**setup_args)

command-palette/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
22
JupyterFrontEnd,
3-
JupyterFrontEndPlugin
3+
JupyterFrontEndPlugin,
44
} from '@jupyterlab/application';
55

66
import { ICommandPalette } from '@jupyterlab/apputils';
@@ -25,13 +25,13 @@ const extension: JupyterFrontEndPlugin<void> = {
2525
console.log(
2626
`jlab-examples:command-palette has been called ${args['origin']}.`
2727
);
28-
}
28+
},
2929
});
3030

3131
// Add the command to the command palette
3232
const category = 'Extension Examples';
3333
palette.addItem({ command, category, args: { origin: 'from palette' } });
34-
}
34+
},
3535
};
3636

3737
export default extension;

commands/.eslintrc.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,49 @@ module.exports = {
55
'plugin:@typescript-eslint/recommended',
66
'plugin:jsdoc/recommended',
77
'plugin:prettier/recommended',
8-
'plugin:react/recommended'
8+
'plugin:react/recommended',
99
],
1010
parser: '@typescript-eslint/parser',
1111
parserOptions: {
1212
project: 'tsconfig.json',
13-
sourceType: 'module'
13+
sourceType: 'module',
1414
},
1515
plugins: ['@typescript-eslint', 'jsdoc'],
1616
rules: {
17-
'@typescript-eslint/interface-name-prefix': [
17+
'@typescript-eslint/naming-convention': [
1818
'error',
19-
{ prefixWithI: 'always' }
19+
{
20+
selector: 'interface',
21+
format: ['PascalCase'],
22+
custom: {
23+
regex: '^I[A-Z]',
24+
match: true,
25+
},
26+
},
2027
],
2128
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
2229
'@typescript-eslint/no-explicit-any': 'off',
23-
'@typescript-eslint/camelcase': 'warn',
2430
'@typescript-eslint/no-namespace': 'off',
2531
'@typescript-eslint/no-use-before-define': 'off',
2632
'@typescript-eslint/quotes': [
2733
'error',
2834
'single',
29-
{ avoidEscape: true, allowTemplateLiterals: false }
35+
{ avoidEscape: true, allowTemplateLiterals: false },
3036
],
3137
curly: ['error', 'all'],
3238
eqeqeq: 'error',
3339
'jsdoc/require-param-type': 'off',
3440
'jsdoc/require-property-type': 'off',
3541
'jsdoc/require-returns-type': 'off',
3642
'jsdoc/no-types': 'warn',
37-
'prefer-arrow-callback': 'error'
43+
'prefer-arrow-callback': 'error',
3844
},
3945
settings: {
4046
jsdoc: {
41-
mode: 'typescript'
47+
mode: 'typescript',
4248
},
4349
react: {
44-
version: 'detect'
45-
}
46-
}
50+
version: 'detect',
51+
},
52+
},
4753
};

0 commit comments

Comments
 (0)