Skip to content

Commit 81250fe

Browse files
committed
Run 3.0 migration script
1 parent df7121f commit 81250fe

21 files changed

+1190
-827
lines changed

.eslintrc.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = {
1111
project: 'tsconfig.json',
1212
sourceType: 'module'
1313
},
14-
plugins: ['@typescript-eslint'],
14+
plugins: ['@typescript-eslint', 'react'],
1515
rules: {
1616
'@typescript-eslint/interface-name-prefix': [
1717
'error',
@@ -31,5 +31,6 @@ module.exports = {
3131
curly: ['error', 'all'],
3232
eqeqeq: 'error',
3333
'prefer-arrow-callback': 'error'
34-
}
34+
},
35+
ignorePatterns: ['.eslintrc.js']
3536
};

.github/workflows/build.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,24 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v1
15-
- name: Install node
16-
uses: actions/setup-node@v1
17-
with:
18-
node-version: '12.x'
19-
- name: Install Python
20-
uses: actions/setup-python@v1
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
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 .
3031
31-
jupyter labextension install .
32-
33-
python -m jupyterlab.browser_check
32+
jupyter labextension list 2>&1 | grep -ie "jupyterlab-code-snippets.*OK"
33+
python -m jupyterlab.browser_check

_version.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

binder/postBuild

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,46 @@
1-
#!/bin/bash
2-
3-
# install extension
4-
jupyter labextension update jupyter-offlinenotebook --no-build
5-
jupyter labextension install --minimize=False jupyterlab-code-snippets
6-
7-
# remove unnecessary directories when using the binder
8-
rm -rf src
9-
rm -rf style
10-
rm -rf .github
11-
rm -rf binder
12-
rm -rf Design
13-
rm -rf docs
14-
rm package.json
15-
rm tsconfig.json
16-
rm yarn.lock
17-
rm MANIFEST.in
18-
19-
jupyter lab clean
1+
#!/usr/bin/env python3
2+
""" perform a development install of code_snippet
3+
4+
On Binder, this will run _after_ the environment has been fully created from
5+
the environment.yml in this directory.
6+
7+
This script should also run locally on Linux/MacOS/Windows:
8+
9+
python3 binder/postBuild
10+
"""
11+
import subprocess
12+
import sys
13+
from pathlib import Path
14+
15+
16+
ROOT = Path.cwd()
17+
18+
def _(*args, **kwargs):
19+
""" Run a command, echoing the args
20+
21+
fails hard if something goes wrong
22+
"""
23+
print("\n\t", " ".join(args), "\n")
24+
return_code = subprocess.call(args, **kwargs)
25+
if return_code != 0:
26+
print("\nERROR", return_code, " ".join(args))
27+
sys.exit(return_code)
28+
29+
# verify the environment is self-consistent before even starting
30+
_(sys.executable, "-m", "pip", "check")
31+
32+
# install the labextension
33+
_(sys.executable, "-m", "pip", "install", "-e", ".")
34+
35+
# verify the environment the extension didn't break anything
36+
_(sys.executable, "-m", "pip", "check")
37+
38+
# list the extensions
39+
_("jupyter", "server", "extension", "list")
40+
41+
# initially list installed extensions to determine if there are any surprises
42+
_("jupyter", "labextension", "list")
43+
44+
45+
print("JupyterLab with code_snippet is ready to run with:\n")
46+
print("\tjupyter lab\n")

code_snippet/__init__.py

Lines changed: 19 additions & 0 deletions
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+

code_snippet/_version.py

Lines changed: 19 additions & 0 deletions
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+
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
{
2+
"name": "jupyterlab-code-snippets",
3+
"version": "1.0.4",
4+
"description": "EXPERIMENTAL: Save, reuse, and share code snippets using JupyterLab Code Snippets",
5+
"keywords": [
6+
"jupyter",
7+
"jupyterlab",
8+
"jupyterlab-extension"
9+
],
10+
"homepage": "https://github.com/jupytercalpoly/jupyterlab-code-snippets.git",
11+
"bugs": {
12+
"url": "https://github.com/jupytercalpoly/jupyterlab-code-snippets.git/issues"
13+
},
14+
"license": "BSD-3-Clause",
15+
"author": "Jay Ahn, Kiran Pinnipati",
16+
"files": [
17+
"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}",
19+
"schema/*.json",
20+
"style/index.js"
21+
],
22+
"main": "lib/index.js",
23+
"types": "lib/index.d.ts",
24+
"style": "style/index.css",
25+
"repository": {
26+
"type": "git",
27+
"url": "https://github.com/jupytercalpoly/jupyterlab-code-snippets.git.git"
28+
},
29+
"scripts": {
30+
"build": "jlpm run build:lib && jlpm run build:labextension:dev",
31+
"build:all": "jlpm run build:labextension",
32+
"build:labextension": "jupyter labextension build .",
33+
"build:labextension:dev": "jupyter labextension build --development True .",
34+
"build:lib": "tsc",
35+
"build:prod": "jlpm run build:lib && jlpm run build:labextension",
36+
"clean": "jlpm run clean:lib",
37+
"clean:all": "jlpm run clean:lib && jlpm run clean:labextension",
38+
"clean:labextension": "rimraf code_snippet/labextension",
39+
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
40+
"eslint": "eslint . --ext .ts,.tsx --fix",
41+
"eslint:check": "eslint . --ext .ts,.tsx",
42+
"format": "prettier \"src/**/*.{ts, tsx}\" --check",
43+
"install:extension": "jupyter labextension develop --overwrite .",
44+
"prepare": "jlpm run clean && jlpm run build:prod",
45+
"watch": "run-p watch:src watch:labextension",
46+
"watch:labextension": "jupyter labextension watch .",
47+
"watch:src": "tsc -w"
48+
},
49+
"dependencies": {
50+
"@jupyterlab/application": "^3.0.3",
51+
"@jupyterlab/apputils": "^3.0.2",
52+
"@jupyterlab/cells": "^3.0.3",
53+
"@jupyterlab/celltags": "^3.0.3",
54+
"@jupyterlab/docmanager": "^3.0.3",
55+
"@jupyterlab/docregistry": "^3.0.3",
56+
"@jupyterlab/fileeditor": "^3.0.3",
57+
"@jupyterlab/nbconvert-css": "^3.0.3",
58+
"@jupyterlab/nbformat": "^3.0.1",
59+
"@jupyterlab/notebook": "^3.0.3",
60+
"@jupyterlab/rendermime": "^3.0.3",
61+
"@jupyterlab/services": "^6.0.2",
62+
"@lumino/algorithm": "^1.3.3",
63+
"@lumino/coreutils": "^1.5.3",
64+
"@lumino/dragdrop": "^1.7.1",
65+
"@lumino/messaging": "^1.4.3",
66+
"@lumino/properties": "^1.2.3",
67+
"@lumino/signaling": "^1.4.3"
68+
},
69+
"devDependencies": {
70+
"@jupyterlab/builder": "^3.0.0-rc.13",
71+
"@typescript-eslint/eslint-plugin": "^2.27.0",
72+
"@typescript-eslint/parser": "^2.27.0",
73+
"eslint": "^7.5.0",
74+
"eslint-config-prettier": "^6.10.1",
75+
"eslint-plugin-prettier": "^3.1.2",
76+
"eslint-plugin-react": "^7.20.4",
77+
"husky": "^4.2.5",
78+
"lint-staged": "^10.2.13",
79+
"mkdirp": "^1.0.3",
80+
"npm-run-all": "^4.1.5",
81+
"prettier": "^1.19.0",
82+
"rimraf": "^3.0.2",
83+
"typescript": "~4.1.3"
84+
},
85+
"sideEffects": [
86+
"style/*.css",
87+
"style/index.js"
88+
],
89+
"jupyterlab": {
90+
"extension": true,
91+
"schemaDir": "schema",
92+
"outputDir": "code_snippet/labextension",
93+
"_build": {
94+
"load": "static/remoteEntry.11378e5cdb89337016e1.js",
95+
"extension": "./extension",
96+
"style": "./style"
97+
}
98+
},
99+
"husky": {
100+
"hooks": {
101+
"pre-commit": "lint-staged"
102+
}
103+
},
104+
"lint-staged": {
105+
"*.{js,jsx,ts,tsx}": [
106+
"eslint --cache --fix"
107+
],
108+
"*.js": "eslint --cache --fix"
109+
},
110+
"styleModule": "style/index.js"
111+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{
2+
"name": "jupyterlab-code-snippets",
3+
"version": "1.0.4",
4+
"description": "EXPERIMENTAL: Save, reuse, and share code snippets using JupyterLab Code Snippets",
5+
"keywords": [
6+
"jupyter",
7+
"jupyterlab",
8+
"jupyterlab-extension"
9+
],
10+
"homepage": "https://github.com/jupytercalpoly/jupyterlab-code-snippets.git",
11+
"bugs": {
12+
"url": "https://github.com/jupytercalpoly/jupyterlab-code-snippets.git/issues"
13+
},
14+
"license": "BSD-3-Clause",
15+
"author": "Jay Ahn, Kiran Pinnipati",
16+
"files": [
17+
"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}",
19+
"schema/*.json",
20+
"style/index.js"
21+
],
22+
"main": "lib/index.js",
23+
"types": "lib/index.d.ts",
24+
"style": "style/index.css",
25+
"repository": {
26+
"type": "git",
27+
"url": "https://github.com/jupytercalpoly/jupyterlab-code-snippets.git.git"
28+
},
29+
"scripts": {
30+
"build": "jlpm run build:lib && jlpm run build:labextension:dev",
31+
"build:all": "jlpm run build:labextension",
32+
"build:labextension": "jupyter labextension build .",
33+
"build:labextension:dev": "jupyter labextension build --development True .",
34+
"build:lib": "tsc",
35+
"build:prod": "jlpm run build:lib && jlpm run build:labextension",
36+
"clean": "jlpm run clean:lib",
37+
"clean:all": "jlpm run clean:lib && jlpm run clean:labextension",
38+
"clean:labextension": "rimraf code_snippet/labextension",
39+
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
40+
"eslint": "eslint . --ext .ts,.tsx --fix",
41+
"eslint:check": "eslint . --ext .ts,.tsx",
42+
"format": "prettier \"src/**/*.{ts, tsx}\" --check",
43+
"install:extension": "jupyter labextension develop --overwrite .",
44+
"prepare": "jlpm run clean && jlpm run build:prod",
45+
"watch": "run-p watch:src watch:labextension",
46+
"watch:labextension": "jupyter labextension watch .",
47+
"watch:src": "tsc -w"
48+
},
49+
"dependencies": {
50+
"@jupyterlab/application": "^3.0.3",
51+
"@jupyterlab/apputils": "^3.0.2",
52+
"@jupyterlab/cells": "^3.0.3",
53+
"@jupyterlab/celltags": "^3.0.3",
54+
"@jupyterlab/docmanager": "^3.0.3",
55+
"@jupyterlab/docregistry": "^3.0.3",
56+
"@jupyterlab/fileeditor": "^3.0.3",
57+
"@jupyterlab/nbconvert-css": "^3.0.3",
58+
"@jupyterlab/nbformat": "^3.0.1",
59+
"@jupyterlab/notebook": "^3.0.3",
60+
"@jupyterlab/rendermime": "^3.0.3",
61+
"@jupyterlab/services": "^6.0.2",
62+
"@lumino/algorithm": "^1.3.3",
63+
"@lumino/coreutils": "^1.5.3",
64+
"@lumino/dragdrop": "^1.7.1",
65+
"@lumino/messaging": "^1.4.3",
66+
"@lumino/properties": "^1.2.3",
67+
"@lumino/signaling": "^1.4.3"
68+
},
69+
"devDependencies": {
70+
"@jupyterlab/builder": "^3.0.0-rc.13",
71+
"@typescript-eslint/eslint-plugin": "^2.27.0",
72+
"@typescript-eslint/parser": "^2.27.0",
73+
"eslint": "^7.5.0",
74+
"eslint-config-prettier": "^6.10.1",
75+
"eslint-plugin-prettier": "^3.1.2",
76+
"eslint-plugin-react": "^7.20.4",
77+
"husky": "^4.2.5",
78+
"lint-staged": "^10.2.13",
79+
"mkdirp": "^1.0.3",
80+
"npm-run-all": "^4.1.5",
81+
"prettier": "^1.19.0",
82+
"rimraf": "^3.0.2",
83+
"typescript": "~4.1.3"
84+
},
85+
"sideEffects": [
86+
"style/*.css",
87+
"style/index.js"
88+
],
89+
"jupyterlab": {
90+
"extension": true,
91+
"schemaDir": "schema",
92+
"outputDir": "code_snippet/labextension"
93+
},
94+
"husky": {
95+
"hooks": {
96+
"pre-commit": "lint-staged"
97+
}
98+
},
99+
"lint-staged": {
100+
"*.{js,jsx,ts,tsx}": [
101+
"eslint --cache --fix"
102+
],
103+
"*.js": "eslint --cache --fix"
104+
},
105+
"styleModule": "style/index.js"
106+
}

0 commit comments

Comments
 (0)