init
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
maltegrosse 2023-01-23 20:55:37 +01:00
commit 2cd1551422
29 changed files with 5533 additions and 0 deletions

8
.eslintignore Normal file
View File

@ -0,0 +1,8 @@
node_modules
dist
coverage
**/*.d.ts
tests
**/__tests__
ui-tests

39
.eslintrc.js Normal file
View File

@ -0,0 +1,39 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended'
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module'
},
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '^I[A-Z]',
match: true
}
}
],
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/quotes': [
'error',
'single',
{ avoidEscape: true, allowTemplateLiterals: false }
],
curly: ['error', 'all'],
eqeqeq: 'error',
'prefer-arrow-callback': 'error'
}
};

122
.gitignore vendored Normal file
View File

@ -0,0 +1,122 @@
*.bundle.*
lib/
node_modules/
*.log
.eslintcache
.stylelintcache
*.egg-info/
.ipynb_checkpoints
*.tsbuildinfo
jupyterlab-training/labextension
# Version file is handled by hatchling
jupyterlab-training/_version.py
# Integration tests
ui-tests/test-results/
ui-tests/playwright-report/
# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage/
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# End of https://www.gitignore.io/api/python
# OSX files
.DS_Store

6
.prettierignore Normal file
View File

@ -0,0 +1,6 @@
node_modules
**/node_modules
**/lib
**/package.json
!/package.json
jupyterlab-training

6
.prettierrc Normal file
View File

@ -0,0 +1,6 @@
{
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid",
"endOfLine": "auto"
}

12
.stylelintrc Normal file
View File

@ -0,0 +1,12 @@
{
"extends": [
"stylelint-config-recommended",
"stylelint-config-standard",
"stylelint-prettier/recommended"
],
"rules": {
"property-no-vendor-prefix": null,
"selector-no-vendor-prefix": null,
"value-no-vendor-prefix": null
}
}

9
.woodpecker.yml Normal file
View File

@ -0,0 +1,9 @@
pipeline:
build-package:
image: nikolaik/python-nodejs:python3.7-nodejs19
commands:
- apt update && apt install build-essential -y
- python -m pip install -U jupyterlab~=3.5.2 build twine
- python -m build -s
- python -m twine upload dist/* --repository-url=$TWINE_REPOSITORY_URL
secrets: [ TWINE_USERNAME, TWINE_PASSWORD, TWINE_REPOSITORY, TWINE_REPOSITORY_URL]

5
CHANGELOG.md Normal file
View File

@ -0,0 +1,5 @@
# Changelog
<!-- <START NEW CHANGELOG ENTRY> -->
<!-- <END NEW CHANGELOG ENTRY> -->

29
LICENSE Normal file
View File

@ -0,0 +1,29 @@
BSD 3-Clause License
Copyright (c) 2023, Malte Grosse
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

101
README.md Normal file
View File

@ -0,0 +1,101 @@
# jupyterlab-training
[![status-badge](https://ci.sandbox.iuk.hdm-stuttgart.de/api/badges/grosse/jupyterlab-training/status.svg)](https://ci.sandbox.iuk.hdm-stuttgart.de/grosse/jupyterlab-training)
Training Data Pipeline
This extension is composed of a Python package named `jupyterlab-training`
for the server extension and a NPM package named `jupyterlab-training`
for the frontend extension.
## Requirements
- JupyterLab >= 3.0
## Install
To install the extension, execute:
```bash
pip install jupyterlab-training
```
## Uninstall
To remove the extension, execute:
```bash
pip uninstall jupyterlab-training
```
## Troubleshoot
If you are seeing the frontend extension, but it is not working, check
that the server extension is enabled:
```bash
jupyter server extension list
```
If the server extension is installed and enabled, but you are not seeing
the frontend extension, check the frontend extension is installed:
```bash
jupyter labextension list
```
## Contributing
### Development install
Note: You will need NodeJS to build the extension package.
The `jlpm` command is JupyterLab's pinned version of
[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
`yarn` or `npm` in lieu of `jlpm` below.
```bash
# Clone the repo to your local environment
# Change directory to the jupyterlab-training directory
# Install package in development mode
pip install -e "."
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Server extension must be manually installed in develop mode
jupyter server extension enable jupyterlab-training
# Rebuild extension Typescript source after making changes
jlpm build
```
You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.
```bash
# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm watch
# Run JupyterLab in another terminal
jupyter lab
```
With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).
By default, the `jlpm build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:
```bash
jupyter lab build --minimize=False
```
### Development uninstall
```bash
# Server extension must be manually disabled in develop mode
jupyter server extension disable jupyterlab-training
pip uninstall jupyterlab-training
```
In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
folder is located. Then you can remove the symlink named `jupyterlab-training` within that folder.
### Packaging the extension
See [RELEASE](RELEASE.md)

68
RELEASE.md Normal file
View File

@ -0,0 +1,68 @@
# Making a new release of jupyterlab-training
The extension can be published to `PyPI` and `npm` manually or using the [Jupyter Releaser](https://github.com/jupyter-server/jupyter_releaser).
## Manual release
### Python package
This extension can be distributed as Python
packages. All of the Python
packaging instructions in the `pyproject.toml` file to wrap your extension in a
Python package. Before generating a package, we first need to install `build`.
```bash
pip install build twine hatch
```
Bump the version using `hatch`. By default this will create a tag.
See the docs on [hatch-nodejs-version](https://github.com/agoose77/hatch-nodejs-version#semver) for details.
```bash
hatch version <new-version>
```
To create a Python source package (`.tar.gz`) and the binary package (`.whl`) in the `dist/` directory, do:
```bash
python -m build
```
> `python setup.py sdist bdist_wheel` is deprecated and will not work for this package.
Then to upload the package to PyPI, do:
```bash
twine upload dist/*
```
### NPM package
To publish the frontend part of the extension as a NPM package, do:
```bash
npm login
npm publish --access public
```
## Automated releases with the Jupyter Releaser
The extension repository should already be compatible with the Jupyter Releaser.
Check out the [workflow documentation](https://github.com/jupyter-server/jupyter_releaser#typical-workflow) for more information.
Here is a summary of the steps to cut a new release:
- Fork the [`jupyter-releaser` repo](https://github.com/jupyter-server/jupyter_releaser)
- Add `ADMIN_GITHUB_TOKEN`, `PYPI_TOKEN` and `NPM_TOKEN` to the Github Secrets in the fork
- Go to the Actions panel
- Run the "Draft Changelog" workflow
- Merge the Changelog PR
- Run the "Draft Release" workflow
- Run the "Publish Release" workflow
## Publishing to `conda-forge`
If the package is not on conda forge yet, check the documentation to learn how to add it: https://conda-forge.org/docs/maintainer/adding_pkgs.html
Otherwise a bot should pick up the new version publish to PyPI, and open a new PR on the feedstock repository automatically.

5
install.json Normal file
View File

@ -0,0 +1,5 @@
{
"packageManager": "python",
"packageName": "jupyterlab-training",
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab-training"
}

View File

@ -0,0 +1,7 @@
{
"NotebookApp": {
"nbserver_extensions": {
"jupyterlab-training": true
}
}
}

View File

@ -0,0 +1,7 @@
{
"ServerApp": {
"jpserver_extensions": {
"jupyterlab-training": true
}
}
}

View File

@ -0,0 +1,35 @@
from ._version import __version__
from .handlers import setup_handlers
def _jupyter_labextension_paths():
return [{
"src": "labextension",
"dest": "jupyterlab-training"
}]
def _jupyter_server_extension_points():
return [{
"module": "jupyterlab-training"
}]
def _load_jupyter_server_extension(server_app):
"""Registers the API handler to receive HTTP requests from the frontend extension.
Parameters
----------
server_app: jupyterlab.labapp.LabApp
JupyterLab application instance
"""
setup_handlers(server_app.web_app)
name = "jupyterlab-training"
server_app.log.info(f"Registered {name} server extension")
# For backward compatibility with notebook server - useful for Binder/JupyterHub
load_jupyter_server_extension = _load_jupyter_server_extension

View File

@ -0,0 +1,24 @@
import json
from jupyter_server.base.handlers import APIHandler
from jupyter_server.utils import url_path_join
import tornado
class RouteHandler(APIHandler):
# The following decorator should be present on all verb methods (head, get, post,
# patch, put, delete, options) to ensure only authorized user can request the
# Jupyter server
@tornado.web.authenticated
def get(self):
self.finish(json.dumps({
"data": "This is /jupyterlab-training/get_example endpoint!"
}))
def setup_handlers(web_app):
host_pattern = ".*$"
base_url = web_app.settings["base_url"]
route_pattern = url_path_join(base_url, "jupyterlab-training", "get_example")
handlers = [(route_pattern, RouteHandler)]
web_app.add_handlers(host_pattern, handlers)

110
package.json Normal file
View File

@ -0,0 +1,110 @@
{
"name": "jupyterlab-training",
"version": "0.1.0",
"description": "Training Data Pipeline",
"keywords": [
"jupyter",
"jupyterlab",
"jupyterlab-extension"
],
"homepage": "https://git.sandbox.iuk.hdm-stuttgart.de/grosse/jupyterlab-training",
"bugs": {
"url": "https://git.sandbox.iuk.hdm-stuttgart.de/grosse/jupyterlab-training/issues"
},
"license": "BSD-3-Clause",
"author": {
"name": "Malte Grosse",
"email": "grosse@hdm-stuttgart.de"
},
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
"schema/*.json"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"style": "style/index.css",
"repository": {
"type": "git",
"url": "https://git.sandbox.iuk.hdm-stuttgart.de/grosse/jupyterlab-training.git"
},
"scripts": {
"build": "jlpm build:lib && jlpm build:labextension:dev",
"build:prod": "jlpm clean && jlpm build:lib:prod && jlpm build:labextension",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
"build:lib": "tsc --sourceMap",
"build:lib:prod": "tsc",
"clean": "jlpm clean:lib",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf jupyterlab-training/labextension jupyterlab-training/_version.py",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"eslint": "jlpm eslint:check --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
"lint": "jlpm stylelint && jlpm prettier && jlpm eslint",
"lint:check": "jlpm stylelint:check && jlpm prettier:check && jlpm eslint:check",
"prettier": "jlpm prettier:base --write --list-different",
"prettier:base": "prettier \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
"prettier:check": "jlpm prettier:base --check",
"stylelint": "jlpm stylelint:check --fix",
"stylelint:check": "stylelint --cache \"style/**/*.css\"",
"watch": "run-p watch:src watch:labextension",
"watch:src": "tsc -w",
"watch:labextension": "jupyter labextension watch ."
},
"dependencies": {
"@jupyterlab/application": "^3.5.3",
"@jupyterlab/apputils": "^3.5.3",
"@jupyterlab/coreutils": "^5.1.0",
"@jupyterlab/launcher": "^3.5.3",
"@jupyterlab/services": "^6.5.3",
"@jupyterlab/settingregistry": "^3.5.3",
"@jupyterlab/ui-components": "^3.5.3",
"@lumino/widgets": "^1.37.1",
"bootstrap": "5.2.2",
"react-bootstrap": "2.5.0"
},
"devDependencies": {
"@jupyterlab/builder": "^3.1.0",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
"eslint": "^7.14.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-prettier": "^3.1.4",
"mkdirp": "^1.0.3",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.1",
"rimraf": "^3.0.2",
"stylelint": "^14.3.0",
"stylelint-config-prettier": "^9.0.4",
"stylelint-config-recommended": "^6.0.0",
"stylelint-config-standard": "~24.0.0",
"stylelint-prettier": "^2.0.0",
"typescript": "~4.1.3"
},
"sideEffects": [
"style/*.css",
"style/index.js"
],
"styleModule": "style/index.js",
"publishConfig": {
"access": "public"
},
"jupyterlab": {
"discovery": {
"server": {
"managers": [
"pip"
],
"base": {
"name": "jupyterlab-training"
}
}
},
"extension": true,
"outputDir": "jupyterlab-training/labextension",
"schemaDir": "schema"
}
}

