Skip to content

Commit b449522

Browse files
committed
Add JupyterLab extension
1 parent c1545db commit b449522

32 files changed

+4277
-639
lines changed

.eslintignore

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
# don't ever lint node_modules
21
node_modules
3-
# don't lint distribute package output
42
dist
5-
# don't lint build folder output
63
build
7-
# don't lint coverage output
84
coverage
95
# don't lint storybook files
106
.storybook/
117
# don't lint stories
12-
*.stories.*
8+
*.stories.*
9+
**/*.d.ts
10+
tests

.eslintrc.js

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,41 @@
11
module.exports = {
2-
extends: ['@microsoft/eslint-config-fast-dna', 'prettier'],
3-
rules: {
4-
'no-extra-boolean-cast': 'off',
5-
'@typescript-eslint/no-use-before-define': 'off',
6-
'@typescript-eslint/typedef': 'off',
7-
'@typescript-eslint/explicit-function-return-type': 'off',
8-
'@typescript-eslint/explicit-module-boundary-types': 'off',
9-
'@typescript-eslint/no-non-null-assertion': 'off',
10-
'@typescript-eslint/interface-name-prefix': 'off',
11-
},
2+
extends: [
3+
'eslint:recommended',
4+
'plugin:@typescript-eslint/eslint-recommended',
5+
'plugin:@typescript-eslint/recommended',
6+
'plugin:prettier/recommended'
7+
],
8+
parser: '@typescript-eslint/parser',
9+
parserOptions: {
10+
project: 'tsconfig.json',
11+
sourceType: 'module'
12+
},
13+
plugins: ['@typescript-eslint'],
14+
rules: {
15+
'@typescript-eslint/naming-convention': [
16+
'error',
17+
{
18+
'selector': 'interface',
19+
'format': ['PascalCase'],
20+
'custom': {
21+
'regex': '^I[A-Z]',
22+
'match': true
23+
}
24+
}
25+
],
26+
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
27+
'@typescript-eslint/no-explicit-any': 'off',
28+
'@typescript-eslint/no-namespace': 'off',
29+
'@typescript-eslint/no-use-before-define': 'off',
30+
'@typescript-eslint/quotes': [
31+
'error',
32+
'single',
33+
{ avoidEscape: true, allowTemplateLiterals: false }
34+
],
35+
curly: ['error', 'all'],
36+
eqeqeq: 'error',
37+
'prefer-arrow-callback': 'error'
38+
},
1239
overrides: [
1340
{
1441
files: ['*.ts'],

.github/workflows/build.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: main
6+
pull_request:
7+
branches: '*'
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
- name: Install node
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: '14.x'
19+
- name: Install Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: '3.8'
23+
architecture: 'x64'
24+
25+
26+
- name: Setup pip cache
27+
uses: actions/cache@v2
28+
with:
29+
path: ~/.cache/pip
30+
key: pip-3.8-${{ hashFiles('package.json') }}
31+
restore-keys: |
32+
pip-3.8-
33+
pip-
34+
35+
- name: Get yarn cache directory path
36+
id: yarn-cache-dir-path
37+
run: echo "::set-output name=dir::$(yarn cache dir)"
38+
- name: Setup yarn cache
39+
uses: actions/cache@v2
40+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
41+
with:
42+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
43+
key: yarn-${{ hashFiles('**/yarn.lock') }}
44+
restore-keys: |
45+
yarn-
46+
47+
- name: Install dependencies
48+
run: python -m pip install -U jupyterlab~=3.1 check-manifest
49+
- name: Build the extension
50+
run: |
51+
set -eux
52+
jlpm
53+
jlpm run eslint:check
54+
python -m pip install .
55+
56+
jupyter labextension list 2>&1 | grep -ie "jupyter-ui-demo.*OK"
57+
python -m jupyterlab.browser_check
58+
59+
check-manifest -v
60+
61+
pip install build
62+
python -m build --sdist
63+
cp dist/*.tar.gz myextension.tar.gz
64+
pip uninstall -y jupyter_ui_demo jupyterlab
65+
rm -rf myextension
66+
67+
- uses: actions/upload-artifact@v2
68+
with:
69+
name: myextension-sdist
70+
path: myextension.tar.gz
71+
72+
test_isolated:
73+
needs: build
74+
runs-on: ubuntu-latest
75+
76+
steps:
77+
- name: Checkout
78+
uses: actions/checkout@v2
79+
- name: Install Python
80+
uses: actions/setup-python@v2
81+
with:
82+
python-version: '3.8'
83+
architecture: 'x64'
84+
- uses: actions/download-artifact@v2
85+
with:
86+
name: myextension-sdist
87+
- name: Install and Test
88+
run: |
89+
set -eux
90+
# Remove NodeJS, twice to take care of system and locally installed node versions.
91+
sudo rm -rf $(which node)
92+
sudo rm -rf $(which node)
93+
pip install myextension.tar.gz
94+
pip install jupyterlab
95+
jupyter labextension list 2>&1 | grep -ie "jupyter-ui-demo.*OK"
96+
python -m jupyterlab.browser_check --no-chrome-test

.gitignore

Lines changed: 110 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,118 @@
1-
# Dependencies
1+
*.bundle.*
2+
lib/
23
node_modules/
4+
*.egg-info/
5+
.ipynb_checkpoints
6+
*.tsbuildinfo
7+
storybook-static/
8+
jupyter_ui_demo/labextension
9+
10+
# Created by https://www.gitignore.io/api/python
11+
# Edit at https://www.gitignore.io/?templates=python
12+
13+
### Python ###
14+
# Byte-compiled / optimized / DLL files
15+
__pycache__/
16+
*.py[cod]
17+
*$py.class
18+
19+
# C extensions
20+
*.so
321

4-
# Production
22+
# Distribution / packaging
23+
.Python
24+
build/
25+
develop-eggs/
526
dist/
6-
storybook-static/
27+
downloads/
28+
eggs/
29+
.eggs/
30+
lib/
31+
lib64/
32+
parts/
33+
sdist/
34+
var/
35+
wheels/
36+
pip-wheel-metadata/
37+
share/python-wheels/
38+
.installed.cfg
39+
*.egg
40+
MANIFEST
741

8-
# Misc
42+
# PyInstaller
43+
# Usually these files are written by a python script from a template
44+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
45+
*.manifest
46+
*.spec
47+
48+
# Installer logs
49+
pip-log.txt
50+
pip-delete-this-directory.txt
51+
52+
# Unit test / coverage reports
53+
htmlcov/
54+
.tox/
55+
.nox/
56+
.coverage
57+
.coverage.*
58+
.cache
59+
nosetests.xml
60+
coverage.xml
61+
*.cover
62+
.hypothesis/
63+
.pytest_cache/
64+
65+
# Translations
66+
*.mo
67+
*.pot
68+
69+
# Scrapy stuff:
70+
.scrapy
71+
72+
# Sphinx documentation
73+
docs/_build/
74+
75+
# PyBuilder
76+
target/
77+
78+
# pyenv
79+
.python-version
80+
81+
# celery beat schedule file
82+
celerybeat-schedule
83+
84+
# SageMath parsed files
85+
*.sage.py
86+
87+
# Spyder project settings
88+
.spyderproject
89+
.spyproject
90+
91+
# Rope project settings
92+
.ropeproject
93+
94+
# Mr Developer
95+
.mr.developer.cfg
96+
.project
97+
.pydevproject
98+
99+
# mkdocs documentation
100+
/site
101+
102+
# mypy
103+
.mypy_cache/
104+
.dmypy.json
105+
dmypy.json
106+
107+
# Pyre type checker
108+
.pyre/
109+
110+
# End of https://www.gitignore.io/api/python
111+
112+
# OSX files
9113
.DS_Store
114+
115+
# Misc
10116
.vscode
11117
.env.local
12118
.env.development.local

.prettierignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
# Dependencies
21
node_modules/
2+
**/node_modules
3+
**/lib
4+
jupyter_ui_demo
35

