Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2f88ce3

Browse files
committed
Code refactoring + snippet id bug fixes
1 parent 5713c63 commit 2f88ce3

39 files changed

+4915
-3156
lines changed

‎.vscode/launch.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "chrome",
9+
"request": "launch",
10+
"name": "Launch Chrome against localhost",
11+
"url": "http://localhost:8080",
12+
"webRoot": "${workspaceFolder}"
13+
}
14+
]
15+
}

‎.vscode/settings.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"workbench.colorCustomizations": {
3+
"activityBar.activeBackground": "#1f6fd0",
4+
"activityBar.background": "#1f6fd0",
5+
"activityBar.foreground": "#e7e7e7",
6+
"activityBar.inactiveForeground": "#e7e7e799",
7+
"activityBarBadge.background": "#ee90bb",
8+
"activityBarBadge.foreground": "#15202b",
9+
"commandCenter.border": "#e7e7e799",
10+
"sash.hoverBorder": "#1f6fd0",
11+
"statusBar.background": "#1857a4",
12+
"statusBar.foreground": "#e7e7e7",
13+
"statusBarItem.hoverBackground": "#1f6fd0",
14+
"statusBarItem.remoteBackground": "#1857a4",
15+
"statusBarItem.remoteForeground": "#e7e7e7",
16+
"titleBar.activeBackground": "#1857a4",
17+
"titleBar.activeForeground": "#e7e7e7",
18+
"titleBar.inactiveBackground": "#1857a499",
19+
"titleBar.inactiveForeground": "#e7e7e799"
20+
},
21+
"peacock.remoteColor": "#1857a4"
22+
}

‎MANIFEST.in

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
include LICENSE
22
include README.md
33
include pyproject.toml
4-
5-
include jupyter-config/code_snippets.json
4+
include install.json
65