76
pyproject.toml Normal file
View File

@ -0,0 +1,76 @@
[build-system]
requires = ["hatchling>=1.4.0", "jupyterlab>=3.4.7,<4.0.0", "hatch-nodejs-version"]
build-backend = "hatchling.build"
[project]
name = "jupyterlab-training"
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.7"
classifiers = [
"Framework :: Jupyter",
"Framework :: Jupyter :: JupyterLab",
"Framework :: Jupyter :: JupyterLab :: 3",
"Framework :: Jupyter :: JupyterLab :: Extensions",
"Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
dependencies = [
"jupyter_server>=1.21,<3"
]
dynamic = ["version", "description", "authors", "urls", "keywords"]
[tool.hatch.version]
source = "nodejs"
[tool.hatch.metadata.hooks.nodejs]
fields = ["description", "authors", "urls"]
[tool.hatch.build.targets.sdist]
artifacts = ["jupyterlab-training/labextension"]
exclude = [".github", "binder"]
[tool.hatch.build.targets.wheel.shared-data]
"jupyterlab-training/labextension" = "share/jupyter/labextensions/jupyterlab-training"
"install.json" = "share/jupyter/labextensions/jupyterlab-training/install.json"
"jupyter-config/server-config" = "etc/jupyter/jupyter_server_config.d"
"jupyter-config/nb-config" = "etc/jupyter/jupyter_notebook_config.d"
[tool.hatch.build.hooks.version]
path = "jupyterlab-training/_version.py"
[tool.hatch.build.hooks.jupyter-builder]
dependencies = ["hatch-jupyter-builder>=0.5"]
build-function = "hatch_jupyter_builder.npm_builder"
ensured-targets = [
"jupyterlab-training/labextension/static/style.js",
"jupyterlab-training/labextension/package.json",
]
skip-if-exists = ["jupyterlab-training/labextension/static/style.js"]
[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
build_cmd = "build:prod"
npm = ["jlpm"]
[tool.hatch.build.hooks.jupyter-builder.editable-build-kwargs]
build_cmd = "install:extension"
npm = ["jlpm"]
source_dir = "src"
build_dir = "jupyterlab-training/labextension"
[tool.jupyter-releaser.options]
version_cmd = "hatch version"
[tool.jupyter-releaser.hooks]
before-build-npm = ["python -m pip install jupyterlab~=3.1", "jlpm", "jlpm build:prod"]
before-build-python = ["jlpm clean:all"]
[tool.check-wheel-contents]
ignore = ["W002"]

8
schema/plugin.json Normal file
View File

@ -0,0 +1,8 @@
{
"jupyter.lab.shortcuts": [],
"title": "jupyterlab-training",
"description": "jupyterlab-training settings.",
"type": "object",
"properties": {},
"additionalProperties": false
}

1
setup.py Normal file
View File

@ -0,0 +1 @@
__import__('setuptools').setup()

46
src/handler.ts Normal file
View File

@ -0,0 +1,46 @@
import { URLExt } from '@jupyterlab/coreutils';
import { ServerConnection } from '@jupyterlab/services';
/**
* Call the API extension
*
* @param endPoint API REST end point for the extension
* @param init Initial values for the request
* @returns The response body interpreted as JSON
*/
export async function requestAPI<T>(
endPoint = '',
init: RequestInit = {}
): Promise<T> {
// Make request to Jupyter API
const settings = ServerConnection.makeSettings();
const requestUrl = URLExt.join(
settings.baseUrl,
'jupyterlab-training', // API Namespace
endPoint
);
let response: Response;
try {
response = await ServerConnection.makeRequest(requestUrl, init, settings);
} catch (error) {
throw new ServerConnection.NetworkError(error);
}
let data: any = await response.text();
if (data.length > 0) {
try {
data = JSON.parse(data);
} catch (error) {
console.log('Not a JSON response body.', response);
}
}
if (!response.ok) {
throw new ServerConnection.ResponseError(response, data.message || data);
}
return data;
}

3
src/images.ts Normal file
View File

@ -0,0 +1,3 @@
export default {};
export const Icon: any = '<?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> <svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="1991.000000pt" height="1991.000000pt" viewBox="0 0 1991.000000 1991.000000" preserveAspectRatio="xMidYMid meet"> <g transform="translate(0.000000,1991.000000) scale(0.100000,-0.100000)" fill="#000000" stroke="none"> <path d="M7755 16490 c-946 -148 -1754 -278 -1795 -290 -110 -31 -194 -82 -280 -169 -224 -227 -260 -566 -88 -832 83 -129 211 -226 363 -276 154 -50 109 -55 1835 215 850 133 1559 243 1575 245 25 1 259 -150 1315 -847 706 -466 1307 -859 1334 -873 95 -48 157 -65 267 -70 204 -11 364 50 505 191 90 91 130 154 170 271 24 70 28 95 27 200 0 102 -4 132 -26 200 -35 105 -88 193 -163 269 -84 85 -2900 1945 -3008 1987 -82 32 -175 49 -256 48 -30 0 -829 -121 -1775 -269z"/> <path d="M15960 16364 c-750 -114 -1361 -668 -1543 -1399 -45 -181 -52 -241 -52 -460 0 -219 7 -279 52 -460 107 -432 384 -831 753 -1084 448 -308 1009 -406 1540 -271 396 101 769 350 1020 680 168 221 287 485 346 765 36 169 44 450 19 627 -45 315 -166 611 -356 868 -34 47 -114 137 -178 201 -64 64 -154 144 -201 178 -253 187 -551 310 -857 355 -138 20 -410 20 -543 0z"/> <path d="M12105 15519 c-44 -5 -89 -10 -100 -12 -13 -2 121 -96 414 -291 256 -169 458 -311 493 -344 122 -116 220 -300 249 -468 7 -40 10 -118 7 -193 -4 -108 -10 -140 -38 -223 -91 -272 -301 -473 -577 -553 -203 -59 -430 -38 -619 58 -28 14 -491 316 -1028 671 l-978 645 -56 -25 c-257 -113 -737 -390 -1077 -622 -408 -278 -1113 -842 -1294 -1037 -268 -288 -444 -617 -497 -929 -24 -144 -15 -402 19 -546 51 -215 141 -419 296 -675 54 -89 361 -521 759 -1070 645 -888 667 -920 643 -927 -15 -5 -764 -105 -1666 -223 -902 -118 -1674 -222 -1715 -231 -224 -48 -440 -183 -587 -368 -77 -96 -164 -268 -193 -381 -93 -360 7 -738 264 -998 137 -138 303 -234 491 -283 84 -23 122 -27 240 -27 128 -1 353 28 2685 336 1400 186 2569 342 2598 348 314 63 594 287 734 586 142 303 123 683 -48 965 -20 32 -424 594 -900 1250 l-865 1192 113 73 c308 201 647 393 1058 598 422 212 650 315 1406 640 l472 202 6 -171 c4 -94 16 -539 27 -988 18 -734 22 -826 39 -893 31 -123 82 -208 182 -308 l88 -88 422 -208 c233 -115 1051 -520 1818 -901 767 -380 1429 -703 1470 -718 65 -22 91 -26 195 -26 139 0 197 14 320 77 109 56 215 163 272 272 58 112 77 189 77 315 0 190 -62 338 -196 473 l-78 79 -898 445 c-493 245 -1226 609 -1629 808 l-731 363 -6 53 c-3 30 -21 724 -41 1542 -36 1481 -36 1488 -60 1583 -55 216 -182 423 -384 625 -156 155 -293 253 -481 343 -331 159 -731 225 -1115 185z"/> <path d="M3490 13800 l0 -90 1720 0 1720 0 0 90 0 90 -1720 0 -1720 0 0 -90z"/> <path d="M630 13285 l0 -85 2470 0 2470 0 0 85 0 85 -2470 0 -2470 0 0 -85z"/> <path d="M2770 12775 l0 -85 1720 0 1720 0 0 85 0 85 -1720 0 -1720 0 0 -85z"/> <path d="M6957 11232 c-13 -24 -649 -2373 -644 -2379 6 -5 2087 264 2095 272 2 1 -254 358 -569 791 -314 434 -582 805 -594 824 -98 153 -168 273 -221 377 -35 68 -65 119 -67 115z"/> <path d="M3395 5946 c-1262 -939 -1303 -972 -1403 -1136 -103 -167 -152 -342 -152 -540 0 -282 99 -520 299 -721 152 -151 312 -238 521 -281 136 -29 347 -21 473 16 104 31 193 70 268 118 51 33 4113 3055 4172 3104 16 13 24 24 19 24 -6 0 -437 -57 -959 -126 -943 -125 -949 -125 -1108 -121 -131 4 -178 9 -258 30 -281 74 -518 235 -692 469 l-20 27 -1160 -863z"/> <path d="M11442 5673 l3 -88 1723 -3 1722 -2 0 90 0 90 -1725 0 -1726 0 3 -87z"/> <path d="M8590 5160 l0 -90 2468 2 2467 3 3 88 3 87 -2471 0 -2470 0 0 -90z"/> <path d="M10730 4650 l0 -90 1720 0 1720 0 0 90 0 90 -1720 0 -1720 0 0 -90z"/> </g> </svg>'

90
src/index.ts Normal file
View File

@ -0,0 +1,90 @@
import {
JupyterFrontEnd,
JupyterFrontEndPlugin
} from '@jupyterlab/application';
import {
ICommandPalette,
MainAreaWidget
} from '@jupyterlab/apputils';
import { Icon } from './images';
import { ISettingRegistry } from '@jupyterlab/settingregistry';
import { LabIcon } from '@jupyterlab/ui-components';
//import { requestAPI } from './handler';
import { ILauncher} from '@jupyterlab/launcher';
import {TrainingWidget} from "./widget"
const plugin: JupyterFrontEndPlugin<void> = {
id: 'jupyterlab-training:plugin',
autoStart: true,
optional: [ISettingRegistry, ILauncher, ICommandPalette],
activate: (app: JupyterFrontEnd, settingRegistry: ISettingRegistry | null, launcher:ILauncher,palette: ICommandPalette) => {
// console.log('JupyterLab extension jupyterlab-data-pool is activated!');
if (settingRegistry) {
// settingRegistry
// .load(plugin.id)
// .then(settings => {
// console.log('jupyterlab-data-pool settings loaded:', settings.composite);
// })
// .catch(reason => {
// console.error('Failed to load settings for jupyterlab-data-pool.', reason);
// });
}
// requestAPI<any>('get_example')
// .then(data => {
// console.log(data);
// })
// .catch(reason => {
// console.error(
// `The jupyterlab-data-pool server extension appears to be missing.\n${reason}`
// );
// });
const webDavIcon = new LabIcon({ name: 'ui-components:webdav-icon', svgstr: Icon});
const label = "Training"
const content = new TrainingWidget(label);
const widget = new MainAreaWidget({content});
widget.id = 'jupyterlab-training:plugin';
widget.title.label = label
widget.title.closable = true;
widget.title.icon = webDavIcon
const command: string = 'jupyterlab-training:open'
app.commands.addCommand(command, {
label: label,
icon: webDavIcon,
execute: () => {
if (!widget.isAttached) {
app.shell.add(widget, 'main');
}
content.update();
app.shell.activateById(widget.id);
}
});
const launcher_item : ILauncher.IItemOptions = {
command: command,
args: {
url: "#",
newBrowserTab: true,
title: 'Training',
id: 'training'
},
category: 'Other',
rank: 2,
};
launcher.add(launcher_item)
palette.addItem({ command, category: 'Share' });
}
};
export default plugin;

41
src/widget.tsx Normal file
View File

@ -0,0 +1,41 @@
import { ReactWidget } from '@jupyterlab/apputils';
import React from 'react'
import Container from 'react-bootstrap/Container';
import Row from 'react-bootstrap/Row';
import Col from 'react-bootstrap/Col';
import Alert from 'react-bootstrap/Alert';
const divStyle = {
marginLeft: '40px',
};
export class TrainingWidget extends ReactWidget {
applicationName = ""
constructor(label: string) {
super();
this.applicationName = label
}
render(): JSX.Element {
return (<div style={divStyle}><TmpLayout label={this.applicationName} /></div>);
}
}
interface LayoutProps {
label: string
};
const TmpLayout = (props: LayoutProps) => {
return (<Container >
<Row>
<Col><h2>{props.label}</h2>
</Col>
</Row>
<Row>
<Col> <Alert key="dark" variant="dark">
Extension under development. Coming soon...!
</Alert>
</Col>
</Row>
</Container>)
}

5
style/base.css Normal file
View File

@ -0,0 +1,5 @@
/*
See the JupyterLab Developer Guide for useful CSS Patterns:
https://jupyterlab.readthedocs.io/en/stable/developer/css.html
*/

1
style/index.css Normal file
View File

@ -0,0 +1 @@
@import url('base.css');

1
style/index.js Normal file
View File

@ -0,0 +1 @@
import './base.css';

25
tsconfig.json Normal file
View File

@ -0,0 +1,25 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"composite": true,
"declaration": true,
"esModuleInterop": true,
"incremental": true,
"jsx": "react",
"module": "esnext",
"moduleResolution": "node",
"noEmitOnError": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"preserveWatchOutput": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"outDir": "lib",
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "es2017",
"types": []
},
"include": ["src/*"]
}

4643
yarn.lock Normal file

File diff suppressed because it is too large Load Diff