46
# Production
57
build/

.prettierrc

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,5 @@
11
{
2-
"printWidth": 80,
3-
"tabWidth": 4,
4-
"useTabs": true,
5-
"semi": true,
6-
"singleQuote": true,
7-
"quoteProps": "consistent",
8-
"jsxSingleQuote": false,
9-
"trailingComma": "es5",
10-
"bracketSpacing": false,
11-
"arrowParens": "avoid",
12-
"overrides": [
13-
{
14-
"files": "docs/*.md",
15-
"options": {
16-
"printWidth": 130,
17-
"singleQuote": false,
18-
"useTabs": false,
19-
"tabWidth": 2,
20-
"bracketSpacing": true
21-
}
22-
},
23-
{
24-
"files": "src/data-grid/README.md",
25-
"options": {
26-
"printWidth": 110
27-
}
28-
},
29-
{
30-
"files": "src/design-tokens.ts",
31-
"options": {
32-
"printWidth": 200
33-
}
34-
}
35-
]
2+
"singleQuote": true,
3+
"trailingComma": "none",
4+
"arrowParens": "avoid"
365
}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
<!-- <START NEW CHANGELOG ENTRY> -->
4+
5+
<!-- <END NEW CHANGELOG ENTRY> -->

0 commit comments

Comments
 (0)