76
include package.json
87
include ts*.json
9-
include code_snippets/labextension/*.tgz
8+
graft jupyterlab-code-snippets/labextension
109

1110
# Javascript files
1211
graft src

‎install.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"packageManager": "python",
3-
"packageName": "code_snippet",
4-
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package code_snippet"
3+
"packageName": "jupyterlab-code-snippets",
4+
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab-code-snippets"
55
}

‎junit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<testsuites name="jest tests" tests="0" failures="0" time="0.002">
2+
<testsuites name="jest tests" tests="0" failures="0" time="0">
33
</testsuites>

‎package.json

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jupyterlab-code-snippets",
3-
"version": "2.1.1",
3+
"version": "2.2.0",
44
"description": "EXPERIMENTAL: Save, reuse, and share code snippets using JupyterLab Code Snippets",
55
"keywords": [
66
"jupyter",
@@ -12,7 +12,10 @@
1212
"url": "https://github.com/jupytercalpoly/jupyterlab-code-snippets.git/issues"
1313
},
1414
"license": "BSD-3-Clause",
15-
"author": "Jay Ahn, Kiran Pinnipati",
15+
"author": {
16+
"name": "Jay Ahn, Kiran Pinnipati",
17+
"email": "aju960219@gmail.com"
18+
},
1619
"files": [
1720
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
1821
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
@@ -24,23 +27,22 @@
2427
"style": "style/index.css",
2528
"repository": {
2629
"type": "git",
27-
"url": "https://github.com/jupytercalpoly/jupyterlab-code-snippets.git.git"
30+
"url": "https://github.com/jupytercalpoly/jupyterlab-code-snippets.git"
2831
},
2932
"scripts": {
3033
"build": "jlpm run build:lib && jlpm run build:labextension:dev",
31-
"build:all": "jlpm run build:labextension",
3234
"build:labextension": "jupyter labextension build .",
3335
"build:labextension:dev": "jupyter labextension build --development True .",
3436
"build:lib": "tsc",
35-
"build:prod": "jlpm run build:lib && jlpm run build:labextension",
37+
"build:prod": "jlpm run clean && jlpm run build:lib && jlpm run build:labextension",
3638
"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:labextension": "rimraf jupyterlab-code-snippets/labextension",
3940
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
41+
"clean:all": "jlpm clean:lib && jlpm clean:labextension",
4042
"eslint": "eslint . --ext .ts,.tsx --fix",
4143
"eslint:check": "eslint . --ext .ts,.tsx",
4244
"format": "prettier \"src/**/*.{ts, tsx}\" --check",
43-
"install:extension": "jupyter labextension develop --overwrite .",
45+
"install:extension": "jlpm build",
4446
"prepare": "jlpm run clean && jlpm run build:prod",
4547
"watch": "run-p watch:src watch:labextension",
4648
"watch:labextension": "jupyter labextension watch .",
@@ -53,32 +55,33 @@
5355
"postpublish": "pinst --enable"
5456
},
5557
"dependencies": {
56-
"@jupyterlab/application": "^3.0.10",
57-
"@jupyterlab/apputils": "^3.0.8",
58-
"@jupyterlab/cells": "^3.0.10",
59-
"@jupyterlab/celltags": "^3.0.10",
60-
"@jupyterlab/docmanager": "^3.0.10",
61-
"@jupyterlab/docregistry": "^3.0.10",
62-
"@jupyterlab/fileeditor": "^3.0.10",
63-
"@jupyterlab/nbconvert-css": "^3.0.10",
64-
"@jupyterlab/nbformat": "^3.0.5",
65-
"@jupyterlab/notebook": "^3.0.10",
66-
"@jupyterlab/rendermime": "^3.0.9",
67-
"@jupyterlab/services": "^6.0.8",
58+
"@jupyterlab/application": "^3.5.2",
59+
"@jupyterlab/apputils": "^3.5.2",
60+
"@jupyterlab/cells": "^3.5.0",
61+
"@jupyterlab/celltags": "^3.5.2",
62+
"@jupyterlab/docmanager": "^3.5.2",
63+
"@jupyterlab/docregistry": "^3.5.0",
64+
"@jupyterlab/fileeditor": "^3.5.2",
65+
"@jupyterlab/nbconvert-css": "^3.5.2",
66+
"@jupyterlab/nbformat": "^3.5.2",
67+
"@jupyterlab/notebook": "^3.5.2",
68+
"@jupyterlab/rendermime": "^3.5.2",
69+
"@jupyterlab/services": "^6.5.2",
70+
"@jupyterlab/coreutils": "5.5.2",
6871
"@lumino/algorithm": "^1.3.3",
6972
"@lumino/coreutils": "^1.5.3",
7073
"@lumino/dragdrop": "^1.7.1",
7174
"@lumino/messaging": "^1.4.3",
7275
"@lumino/properties": "^1.2.3",
7376
"@lumino/signaling": "^1.4.3",
74-
"@lumino/widgets": "^1.13.2"
77+
"@lumino/widgets": "^1.36.0"
7578
},
7679
"devDependencies": {
7780
"@babel/core": "^7",
7881
"@babel/preset-env": "^7.12.1",
7982
"@babel/preset-react": "^7.12.5",
80-
"@jupyterlab/builder": "^3.0.0-rc.13",
81-
"@jupyterlab/testutils": "^3.0.10",
83+
"@jupyterlab/builder": "^3.5.2",
84+
"@jupyterlab/testutils": "^3.5.2",
8285
"@testing-library/react": "^11.1.1",
8386
"@types/enzyme": "^3.10.8",
8487
"@types/enzyme-adapter-react-16": "^1.0.6",
@@ -87,15 +90,15 @@
8790
"@types/react": "^16.9.56",
8891
"@types/react-dom": "^16.9.9",
8992
"@types/react-test-renderer": "^16.9.3",
90-
"@typescript-eslint/eslint-plugin": "^2.27.0",
91-
"@typescript-eslint/parser": "^2.27.0",
93+
"@typescript-eslint/eslint-plugin": "^4.8.1",
94+
"@typescript-eslint/parser": "^4.8.1",
9295
"babel-jest": "^26.6.3",
9396
"cypress": "^6.5.0",
9497
"enzyme": "^3.11.0",
9598
"enzyme-adapter-react-16": "^1.15.5",
96-
"eslint": "^7.5.0",
97-
"eslint-config-prettier": "^6.10.1",
98-
"eslint-plugin-prettier": "^3.1.2",
99+
"eslint": "^7.14.0",
100+
"eslint-config-prettier": "^6.15.0",
101+
"eslint-plugin-prettier": "^3.1.4",
99102
"eslint-plugin-react": "^7.20.4",
100103
"husky": "^5.1.3",
101104
"jest": "^26.6.3",

‎pyproject.toml

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,75 @@
11
[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"
2+
requires = ["hatchling>=1.4.0", "jupyterlab>=3.4.7,<4.0.0", "hatch-nodejs-version"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "jupyterlab-code-snippets"
7+
readme = "README.md"
8+
license = { file = "LICENSE" }
9+
requires-python = ">=3.7"
10+
classifiers = [
11+
"Framework :: Jupyter",
12+
"Framework :: Jupyter :: JupyterLab",
13+
"Framework :: Jupyter :: JupyterLab :: 3",
14+
"Framework :: Jupyter :: JupyterLab :: Extensions",
15+
"Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt",
16+
"License :: OSI Approved :: BSD License",
17+
"Programming Language :: Python",
18+
"Programming Language :: Python :: 3",
19+
"Programming Language :: Python :: 3.7",
20+
"Programming Language :: Python :: 3.8",
21+
"Programming Language :: Python :: 3.9",
22+
"Programming Language :: Python :: 3.10",
23+
"Programming Language :: Python :: 3.11",
24+
]
25+
dependencies = [
26+
]
27+
dynamic = ["version", "description", "authors", "urls", "keywords"]
28+
29+
[project.optional-dependencies]
30+
test = [
31+
"coverage",
32+
"pytest",
33+
"pytest-asyncio",
34+
"pytest-cov",
35+
"pytest-tornasync"
36+
]
37+
38+
[tool.hatch.version]
39+
source = "nodejs"
40+
41+
[tool.hatch.metadata.hooks.nodejs]
42+
fields = ["description", "authors", "urls"]
43+
44+
[tool.hatch.build.targets.sdist]
45+
artifacts = ["jupyterlab-code-snippets/labextension"]
46+
exclude = [".github", "binder"]
47+
48+
[tool.hatch.build.targets.wheel.shared-data]
49+
"jupyterlab-code-snippets/labextension" = "share/jupyter/labextensions/jupyterlab-code-snippets"
50+
"install.json" = "share/jupyter/labextensions/jupyterlab-code-snippets/install.json"
51+
52+
[tool.hatch.build.hooks.version]
53+
path = "jupyterlab-code-snippets/_version.py"
54+
55+
[tool.hatch.build.hooks.jupyter-builder]
56+
dependencies = ["hatch-jupyter-builder>=0.5"]
57+
build-function = "hatch_jupyter_builder.npm_builder"
58+
ensured-targets = [
59+
"jupyterlab-code-snippets/labextension/static/style.js",
60+
"jupyterlab-code-snippets/labextension/package.json",
61+
]
62+
skip-if-exists = ["jupyterlab-code-snippets/labextension/static/style.js"]
63+
64+
[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
65+
build_cmd = "build:prod"
66+
npm = ["jlpm"]
67+
68+
[tool.hatch.build.hooks.jupyter-builder.editable-build-kwargs]
69+
build_cmd = "install:extension"
70+
npm = ["jlpm"]
71+
source_dir = "src"
72+
build_dir = "jupyterlab-code-snippets/labextension"
73+
74+
[tool.jupyter-releaser.options]
75+
version_cmd = "hatch version"

‎schema/snippets.json

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -16,52 +16,13 @@
1616
"selector": ".jp-FileEditor"
1717
}
1818
],
19-
"definitions": {
20-
"snippet": {
21-
"properties": {
22-
"id": { "type": "number" },
23-
"name": { "type": "string" },
24-
"description": { "type": "string" },
25-
"language": { "type": "string" },
26-
"code": {"type": "array"},
27-
"tags": {"type": "array"}
28-
},
29-
"required": ["id", "name", "language"],
30-
"type": "object"
31-
}
32-
},
3319
"properties": {
3420
"snippets": {
35-
"title": "Code Snippets",
36-
"description": "The list of snippets.",
21+
"title": "List of code snippets",
22+
"description": "A snippet is defined by a 'id', 'name', and 'language'",
3723
"items": { "$ref": "#/definitions/snippet" },
3824
"type": "array",
39-
"default": [
40-
{
41-
"name": "Plotting_sine",
42-
"description":"Plotting code for sine graph using matplotlib.",
43-
"language":"Python",
44-
"code":["import matplotlib.pyplot as plt","import numpy as np","","x = np.linspace(0, 10, 100)","","plt.plot(x, np.sin(x))","plt.plot(x, np.cos(x))","","plt.show()"],
45-
"id":0,
46-
"tags":["plot"]
47-
},
48-
{
49-
"name": "Importing packages for data analytics",
50-
"description": "Import useful packages for data analytics",
51-
"language":"Python",
52-
"code":["import numpy as np", "import scipy", "import pandas as pd", "import matplotlib.pyplot as plt", "import seaborn as sns"],
53-
"id":1,
54-
"tags":["data analytics"]
55-
},
56-
{
57-
"name": "Importing packages for machine learning",
58-
"description": "Import useful packages for machine learning",
59-
"language":"Python",
60-
"code":["import keras", "import sklearn", "import torch", "import tensorflow as tf"],
61-
"id":2,
62-
"tags":["machine learning"]
63-
}
64-
]
25+
"default": []
6526
},
6627
"snippetPreviewFontSize": {
6728
"title": "Font Size of Preview",
@@ -71,5 +32,44 @@
7132
}
7233
},
7334
"additionalProperties": false,
74-
"type": "object"
35+
"type": "object",
36+
"definitions": {
37+
"snippet": {
38+
"properties": {
39+
"id": {
40+
"title": "Unique id",
41+
"type": "number"
42+
},
43+
"name": {
44+
"title": "Unique name",
45+
"type": "string"
46+
},
47+
"description": {
48+
"title": "Description",
49+
"type": "string"
50+
},
51+
"language": {
52+
"title": "Language",
53+
"type": "string"
54+
},
55+
"code": {
56+
"title": "Code",
57+
"type": "string"
58+
},
59+
"tags": {
60+
"title": "Tags",
61+
"items": { "$ref": "#/definitions/tag"},
62+
"type": "array",
63+
"default": []
64+
}
65+
},
66+
"required": ["id", "name", "language", "code"],
67+
"additionalProperties": false,
68+
"type": "object"
69+
},
70+
"tag": {
71+
"title": "Unique Tag Name",
72+
"type": "string"
73+
}
74+
}
7575
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /