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

This commit is contained in:
maltegrosse 2023-01-23 21:17:57 +01:00
commit 04f037e682
29 changed files with 5532 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-synthetic-data/labextension
# Version file is handled by hatchling
jupyterlab-synthetic-data/_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-synthetic-data

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.

100
README.md Normal file
View File

@ -0,0 +1,100 @@
# jupyterlab-synthetic-data
[![status-badge](https://ci.sandbox.iuk.hdm-stuttgart.de/api/badges/grosse/jupyterlab-synthetic-data/status.svg)](https://ci.sandbox.iuk.hdm-stuttgart.de/grosse/jupyterlab-synthetic-data)
Synthetic Data Generator
This extension is composed of a Python package named `jupyterlab-synthetic-data`
for the server extension and a NPM package named `jupyterlab-synthetic-data`
for the frontend extension.
## Requirements
- JupyterLab >= 3.0
## Install
To install the extension, execute:
```bash
pip install jupyterlab-synthetic-data
```
## Uninstall
To remove the extension, execute:
```bash
pip uninstall jupyterlab-synthetic-data
```
## 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-synthetic-data 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-synthetic-data
# 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-synthetic-data
pip uninstall jupyterlab-synthetic-data
```
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-synthetic-data` 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-synthetic-data
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-synthetic-data",
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab-synthetic-data"
}

View File

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

View File

@ -0,0 +1,7 @@
{
"ServerApp": {
"jpserver_extensions": {
"jupyterlab-synthetic-data": 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-synthetic-data"
}]
def _jupyter_server_extension_points():
return [{
"module": "jupyterlab-synthetic-data"
}]
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-synthetic-data"
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-synthetic-data/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-synthetic-data", "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-synthetic-data",
"version": "0.1.0",
"description": "Synthetic Data Generator",
"keywords": [
"jupyter",
"jupyterlab",
"jupyterlab-extension"
],
"homepage": "https://git.sandbox.iuk.hdm-stuttgart.de/grosse/jupyterlab-synthetic-data",
"bugs": {
"url": "https://git.sandbox.iuk.hdm-stuttgart.de/grosse/jupyterlab-synthetic-data/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-synthetic-data.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-synthetic-data/labextension jupyterlab-synthetic-data/_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.5.3",
"@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-synthetic-data"
}
}
},
"extension": true,
"outputDir": "jupyterlab-synthetic-data/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-synthetic-data"
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-synthetic-data/labextension"]
exclude = [".github", "binder"]
[tool.hatch.build.targets.wheel.shared-data]
"jupyterlab-synthetic-data/labextension" = "share/jupyter/labextensions/jupyterlab-synthetic-data"
"install.json" = "share/jupyter/labextensions/jupyterlab-synthetic-data/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-synthetic-data/_version.py"
[tool.hatch.build.hooks.jupyter-builder]
dependencies = ["hatch-jupyter-builder>=0.5"]
build-function = "hatch_jupyter_builder.npm_builder"
ensured-targets = [
"jupyterlab-synthetic-data/labextension/static/style.js",
"jupyterlab-synthetic-data/labextension/package.json",
]
skip-if-exists = ["jupyterlab-synthetic-data/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-synthetic-data/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-synthetic-data",
"description": "jupyterlab-synthetic-data 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-synthetic-data', // 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 = '<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="500.000000pt" height="500.000000pt" viewBox="0 0 500.000000 500.000000" preserveAspectRatio="xMidYMid meet"> <g transform="translate(0.000000,500.000000) scale(0.100000,-0.100000)" fill="#000000" stroke="none"> <path d="M1696 4741 c-210 -74 -237 -351 -44 -456 48 -26 64 -29 171 -33 l117 -4 0 -517 0 -516 -136 -320 c-612 -1441 -741 -1749 -755 -1805 -23 -91 -16 -251 13 -342 95 -288 348 -496 675 -553 70 -12 209 -15 769 -15 637 0 690 1 784 20 184 35 330 112 461 240 129 127 195 258 220 432 9 70 9 97 -6 173 -17 95 -27 120 -518 1275 -118 278 -251 591 -296 696 l-81 192 0 521 0 521 93 0 c128 0 189 19 249 79 108 108 97 284 -25 372 -83 60 -69 59 -891 58 -682 0 -755 -2 -800 -18z m1264 -1026 l0 -536 84 -197 c127 -298 402 -946 604 -1422 99 -234 187 -449 196 -479 25 -86 21 -217 -9 -307 -83 -248 -328 -436 -619 -474 -53 -7 -313 -10 -766 -8 -742 4 -701 1 -864 60 -135 49 -285 174 -359 299 -79 133 -103 300 -64 432 10 31 107 268 216 525 433 1019 487 1145 577 1359 l94 222 0 530 0 531 455 0 455 0 0 -535z"/> <path d="M2247 3832 c-20 -22 -22 -63 -5 -80 8 -8 57 -12 154 -12 116 0 145 3 158 16 22 21 20 50 -4 74 -18 18 -33 20 -153 20 -117 0 -136 -2 -150 -18z"/> <path d="M2252 3624 c-30 -20 -30 -68 0 -88 18 -13 51 -16 150 -16 115 0 130 2 148 20 11 11 20 29 20 40 0 11 -9 29 -20 40 -18 18 -33 20 -148 20 -99 0 -132 -3 -150 -16z"/> <path d="M2260 3417 c-35 -17 -40 -69 -8 -91 19 -14 58 -16 253 -16 261 0 279 4 273 63 -5 52 -27 57 -273 57 -157 0 -227 -4 -245 -13z"/> <path d="M2242 3198 c-18 -18 -14 -63 6 -81 15 -14 42 -17 148 -17 142 0 174 10 174 55 0 49 -20 55 -174 55 -97 0 -146 -4 -154 -12z"/> <path d="M2242 2988 c-17 -17 -15 -64 4 -82 12 -13 41 -16 153 -16 121 0 140 2 154 18 21 23 22 56 1 76 -13 13 -42 16 -158 16 -97 0 -146 -4 -154 -12z"/> <path d="M2248 2779 c-25 -14 -24 -75 1 -89 12 -6 113 -10 259 -10 219 0 240 2 255 18 22 24 21 55 -1 75 -16 15 -49 17 -258 17 -144 0 -246 -5 -256 -11z"/> <path d="M2248 2569 c-25 -14 -24 -75 1 -89 11 -5 80 -10 154 -10 117 0 136 2 150 18 22 24 21 55 -1 75 -15 14 -42 17 -153 17 -74 0 -142 -5 -151 -11z"/> <path d="M2246 2354 c-19 -18 -21 -65 -4 -82 8 -8 57 -12 154 -12 154 0 174 6 174 55 0 45 -32 55 -177 55 -106 0 -135 -3 -147 -16z"/> <path d="M1695 1663 c-306 -721 -279 -650 -278 -725 1 -162 140 -305 349 -358 73 -19 113 -20 739 -20 627 0 666 1 739 20 147 37 261 122 317 235 28 58 31 71 27 137 -4 66 -15 97 -105 308 l-100 235 -138 12 c-383 35 -640 127 -1010 359 -178 113 -327 194 -355 194 -12 0 -61 -106 -185 -397z"/> </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 {SyntheticWidget} from "./widget"
const plugin: JupyterFrontEndPlugin<void> = {
id: 'jupyterlab-synthetic-data: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 = "Synthetic Data"
const content = new SyntheticWidget(label);
const widget = new MainAreaWidget({content});
widget.id = 'jupyterlab-synthetic-data:plugin';
widget.title.label = label
widget.title.closable = true;
widget.title.icon = webDavIcon
const command: string = 'jupyterlab-synthetic-data: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: 'Synthetic Data',
id: 'synthetic-data'
},
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 SyntheticWidget 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,
"outDir": "lib",
"rootDir": "src",
"strict": true,
"skipLibCheck": true,
"strictNullChecks": true,
"target": "es2017",
"types": []
},
"include": ["src/*"]
}

4643
yarn.lock Normal file

File diff suppressed because it is too large Load Diff