Skip to content

Commit 4c49e0b

Browse files
committed
Jupyterlab 3 changes
- Applied upgrade helper script; - Updated the types for codemirror; Replied to the upgrade script with these ``` author_name [Ryan Tam]: python_name [ryantam626_jupyterlab_sublime]: jupyterlab_sublime labextension_name [@ryantam626/jupyterlab_sublime]: project_short_description [Sublime notebook cell binding for JupyterLab]: has_server_extension [n]: n has_binder [n]: n repository [https://github.com/ryantam626/jupyterlab_sublime.git]: overwrite scripts in package.json? [n]: y overwrite "README.md"? [n]: n overwrite "LICENSE"? [n]: overwrite "tsconfig.json"? [n]: y overwrite ".gitignore"? [n]: y overwrite "style/index.css"? [n]: y overwrite "src/index.ts"? [n]: y ```
1 parent 019fedf commit 4c49e0b

19 files changed

+4399
-25
lines changed

.eslintignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
dist
3+
coverage
4+
**/*.d.ts
5+
tests

.eslintrc.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module.exports = {
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/interface-name-prefix': [
16+
'error',
17+
{ prefixWithI: 'always' }
18+
],
19+
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
20+
'@typescript-eslint/no-explicit-any': 'off',
21+
'@typescript-eslint/no-namespace': 'off',
22+
'@typescript-eslint/no-use-before-define': 'off',
23+
'@typescript-eslint/quotes': [
24+
'error',
25+
'single',
26+
{ avoidEscape: true, allowTemplateLiterals: false }
27+
],
28+
curly: ['error', 'all'],
29+
eqeqeq: 'error',
30+
'prefer-arrow-callback': 'error'
31+
}
32+
};

.github/workflows/build.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: master
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: '10.x'
19+
- name: Install Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: '3.7'
23+
architecture: 'x64'
24+
- name: Install dependencies
25+
run: python -m pip install jupyterlab
26+
- name: Build the extension
27+
run: |
28+
jlpm
29+
jlpm run eslint:check
30+
python -m pip install .
31+
32+
jupyter labextension list 2>&1 | grep -ie "@ryantam626/jupyterlab_sublime.*OK"
33+
python -m jupyterlab.browser_check

.gitignore

+107
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,111 @@ lib/
33
node_modules/
44
*.egg-info/
55
.ipynb_checkpoints
6+
*.tsbuildinfo
7+
jupyterlab_sublime/labextension
8+
9+
# Created by https://www.gitignore.io/api/python
10+
# Edit at https://www.gitignore.io/?templates=python
11+
12+
### Python ###
13+
# Byte-compiled / optimized / DLL files
14+
__pycache__/
15+
*.py[cod]
16+
*$py.class
17+
18+
# C extensions
19+
*.so
20+
21+
# Distribution / packaging
22+
.Python
23+
build/
24+
develop-eggs/
25+
dist/
26+
downloads/
27+
eggs/
28+
.eggs/
29+
lib/
30+
lib64/
31+
parts/
32+
sdist/
33+
var/
34+
wheels/
35+
pip-wheel-metadata/
36+
share/python-wheels/
37+
.installed.cfg
38+
*.egg
39+
MANIFEST
40+
41+
# PyInstaller
42+
# Usually these files are written by a python script from a template
43+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
44+
*.manifest
45+
*.spec
46+
47+
# Installer logs
48+
pip-log.txt
49+
pip-delete-this-directory.txt
50+
51+
# Unit test / coverage reports
52+
htmlcov/
53+
.tox/
54+
.nox/
55+
.coverage
56+
.coverage.*
57+
.cache
58+
nosetests.xml
59+
coverage.xml
60+
*.cover
61+
.hypothesis/
62+
.pytest_cache/
63+
64+
# Translations
65+
*.mo
66+
*.pot
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# pyenv
78+
.python-version
79+
80+
# celery beat schedule file
81+
celerybeat-schedule
82+
83+
# SageMath parsed files
84+
*.sage.py
85+
86+
# Spyder project settings
87+
.spyderproject
88+
.spyproject
89+
90+
# Rope project settings
91+
.ropeproject
92+
93+
# Mr Developer
94+
.mr.developer.cfg
95+
.project
96+
.pydevproject
97+
98+
# mkdocs documentation
99+
/site
100+
101+
# mypy
102+
.mypy_cache/
103+
.dmypy.json
104+
dmypy.json
105+
106+
# Pyre type checker
107+
.pyre/
108+
109+
# End of https://www.gitignore.io/api/python
110+
111+
# OSX files
112+
.DS_Store
6113
.idea/

.prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
**/node_modules
3+
**/lib
4+
**/package.json

.prettierrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

MANIFEST.in

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
include LICENSE
2+
include README.md
3+
include pyproject.toml
4+
include jupyter-config/jupyterlab_sublime.json
5+
6+
include package.json
7+
include install.json
8+
include ts*.json
9+
include yarn.lock
10+
11+
graft jupyterlab_sublime/labextension
12+
13+
# Javascript files
14+
graft src
15+
graft style
16+
prune **/node_modules
17+
prune lib
18+
19+
# Patterns to exclude from any directory
20+
global-exclude *~
21+
global-exclude *.pyc
22+
global-exclude *.pyo
23+
global-exclude .git
24+
global-exclude .ipynb_checkpoints

