init
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
This commit is contained in:
commit
4ae64963c4
|
@ -0,0 +1,8 @@
|
|||
node_modules
|
||||
dist
|
||||
coverage
|
||||
**/*.d.ts
|
||||
tests
|
||||
|
||||
**/__tests__
|
||||
ui-tests
|
|
@ -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'
|
||||
}
|
||||
};
|
|
@ -0,0 +1,122 @@
|
|||
*.bundle.*
|
||||
lib/
|
||||
node_modules/
|
||||
*.log
|
||||
.eslintcache
|
||||
.stylelintcache
|
||||
*.egg-info/
|
||||
.ipynb_checkpoints
|
||||
*.tsbuildinfo
|
||||
jupyterlab-data-pool/labextension
|
||||
# Version file is handled by hatchling
|
||||
jupyterlab-data-pool/_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
|
|
@ -0,0 +1,6 @@
|
|||
node_modules
|
||||
**/node_modules
|
||||
**/lib
|
||||
**/package.json
|
||||
!/package.json
|
||||
jupyterlab-data-pool
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"arrowParens": "avoid",
|
||||
"endOfLine": "auto"
|
||||
}
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -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]
|
|
@ -0,0 +1,5 @@
|
|||
# Changelog
|
||||
|
||||
<!-- <START NEW CHANGELOG ENTRY> -->
|
||||
|
||||
<!-- <END NEW CHANGELOG ENTRY> -->
|
|
@ -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.
|
|
@ -0,0 +1,101 @@
|
|||
# jupyterlab-data-pool
|
||||
|
||||
[![status-badge](https://ci.sandbox.iuk.hdm-stuttgart.de/api/badges/grosse/jupyterlab-data-pool/status.svg)](https://ci.sandbox.iuk.hdm-stuttgart.de/grosse/jupyterlab-data-pool)
|
||||
|
||||
Data Sharing
|
||||
|
||||
This extension is composed of a Python package named `jupyterlab-data-pool`
|
||||
for the server extension and a NPM package named `jupyterlab-data-pool`
|
||||
for the frontend extension.
|
||||
|
||||
## Requirements
|
||||
|
||||
- JupyterLab >= 3.0
|
||||
|
||||
## Install
|
||||
|
||||
To install the extension, execute:
|
||||
|
||||
```bash
|
||||
pip install jupyterlab-data-pool
|
||||
```
|
||||
|
||||
## Uninstall
|
||||
|
||||
To remove the extension, execute:
|
||||
|
||||
```bash
|
||||
pip uninstall jupyterlab-data-pool
|
||||
```
|
||||
|
||||
## 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-data-pool 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-data-pool
|
||||
# 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-data-pool
|
||||
pip uninstall jupyterlab-data-pool
|
||||
```
|
||||
|
||||
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-data-pool` within that folder.
|
||||
|
||||
### Packaging the extension
|
||||
|
||||
See [RELEASE](RELEASE.md)
|
|
@ -0,0 +1,68 @@
|
|||
# Making a new release of jupyterlab-data-pool
|
||||
|
||||
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.
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"packageManager": "python",
|
||||
"packageName": "jupyterlab-data-pool",
|
||||
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab-data-pool"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"NotebookApp": {
|
||||
"nbserver_extensions": {
|
||||
"jupyterlab-data-pool": true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"ServerApp": {
|
||||
"jpserver_extensions": {
|
||||
"jupyterlab-data-pool": true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
from ._version import __version__
|
||||
from .handlers import setup_handlers
|
||||
|
||||
|
||||
|
||||
def _jupyter_labextension_paths():
|
||||
return [{
|
||||
"src": "labextension",
|
||||
"dest": "jupyterlab-data-pool"
|
||||
}]
|
||||
|
||||
|
||||
|
||||
def _jupyter_server_extension_points():
|
||||
return [{
|
||||
"module": "jupyterlab-data-pool"
|
||||
}]
|
||||
|
||||
|
||||
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-data-pool"
|
||||
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
|
||||
|
|
@ -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-data-pool/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-data-pool", "get_example")
|
||||
handlers = [(route_pattern, RouteHandler)]
|
||||
web_app.add_handlers(host_pattern, handlers)
|
|
@ -0,0 +1,111 @@
|
|||
{
|
||||
"name": "jupyterlab-data-pool",
|
||||
"version": "0.1.0",
|
||||
"description": "Data Sharing",
|
||||
"keywords": [
|
||||
"jupyter",
|
||||
"jupyterlab",
|
||||
"jupyterlab-extension"
|
||||
],
|
||||
"homepage": "https://git.sandbox.iuk.hdm-stuttgart.de/grosse/jupyterlab-data-pool",
|
||||
"bugs": {
|
||||
"url": "https://git.sandbox.iuk.hdm-stuttgart.de/grosse/jupyterlab-data-pool/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-data-pool.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-data-pool/labextension jupyterlab-data-pool/_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.1.0",
|
||||
"@jupyterlab/apputils": "^3.5.2",
|
||||
"@jupyterlab/coreutils": "^5.1.0",
|
||||
"@jupyterlab/launcher": "^3.5.2",
|
||||
"@jupyterlab/services": "^6.1.0",
|
||||
"@jupyterlab/settingregistry": "^3.1.0",
|
||||
"@jupyterlab/ui-components": "^3.5.2",
|
||||
"@lumino/widgets": "^1.37.0",
|
||||
"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-data-pool"
|
||||
}
|
||||
}
|
||||
},
|
||||
"extension": true,
|
||||
"outputDir": "jupyterlab-data-pool/labextension",
|
||||
"schemaDir": "schema"
|
||||
}
|
||||
}
|
|
@ -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-data-pool"
|
||||
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-data-pool/labextension"]
|
||||
exclude = [".github", "binder"]
|
||||
|
||||
[tool.hatch.build.targets.wheel.shared-data]
|
||||
"jupyterlab-data-pool/labextension" = "share/jupyter/labextensions/jupyterlab-data-pool"
|
||||
"install.json" = "share/jupyter/labextensions/jupyterlab-data-pool/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-data-pool/_version.py"
|
||||
|
||||
[tool.hatch.build.hooks.jupyter-builder]
|
||||
dependencies = ["hatch-jupyter-builder>=0.5"]
|
||||
build-function = "hatch_jupyter_builder.npm_builder"
|
||||
ensured-targets = [
|
||||
"jupyterlab-data-pool/labextension/static/style.js",
|
||||
"jupyterlab-data-pool/labextension/package.json",
|
||||
]
|
||||
skip-if-exists = ["jupyterlab-data-pool/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-data-pool/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"]
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"jupyter.lab.shortcuts": [],
|
||||
"title": "jupyterlab-data-pool",
|
||||
"description": "jupyterlab-data-pool settings.",
|
||||
"type": "object",
|
||||
"properties": {},
|
||||
"additionalProperties": false
|
||||
}
|
|
@ -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-data-pool', // 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;
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -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 {DataPoolWidget} from "./widget"
|
||||
|
||||
|
||||
const plugin: JupyterFrontEndPlugin<void> = {
|
||||
id: 'jupyterlab-data-pool: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 = "Data Pool"
|
||||
const content = new DataPoolWidget();
|
||||
const widget = new MainAreaWidget({content});
|
||||
widget.id = 'jupyterlab-data-pool:plugin';
|
||||
widget.title.label = 'Data Pool';
|
||||
widget.title.closable = true;
|
||||
widget.title.icon = webDavIcon
|
||||
|
||||
|
||||
const command: string = 'jupyterlab-data-pool: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: 'Data Pool',
|
||||
id: 'data-pool'
|
||||
},
|
||||
category: 'Other',
|
||||
rank: 1,
|
||||
};
|
||||
launcher.add(launcher_item)
|
||||
|
||||
palette.addItem({ command, category: 'Share' });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
export default plugin;
|
|
@ -0,0 +1,39 @@
|
|||
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 DataPoolWidget extends ReactWidget {
|
||||
applicationName: string = ''
|
||||
constructor() {
|
||||
super();
|
||||
this.applicationName = "Data Pool"
|
||||
}
|
||||
|
||||
render(): JSX.Element {
|
||||
|
||||
return (<div style={divStyle}><TmpLayout /></div>);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const TmpLayout = () => {
|
||||
return (<Container >
|
||||
<Row>
|
||||
<Col><h2>Data Pool</h2>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<Row>
|
||||
<Col> <Alert key="dark" variant="dark">
|
||||
Extension under development. Coming soon...!
|
||||
</Alert>
|
||||
</Col>
|
||||
</Row>
|
||||
</Container>)
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
/*
|
||||
See the JupyterLab Developer Guide for useful CSS Patterns:
|
||||
|
||||
https://jupyterlab.readthedocs.io/en/stable/developer/css.html
|
||||
*/
|
|
@ -0,0 +1,2 @@
|
|||
@import url('base.css');
|
||||
|
|
@ -0,0 +1 @@
|
|||
import './base.css';
|
|
@ -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,
|
||||
"strictNullChecks": true,
|
||||
"target": "es2017",
|
||||
"types": []
|
||||
},
|
||||
"include": ["src/*"]
|
||||
}
|
Loading…
Reference in New Issue