Makefile

+4-9
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,15 @@ conda-freeze: ## Use conda to freeze the current env available
1919
conda-install-frozen: ## Use conda to install dev dependencies using pinned env specification - subject to repodata.json changes
2020
conda env create -f environment-frozen.yml --force --name jupyterlab-sublime
2121

22-
dev-install: ## Use npm to install the lab extension in dev mode
23-
cd $(LABEXTENSION_PATH)
24-
npm install
25-
npm run build
26-
jupyter labextension link .
27-
cd -
22+
dev-install:
23+
pip install -e .
24+
jupyter labextension develop . --overwrite
25+
jlpm run build
2826

2927
dev-watch-labextension: ## Recompile labextension on changes
3028
cd $(LABEXTENSION_PATH)
3129
npm run watch
3230

33-
dev-watch-jupyterlab: ## Start jupyterlab under watch mode
34-
jupyter lab --watch
35-
3631
lint: # Run linters
3732
cd $(LABEXTENSION_PATH)
3833
npm run lint

install.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"packageManager": "python",
3+
"packageName": "jupyterlab_sublime",
4+
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab_sublime"
5+
}

jupyterlab_sublime/__init__.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
import json
3+
import os.path as osp
4+
5+
from ._version import __version__
6+
7+
HERE = osp.abspath(osp.dirname(__file__))
8+
9+
with open(osp.join(HERE, 'labextension', 'package.json')) as fid:
10+
data = json.load(fid)
11+
12+
def _jupyter_labextension_paths():
13+
return [{
14+
'src': 'labextension',
15+
'dest': data['name']
16+
}]
17+
18+
19+

jupyterlab_sublime/_version.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
__all__ = ['__version__']
2+
3+
def _fetchVersion():
4+
import json
5+
import os
6+
7+
HERE = os.path.abspath(os.path.dirname(__file__))
8+
9+
for d, _, _ in os.walk(HERE):
10+
try:
11+
with open(os.path.join(d, 'package.json')) as f:
12+
return json.load(f)['version']
13+
except FileNotFoundError:
14+
pass
15+
16+
raise FileNotFoundError('Could not find package.json under dir {}'.format(HERE))
17+
18+
__version__ = _fetchVersion()
19+

package.json

+30-10
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,47 @@
2424
"url": "https://github.com/ryantam626/jupyterlab_sublime.git"
2525
},
2626
"scripts": {
27-
"build": "tsc",
28-
"clean": "rimraf lib",
27+
"build": "jlpm run build:lib && jlpm run build:labextension:dev",
28+
"build:labextension": "jupyter labextension build .",
29+
"build:labextension:dev": "jupyter labextension build --development True .",
30+
"build:lib": "tsc",
31+
"build:prod": "jlpm run build:lib && jlpm run build:labextension",
32+
"clean": "jlpm run clean:lib",
33+
"clean:all": "jlpm run clean:lib && jlpm run clean:labextension",
34+
"clean:labextension": "rimraf jupyterlab_sublime/labextension",
35+
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
36+
"eslint": "eslint . --ext .ts,.tsx --fix",
37+
"eslint:check": "eslint . --ext .ts,.tsx",
2938
"format": "tslint --fix src/*.ts",
39+
"install:extension": "jupyter labextension develop --overwrite .",
3040
"lint": "tslint src/*.ts",
31-
"prepare": "npm run clean && npm run build",
32-
"watch": "tsc -w"
41+
"prepare": "jlpm run clean && jlpm run build:prod",
42+
"watch": "run-p watch:src watch:labextension",
43+
"watch:labextension": "jupyter labextension watch .",
44+
"watch:src": "tsc -w"
3345
},
3446
"dependencies": {
35-
"@jupyterlab/application": "^2.0.0",
36-
"@jupyterlab/notebook": "^2.0.0",
37-
"@types/codemirror": "0.0.76"
47+
"@jupyterlab/application": "^3.0.0",
48+
"@jupyterlab/notebook": "^3.0.0",
49+
"@types/codemirror": "0.0.106"
3850
},
3951
"devDependencies": {
52+
"@jupyterlab/builder": "^3.0.0-rc.13",
53+
"@typescript-eslint/eslint-plugin": "^2.27.0",
54+
"@typescript-eslint/parser": "^2.27.0",
55+
"eslint": "^7.5.0",
56+
"eslint-config-prettier": "^6.10.1",
57+
"eslint-plugin-prettier": "^3.1.2",
58+
"npm-run-all": "^4.1.5",
59+
"prettier": "^1.19.0",
4060
"rimraf": "^3.0.2",
41-
"prettier": "^1.19.1",
4261
"tslint": "^5.15.0",
4362
"tslint-config-prettier": "^1.18.0",
4463
"tslint-plugin-prettier": "^2.0.1",
45-
"typescript": "^3.8.3"
64+
"typescript": "~4.1.3"
4665
},
4766
"jupyterlab": {
48-
"extension": true
67+
"extension": true,
68+
"outputDir": "jupyterlab_sublime/labextension"
4969
}
5070
}

pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["jupyter_packaging~=0.7.9", "jupyterlab>=3.0.0rc13,==3.*", "setuptools>=40.8.0", "wheel"]
3+
build-backend = "setuptools.build_meta"

0 commit comments

Comments
 (0)