Remove code of legacy jupyter lab extensions from the repo (#4146)

Co-authored-by: James Maslek <jmaslek11@gmail.com>
This commit is contained in:
Theodore Aptekarev
2023-02-07 10:05:20 +01:00
committed by GitHub
parent 0ee2ebcf1e
commit ef12295f33
75 changed files with 0 additions and 23811 deletions

1
.dockerignore vendored
View File

@@ -8,5 +8,4 @@ Dockerfile*
.idea
__pycache__
.python-version
jupyterlab/*/node_modules
logs/

13
.gitignore vendored
View File

@@ -49,19 +49,6 @@ build/nsis/app
DMG/*
*.dmg
# Jupyter Lab Extension build files
jupyterlab/**/build
jupyterlab/*/*.bundle.*
jupyterlab/*/lib/
jupyterlab/*/*/labextension/
jupyterlab/*/node_modules/
jupyterlab/*/*/node_modules/
jupyterlab/*/*.egg-info/
jupyterlab/*/.ipynb_checkpoints
jupyterlab/*/*.tsbuildinfo
jupyterlab/*/ui-tests/test-results/
jupyterlab/*/ui-tests/tests/*.ts-snapshots/
# User stylesheets
styles/user

55
jupyterlab/README.md vendored
View File

@@ -1,55 +0,0 @@
# Jupyter Ecosystem integration
The Jupyter ecosystem has created Open Source tools that have become the de-facto
standard for data related tasks.
This folder contains source code for a bunch of tools that help using the functionality
of the terminal in connection with Jupyter:
1. Jupyter Lab Extensions for using OpenBB Terminal
## 1. Jupyter Lab Extensions for using OpenBB Terminal
Documentation, OpenBB and GOpenBB-settings are 3 Jupyter Lab extensions that illustrate how
the terminal can be integrated with Jupyter Lab based IDEs.
_NOTE: The extensions should be considered prototypes and are not production-ready._
1. Only bash is supported (only macOS, Linux and WSL). No support for Windows powershell or command prompt.
2. The input values are not escaped
### Installation
To install the Terminal Launcher and the Settings Extensions run the following commands from the [root folder of the project](/):
```bash
pip install jupyterlab/openbb
pip install jupyterlab/openbb-settings
pip install jupyterlab/documentation
jupyter labextension install jupyterlab/openbb
jupyter labextension install jupyterlab/openbb-settings
jupyter labextension install jupyterlab/documentation
```
### Development setup
In this section `openbb` extension will be used as an example.
- In one terminal window `cd` into the launcher extension folder and build the extension:
```bash
cd openbb
jlpm
pip install -e .
jlpm run build
jupyter labextension develop . --overwrite
jlpm run watch
```
- In the second tab run jupyter lab
```bash
jupyter lab
```
---

View File

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

View File

@@ -1,53 +0,0 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jsdoc/recommended',
'plugin:prettier/recommended',
'plugin:react/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'jsdoc'],
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',
'jsdoc/require-param-type': 'off',
'jsdoc/require-property-type': 'off',
'jsdoc/require-returns-type': 'off',
'jsdoc/no-types': 'warn',
'prefer-arrow-callback': 'error',
},
settings: {
jsdoc: {
mode: 'typescript',
},
react: {
version: 'detect',
},
},
};

View File

@@ -1,22 +0,0 @@
include LICENSE
include README.md
include pyproject.toml
include jupyter-config/openbb_terminal_documentation.json
include package.json
include ts*.json
graft openbb_terminal_documentation/labextension
# Javascript files
graft src
graft style
prune **/node_modules
prune lib
# Patterns to exclude from any directory
global-exclude *~
global-exclude *.pyc
global-exclude *.pyo
global-exclude .git
global-exclude .ipynb_checkpoints

View File

@@ -1,17 +0,0 @@
# OpenBB Terminal Documentation
This extensions adds a button into the OpenBB Terminal category of the Jupyter Lab launcher panel.
## Install, Use and Develop
```bash
pip install -e .
jlpm
jlpm run build:prod
jupyter labextension install .
# Rebuild Typescript source after making changes
jlpm build
# Rebuild JupyterLab after making any changes
jupyter lab build
```

View File

@@ -1,3 +0,0 @@
# Making a new release of gamestonk-settings
Check out the [workflow documentation](https://github.com/jupyter-server/jupyter_releaser#typical-workflow) for information.

View File

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

View File

@@ -1,87 +0,0 @@
{
"name": "@gamestonk/documentation",
"version": "0.1.0",
"description": "Gamestonk terminal documentation",
"keywords": [
"jupyter",
"jupyterlab",
"jupyterlab-extension"
],
"homepage": "https://github.com/OpenBB-finance/OpenBBTerminal",
"bugs": {
"url": "https://github.com/OpenBB-finance/OpenBBTerminal/issues"
},
"license": "MIT",
"author": {
"name": "Project Jupyter Contributors",
"email": "dro.lopes@campus.fct.unl.pt"
},
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"style/**/*.{css,eot,js,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://github.com/OpenBB-finance/OpenBBTerminal.git"
},
"scripts": {
"build": "jlpm run build:lib && jlpm run build:labextension:dev",
"build:all": "jlpm run build:lib && jlpm run build:labextension",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
"build:lib": "tsc",
"build:prod": "jlpm run clean && jlpm run build:lib && jlpm run build:labextension",
"clean": "jlpm run clean:lib",
"clean:all": "jlpm run clean:lib && jlpm run clean:labextension",
"clean:labextension": "rimraf openbb_terminal_documentation/labextension",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"eslint": "eslint . --ext .ts,.tsx --fix",
"eslint:check": "eslint . --ext .ts,.tsx",
"install:extension": "jlpm run build",
"prepare": "jlpm run clean && jlpm run build:prod",
"watch": "run-p watch:src watch:labextension",
"watch:labextension": "jupyter labextension watch .",
"watch:src": "tsc -w"
},
"dependencies": {
"@jupyterlab/application": "^3.2.8",
"@jupyterlab/launcher": "^3.2.8",
"@jupyterlab/mainmenu": "^3.2.8",
"marked": "^4.0.10"
},
"devDependencies": {
"@jupyterlab/builder": "^3.2.8",
"@typescript-eslint/eslint-plugin": "^5.10.0",
"@typescript-eslint/parser": "^5.10.0",
"eslint": "^8.7.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-jsdoc": "^37.6.3",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.28.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
"typescript": "<4.4"
},
"resolutions": {
"json-schema": "^0.4.0",
"marked": "^4.0.10",
"got": "^11.8.5",
"jpeg-js": "^0.4.4"
},
"sideEffects": [
"style/*.css",
"style/*.svg",
"style/index.js"
],
"jupyterlab": {
"extension": true,
"outputDir": "openbb_terminal_documentation/labextension",
"schemaDir": "schema"
},
"styleModule": "style/index.js"
}

View File

@@ -1,17 +0,0 @@
[build-system]
requires = ["jupyter_packaging~=0.10,<2", "jupyterlab~=3.1"]
build-backend = "jupyter_packaging.build_api"
[tool.jupyter-packaging.options]
skip-if-exists = ["openbb_terminal_documentation/labextension/static/style.js"]
ensured-targets = ["openbb_terminal_documentation/labextension/static/style.js", "openbb_terminal_documentation/labextension/package.json"]
[tool.jupyter-packaging.builder]
factory = "jupyter_packaging.npm_builder"
[tool.jupyter-packaging.build-args]
build_cmd = "build:prod"
npm = ["jlpm"]
[tool.check-manifest]
ignore = ["openbb_terminal_documentation/labextension/**", "yarn.lock", ".*", "package-lock.json"]

View File

@@ -1,25 +0,0 @@
{
"title": "OpenBB Terminal Documentation",
"description": "OpenBB Terminal Documentation.",
"jupyter.lab.menus": {
"main": [
{
"id": "jp-mainmenu-file",
"items": [
{
"type": "submenu",
"id": "jp-mainmenu-file-new",
"items": [
{
"command": "gamestonk:documentation",
"rank": 30
}
]
}
]
}
]
},
"additionalProperties": false,
"type": "object"
}

View File

@@ -1,86 +0,0 @@
"""
openbb_terminal_documentation setup
"""
import json
import sys
from pathlib import Path
import setuptools
HERE = Path(__file__).parent.resolve()
# The name of the project
name = "openbb_terminal_documentation"
lab_path = HERE / name.replace("-", "_") / "labextension"
# Representative files that should exist after a successful build
ensured_targets = [str(lab_path / "package.json"), str(lab_path / "static/style.js")]
labext_name = "@gamestonk/documentation"
data_files_spec = [
(
"share/jupyter/labextensions/%s" % labext_name,
str(lab_path.relative_to(HERE)),
"**",
),
("share/jupyter/labextensions/%s" % labext_name, ".", "install.json"),
]
long_description = (HERE / "README.md").read_text()
# Get the package info from package.json
pkg_json = json.loads((HERE / "package.json").read_bytes())
setup_args = dict(
name=name,
version=pkg_json["version"],
url=pkg_json["homepage"],
author=pkg_json["author"]["name"],
author_email=pkg_json["author"]["email"],
description=pkg_json["description"],
license=pkg_json["license"],
long_description=long_description,
long_description_content_type="text/markdown",
packages=setuptools.find_packages(),
install_requires=[],
zip_safe=False,
include_package_data=True,
python_requires=">=3.6",
platforms="Linux, Mac OS X, Windows",
keywords=["Jupyter", "JupyterLab", "JupyterLab3"],
classifiers=[
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Framework :: Jupyter",
],
)
try:
from jupyter_packaging import get_data_files, npm_builder, wrap_installers
post_develop = npm_builder(
build_cmd="install:extension", source_dir="src", build_dir=lab_path
)
setup_args["cmdclass"] = wrap_installers(
post_develop=post_develop, ensured_targets=ensured_targets
)
setup_args["data_files"] = get_data_files(data_files_spec)
except ImportError as e:
import logging
logging.basicConfig(format="%(levelname)s: %(message)s")
logging.warning(
"Build tool `jupyter-packaging` is missing. Install it with pip or conda."
)
if not ("--name" in sys.argv or "--version" in sys.argv):
raise e
if __name__ == "__main__":
setuptools.setup(**setup_args)

View File

@@ -1,77 +0,0 @@
import {
JupyterFrontEnd,
JupyterFrontEndPlugin,
} from '@jupyterlab/application';
import { ICommandPalette } from '@jupyterlab/apputils';
import { ILauncher } from '@jupyterlab/launcher';
import { IMainMenu } from "@jupyterlab/mainmenu";
import { LabIcon } from '@jupyterlab/ui-components';
import docsIconStr from '../style/docs.svg';
const CATEGORY = "OpenBB Terminal";
namespace CommandIDs {
export const createNew = 'jlab-examples:create-new-python-file';
}
const extension: JupyterFrontEndPlugin<void> = {
id: 'documentation',
autoStart: true,
optional: [ILauncher, ICommandPalette],
activate: (
app: JupyterFrontEnd,
launcher: ILauncher | null,
menu: IMainMenu | null,
palette: ICommandPalette | null
) => {
const { commands } = app;
const command = CommandIDs.createNew;
const icon = new LabIcon({
name: 'documentation:docs-icon',
svgstr: docsIconStr,
});
commands.addCommand(command, {
label: 'Gamestonk Documentation',
icon: icon,
execute: (args: any) => {
window.open(
'https://openbb-finance.github.io/OpenBBTerminal/',
'_blank'
);
},
});
// Add the command to the launcher
if (launcher) {
launcher.add({
command,
category: CATEGORY,
rank: 3,
});
}
// Add the command to the palette
if (palette) {
palette.addItem({
command,
args: { isPalette: true },
category: CATEGORY,
});
}
// Add the command to the menu
if (menu) {
menu.fileMenu.newMenu.addGroup([{ command }], 30);
}
console.log("Added Gamestonk Settings Extension.");
},
};
export default extension;

View File

@@ -1,4 +0,0 @@
declare module '*.svg' {
const value: string;
export default value;
}

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="256px" height="256px" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>docs</title>
<g id="docs" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<rect id="Rectangle" fill="#424242" x="15" y="18" width="225" height="220"></rect>
<path d="M128.5,67.5 C121.320298,67.5 115.5,73.3202983 115.5,80.5 C115.5,87.6797017 121.320298,93.5 128.5,93.5 C135.679702,93.5 141.5,87.6797017 141.5,80.5 C141.5,77.0521856 140.130361,73.7455848 137.692388,71.3076118 C135.254415,68.8696389 131.947814,67.5 128.5,67.5 Z" id="Path" stroke="#FFFFFF" stroke-width="10" fill-rule="nonzero"></path>
<rect id="Rectangle" fill="#FFFFFF" x="115.652174" y="108" width="25.7391304" height="74" rx="12"></rect>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 866 B

View File

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

View File

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

View File

@@ -1,24 +0,0 @@
{
"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": false,
"target": "es2017",
"types": []
},
"include": ["src/*"]
}

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -1,54 +0,0 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jsdoc/recommended',
'plugin:prettier/recommended',
'plugin:react/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'jsdoc'],
rules: {
"react/react-in-jsx-scope": "off",
'@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',
'double',
{ avoidEscape: true, allowTemplateLiterals: false },
],
curly: ['error', 'all'],
eqeqeq: 'error',
'jsdoc/require-param-type': 'off',
'jsdoc/require-property-type': 'off',
'jsdoc/require-returns-type': 'off',
'jsdoc/no-types': 'warn',
'prefer-arrow-callback': 'error',
},
settings: {
jsdoc: {
mode: 'typescript',
},
react: {
version: 'detect',
},
},
};

View File

@@ -1,22 +0,0 @@
include LICENSE
include README.md
include pyproject.toml
include jupyter-config/openbb_terminal_settings.json
include package.json
include ts*.json
graft openbb_terminal_settings/labextension
# Javascript files
graft src
graft style
prune **/node_modules
prune lib
# Patterns to exclude from any directory
global-exclude *~
global-exclude *.pyc
global-exclude *.pyo
global-exclude .git
global-exclude .ipynb_checkpoints

View File

@@ -1,17 +0,0 @@
# OpenBB Terminal Settings Menu
This extensions allows the user to set API keys and feature flags for the OpenBB Terminal
## Install, Use and Develop
```bash
pip install -e .
jlpm
jlpm run build:prod
jupyter labextension install .
# Rebuild Typescript source after making changes
jlpm build
# Rebuild JupyterLab after making any changes
jupyter lab build
```

View File

@@ -1,3 +0,0 @@
# Making a new release of gamestonk-settings
Check out the [workflow documentation](https://github.com/jupyter-server/jupyter_releaser#typical-workflow) for information.

View File

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

View File

@@ -1,13 +0,0 @@
import json
import os.path as osp
from ._version import __version__ # noqa: F401
HERE = osp.abspath(osp.dirname(__file__))
with open(osp.join(HERE, "labextension", "package.json")) as fid:
data = json.load(fid)
def _jupyter_labextension_paths():
return [{"src": "labextension", "dest": data["name"]}]

View File

@@ -1,2 +0,0 @@
version_info = (0, 1, 0)
__version__ = ".".join(map(str, version_info))

View File

@@ -1,89 +0,0 @@
{
"name": "@gamestonk/settings",
"version": "0.1.0",
"description": "Gamestonk settings launcher",
"keywords": [
"jupyter",
"jupyterlab",
"jupyterlab-extension"
],
"homepage": "https://github.com/OpenBB-finance/OpenBBTerminal",
"bugs": {
"url": "https://github.com/OpenBB-finance/OpenBBTerminal/issues"
},
"license": "MIT",
"author": {
"name": "Gamestonk Contributors",
"email": "dro.lopes@campus.fct.unl.pt"
},
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
"style/index.js",
"schema/**/*.json"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"style": "style/index.css",
"repository": {
"type": "git",
"url": "https://github.com/jupyterlab/extension-examples.git"
},
"scripts": {
"build": "jlpm run build:lib && jlpm run build:labextension:dev",
"build:all": "jlpm run build:lib && jlpm run build:labextension",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
"build:lib": "tsc",
"build:prod": "jlpm run clean && jlpm run build:lib && jlpm run build:labextension",
"clean": "jlpm run clean:lib",
"clean:all": "jlpm run clean:lib && jlpm run clean:labextension",
"clean:labextension": "rimraf openbb_terminal_settings/labextension",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"eslint": "eslint . --ext .ts,.tsx --fix",
"eslint:check": "eslint . --ext .ts,.tsx",
"install:extension": "jlpm run build",
"prepare": "jlpm run clean && jlpm run build:prod",
"watch": "run-p watch:src watch:labextension",
"watch:labextension": "jupyter labextension watch .",
"watch:src": "tsc -w"
},
"dependencies": {
"@jupyterlab/application": "^3.2.8",
"@jupyterlab/launcher": "^3.2.8",
"@jupyterlab/mainmenu": "^3.2.8",
"@jupyterlab/settingregistry": "^3.2.8",
"@jupyterlab/ui-components": "^3.2.8",
"marked": "^4.0.10"
},
"devDependencies": {
"@jupyterlab/builder": "^3.2.8",
"@typescript-eslint/eslint-plugin": "^5.10.0",
"@typescript-eslint/parser": "^5.10.0",
"eslint": "^8.7.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-jsdoc": "^37.6.3",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.28.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
"typescript": "<4.4"
},
"resolutions": {
"json-schema": "^0.4.0",
"marked": "^4.0.10",
"got": "^11.8.5",
"jpeg-js": "^0.4.4"
},
"sideEffects": [
"style/*.css",
"style/index.js"
],
"jupyterlab": {
"extension": true,
"outputDir": "openbb_terminal_settings/labextension",
"schemaDir": "schema"
},
"styleModule": "style/index.js"
}

View File

@@ -1,17 +0,0 @@
[build-system]
requires = ["jupyter_packaging~=0.10,<2", "jupyterlab~=3.1"]
build-backend = "jupyter_packaging.build_api"
[tool.jupyter-packaging.options]
skip-if-exists = ["openbb_terminal_settings/labextension/static/style.js"]
ensured-targets = ["openbb_terminal_settings/labextension/static/style.js", "openbb_terminal_settings/labextension/package.json"]
[tool.jupyter-packaging.builder]
factory = "jupyter_packaging.npm_builder"
[tool.jupyter-packaging.build-args]
build_cmd = "build:prod"
npm = ["jlpm"]
[tool.check-manifest]
ignore = ["openbb_terminal_settings/labextension/**", "yarn.lock", ".*", "package-lock.json"]

View File

@@ -1,392 +0,0 @@
{
"title": "OpenBB settings",
"description": "Settings for OpenBB Terminal extension.",
"type": "object",
"properties":
{
"FEATURE_FLAGS":
{
"title": "Feature flags",
"description": "Feature flags for the OpenBB Terminal.",
"default":
{
"OPENBB_USE_CLEAR_AFTER_CMD":
{
"type": "bool",
"form": "checkbox",
"title": "Clear after command",
"description": "Use clear console after each command",
"default": false,
"value": ""
},
"OPENBB_USE_FLAIR":
{
"type": "string",
"form": "text",
"title": "Console flair",
"description": "Select console flair (choose from config_terminal.py list)",
"default": "openbb",
"value": ""
},
"OPENBB_USE_ION":
{
"type": "bool",
"form": "checkbox",
"title": "Interactive charts",
"description": "Enable interactive matplotlib",
"default": true,
"value": ""
},
"OPENBB_USE_PROMPT_TOOLKIT":
{
"type": "bool",
"form": "checkbox",
"title": "Autocomplete",
"description": "Enable Prompt Toolkit",
"default": true,
"value": ""
},
"OPENBB_ENABLE_PREDICT":
{
"type": "bool",
"form": "checkbox",
"title": "Prediction menu",
"description": "Enable Prediction features",
"default": true,
"value": ""
},
"OPENBB_USE_PLOT_AUTOSCALING":
{
"type": "bool",
"form": "checkbox",
"title": "Plot autoscaling",
"description": "Enable plot autoscaling",
"default": false,
"value": ""
},
"OPENBB_ENABLE_THOUGHTS_DAY":
{
"type": "bool",
"form": "checkbox",
"title": "Thoughts of the day",
"description": "Enable thoughts of the day",
"default": false,
"value": ""
},
"OPENBB_ENABLE_QUICK_EXIT":
{
"type": "bool",
"form": "checkbox",
"title": "Quick exit",
"description": "Quick exit for testing",
"default": false,
"value": ""
}
}
},
"APP_SETTINGS":
{
"title": "General",
"description": "Application settings for the OpenBB Terminal.",
"default":
{
"PAPERMILL_NOTEBOOK_REPORT_PORT":
{
"type": "number",
"form": "number",
"title": "Papermill port",
"description": "Papermill port",
"default": 8892,
"value": ""
},
"PYTHON_BINARY":
{
"type": "string",
"form": "text",
"title": "Python executable",
"description": "Path to the python in your custom environment",
"default": "python",
"value": ""
},
"TERMINAL_PATH":
{
"type": "string",
"form": "text",
"title": "Terminal path",
"description": "Path to the terminal.py",
"default": "terminal.py",
"value": ""
}
}
},
"API_KEYS":
{
"title": "API Keys",
"description": "Access credentials for data providers.",
"default":
{
"OPENBB_API_KEY_ALPHAVANTAGE":
{
"type": "string",
"form": "password",
"title": "Alphavantage",
"description": "https://www.alphavantage.co",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_KEY_FINANCIALMODELINGPREP":
{
"type": "string",
"form": "password",
"title": "financialmodelingprep",
"description": "https://financialmodelingprep.com/developer",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_KEY_QUANDL":
{
"type": "string",
"form": "password",
"title": "quandl",
"description": "https://www.quandl.com/tools/api",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_REDDIT_CLIENT_ID":
{
"type": "string",
"form": "password",
"title": "Reddit client ID",
"description": "https://www.reddit.com/prefs/apps",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_REDDIT_CLIENT_SECRET":
{
"type": "string",
"form": "password",
"title": "Reddit client secret",
"description": "https://www.reddit.com/prefs/apps",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_REDDIT_USERNAME":
{
"type": "string",
"form": "password",
"title": "Reddit username",
"description": "https://www.reddit.com/prefs/apps",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_REDDIT_USER_AGENT":
{
"type": "string",
"form": "password",
"title": "Reddit user agent",
"description": "https://www.reddit.com/prefs/apps",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_REDDIT_PASSWORD":
{
"type": "string",
"form": "password",
"title": "Reddit password",
"description": "https://www.reddit.com/prefs/apps",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_POLYGON_KEY":
{
"type": "string",
"form": "password",
"title": "Polygon",
"description": "https://polygon.io",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_TWITTER_KEY":
{
"type": "string",
"form": "password",
"title": "Twitter key",
"description": "https://developer.twitter.com",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_TWITTER_SECRET_KEY":
{
"type": "string",
"form": "password",
"title": "Twitter secret",
"description": "https://developer.twitter.com",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_TWITTER_BEARER_TOKEN":
{
"type": "string",
"form": "password",
"title": "Twitter token",
"description": "https://developer.twitter.com",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_FRED_KEY":
{
"type": "string",
"form": "password",
"title": "FRED",
"description": "https://fred.stlouisfed.org/docs/api/api_key.html",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_NEWS_TOKEN":
{
"type": "string",
"form": "password",
"title": "NewsAPI",
"description": "https://newsapi.org",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_RH_USERNAME":
{
"type": "string",
"form": "password",
"title": "Robinhood username",
"description": "Robinhood",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_RH_PASSWORD":
{
"type": "string",
"form": "password",
"title": "Robinhood password",
"description": "Robinhood",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_DG_USERNAME":
{
"type": "string",
"form": "password",
"title": "Degiro username",
"description": "Degiro",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_DG_PASSWORD":
{
"type": "string",
"form": "password",
"title": "Degiro password",
"description": "Degiro",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_DG_TOTP_SECRET":
{
"type": "string",
"form": "password",
"title": "Degiro secret",
"description": "Degiro",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_OANDA_ACCOUNT_TYPE":
{
"type": "string",
"form": "password",
"title": "Oanda account type",
"description": "https://developer.oanda.com",
"default": "practice",
"value": ""
},
"OPENBB_OANDA_ACCOUNT":
{
"type": "string",
"form": "password",
"title": "Oanda account",
"description": "https://developer.oanda.com",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_OANDA_TOKEN":
{
"type": "string",
"form": "password",
"title": "Oanda token",
"description": "https://developer.oanda.com",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_TRADIER_TOKEN":
{
"type": "string",
"form": "password",
"title": "Tradier token",
"description": "https://tradier.com/products/market-data-api",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_CMC_KEY":
{
"type": "string",
"form": "password",
"title": "Coinmarketcap key",
"description": "https://coinmarketcap.com/api/",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_BINANCE_KEY":
{
"type": "string",
"form": "password",
"title": "Binance key",
"description": "https://www.binance.com/en/",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_BINANCE_SECRET":
{
"type": "string",
"form": "password",
"title": "Binance secret",
"description": "Binance secret",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_FINNHUB_KEY":
{
"type": "string",
"form": "password",
"title": "Finnhub key",
"description": "https://finnhub.io",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_IEX_TOKEN":
{
"type": "string",
"form": "password",
"title": "IEX Cloud key",
"description": "https://iexcloud.io",
"default": "REPLACE_ME",
"value": ""
},
"OPENBB_API_SENTIMENTINVESTOR_TOKEN":
{
"type": "string",
"form": "password",
"title": "Sentimentinvestor token",
"description": "https://www.sentimentinvestor.com",
"default": "REPLACE_ME",
"value": ""
}
}
}
}
}

View File

@@ -1,86 +0,0 @@
"""
openbb_terminal_settings setup
"""
import json
import sys
from pathlib import Path
import setuptools
HERE = Path(__file__).parent.resolve()
# The name of the project
name = "openbb_terminal_settings"
lab_path = HERE / name.replace("-", "_") / "labextension"
# Representative files that should exist after a successful build
ensured_targets = [str(lab_path / "package.json"), str(lab_path / "static/style.js")]
labext_name = "@gamestonk/settings"
data_files_spec = [
(
"share/jupyter/labextensions/%s" % labext_name,
str(lab_path.relative_to(HERE)),
"**",
),
("share/jupyter/labextensions/%s" % labext_name, ".", "install.json"),
]
long_description = (HERE / "README.md").read_text()
# Get the package info from package.json
pkg_json = json.loads((HERE / "package.json").read_bytes())
setup_args = dict(
name=name,
version=pkg_json["version"],
url=pkg_json["homepage"],
author=pkg_json["author"]["name"],
author_email=pkg_json["author"]["email"],
description=pkg_json["description"],
license=pkg_json["license"],
long_description=long_description,
long_description_content_type="text/markdown",
packages=setuptools.find_packages(),
install_requires=[],
zip_safe=False,
include_package_data=True,
python_requires=">=3.6",
platforms="Linux, Mac OS X, Windows",
keywords=["Jupyter", "JupyterLab", "JupyterLab3"],
classifiers=[
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Framework :: Jupyter",
],
)
try:
from jupyter_packaging import get_data_files, npm_builder, wrap_installers
post_develop = npm_builder(
build_cmd="install:extension", source_dir="src", build_dir=lab_path
)
setup_args["cmdclass"] = wrap_installers(
post_develop=post_develop, ensured_targets=ensured_targets
)
setup_args["data_files"] = get_data_files(data_files_spec)
except ImportError as e:
import logging
logging.basicConfig(format="%(levelname)s: %(message)s")
logging.warning(
"Build tool `jupyter-packaging` is missing. Install it with pip or conda."
)
if not ("--name" in sys.argv or "--version" in sys.argv):
raise e
if __name__ == "__main__":
setuptools.setup(**setup_args)

View File

@@ -1,58 +0,0 @@
import { useState } from "react";
/**
* Generic input form
*
* @class FormInput (name)
* @param {} arg1 Arguments
* @param {} arg1.itemParent The item parent
* @param {} arg1.index The item index
* @param {} arg1.onChangeParent On change parent function
* @returns {} Gemeric input form
*/
export default function FormInput({
itemParent,
index,
onChangeParent,
}: {
itemParent: any;
index: number;
onChangeParent: any;
}): any {
const [item, setItem] = useState({
key: itemParent.key,
value: itemParent.value,
});
const onChange = (event: any) => {
const newValue =
event.target.type === "checkbox"
? event.target.checked
: event.target.value;
setItem((prevState) => {
const value = item.value;
value.value = newValue;
const newItem = { ...prevState, value: value };
onChangeParent(index, newItem);
return newItem;
});
};
return (
<>
<label className="inputFieldLabel">{item.value.title}</label>
<input
className={item.value.title}
type={item.value.form}
checked={
item.value.form === "checkbox"
? item.value.value === ""
? item.value.default
: item.value.value
: false
}
value={item.value.value === "" ? item.value.default : item.value.value}
onChange={onChange}
/>
</>
);
}

View File

@@ -1,90 +0,0 @@
import {
JupyterFrontEnd,
JupyterFrontEndPlugin,
} from "@jupyterlab/application";
import { ICommandPalette } from "@jupyterlab/apputils";
import { MainAreaWidget } from "@jupyterlab/apputils";
import { ILauncher } from "@jupyterlab/launcher";
import { ISettingRegistry } from "@jupyterlab/settingregistry";
import { IMainMenu } from "@jupyterlab/mainmenu";
import { LabIcon } from "@jupyterlab/ui-components";
import svgIconStr from "../style/settings-icon.svg";
import { TerminalSettingsWidget } from "./widget";
const CATEGORY = "OpenBB Terminal";
/**
* The command IDs used by the Gamestonk Settings plugin.
*/
namespace CommandIDs {
export const create = "gamestonk:settings";
}
/**
* Initialization data for the Gamestonk Settings extension.
*/
const extension: JupyterFrontEndPlugin<void> = {
id: "gst:settings",
autoStart: true,
optional: [ILauncher, IMainMenu, ICommandPalette, ISettingRegistry],
activate: async (
app: JupyterFrontEnd,
launcher: ILauncher | null,
menu: IMainMenu | null,
palette: ICommandPalette | null,
settings: ISettingRegistry
) => {
const { commands } = app;
const command = CommandIDs.create;
const icon = new LabIcon({
name: "launcher:gst-settings-icon",
svgstr: svgIconStr,
});
const s = await settings.load("@gamestonk/settings:settings");
commands.addCommand(command, {
caption: "Edit OpenBB Terminal Settings",
label: "Settings",
icon: (args) => (args["isPalette"] ? null : icon),
execute: () => {
const content = new TerminalSettingsWidget(s);
const widget = new MainAreaWidget<TerminalSettingsWidget>({ content });
widget.title.label = "Gamestonk Settings";
widget.title.icon = icon;
app.shell.add(widget, "main", { activate: true, mode: "split-right" });
},
});
if (launcher) {
launcher.add({
command,
category: CATEGORY,
rank: 2,
});
}
// Add the command to the palette
if (palette) {
palette.addItem({
command,
args: { isPalette: true },
category: CATEGORY,
});
}
// Add the command to the menu
if (menu) {
menu.fileMenu.newMenu.addGroup([{ command }], 30);
}
console.log("Added Gamestonk Settings Extension.");
},
};
export default extension;

View File

@@ -1,4 +0,0 @@
declare module '*.svg' {
const value: string;
export default value;
}

View File

@@ -1,189 +0,0 @@
import { ReactWidget } from "@jupyterlab/apputils";
import { ISettingRegistry } from "@jupyterlab/settingregistry";
import FormInput from "./components/FormInput";
/**
* OpenBB Terminal Settings Menu
*
* @class GamestonkTerminalSettingsComponent (name)
* @param {} root0 - s: Settings object
* @param {} root0.s - s: Accessible settings object
* @returns {} JSX.Element Settings form component
*/
export function GamestonkTerminalSettingsComponent({ s }: any): JSX.Element {
/**
* Get the section settings values.
*
* The section settings are taken from the user space (`s.user` if section keys
* exist there) or from the default values of the settings schema.
*
* @param section The section name
* @returns The state of the section settings.
*/
function getSectionState(section: string): Record<string, unknown>[] {
const values: Array<Record<string, unknown>> = [];
Object.keys(s.schema.properties[section].default).forEach((element) => {
const settingsValue =
typeof s.user[section] === "undefined"
? s.schema.properties[section].default[element]
: s.user[section][element];
values.push({
key: element,
value: settingsValue,
});
});
return values;
}
const featureFlags = getSectionState("FEATURE_FLAGS");
const appSettings = getSectionState("APP_SETTINGS");
const apiKeys = getSectionState("API_KEYS");
const onFeatureFlagsChange = (index: any, item: any) => {
featureFlags[index] = item;
};
const onAppSettingsChange = (index: any, item: any) => {
appSettings[index] = item;
};
const onApiKeysChange = (index: any, item: any) => {
apiKeys[index] = item;
};
/**
* @param event - Update button click event
*/
function handleSubmit(event: any) {
event.preventDefault();
const featureFlagsObject = {} as any;
featureFlags.forEach((flag: any) => {
featureFlagsObject[flag.key] = flag["value"];
});
s.set("FEATURE_FLAGS", featureFlagsObject);
const apiKeysObject = {} as any;
apiKeys.forEach((apiKey: any) => {
apiKeysObject[apiKey.key] = apiKey["value"];
});
s.set("API_KEYS", apiKeysObject);
const appSettingsObject = {} as any;
appSettings.forEach((appSetting: any) => {
appSettingsObject[appSetting.key] = appSetting["value"];
});
s.set("APP_SETTINGS", appSettingsObject);
alert("Settings updated.");
}
return (
<div className="gamestonkSettings">
<div className="settingsForm">
<form>
<fieldset id="featureFlags">
<p className="settingsSectionLabel">Feature Flags</p>
<div className="fieldSetData">
{featureFlags.map((item: any, index: any) => (
<FormInput
key={index}
itemParent={item}
index={index}
onChangeParent={onFeatureFlagsChange}
/>
))}
</div>
<div className="container">
<div className="center">
<button
className="settingsSectionButton"
onClick={handleSubmit}
>
Update Flags
</button>
</div>
</div>
</fieldset>
</form>
<br />
<br />
<form onSubmit={handleSubmit}>
<fieldset id="appSettings">
<p className="settingsSectionLabel">Configurations</p>
<div className="fieldSetData">
{appSettings.map((item: any, index: any) => (
<FormInput
key={index}
itemParent={item}
index={index}
onChangeParent={onAppSettingsChange}
/>
))}
</div>
<div className="container">
<div className="center">
<button
className="settingsSectionButton"
onClick={handleSubmit}
>
Update Configurations
</button>
</div>
</div>
</fieldset>
</form>
<br />
<br />
<form onSubmit={handleSubmit}>
<fieldset id="apiKeys">
<p className="settingsSectionLabel">API keys</p>
<div className="fieldSetData">
{apiKeys.map((item: any, index: any) => (
<FormInput
key={index}
itemParent={item}
index={index}
onChangeParent={onApiKeysChange}
/>
))}
</div>
<div className="container">
<div className="center">
<button
className="settingsSectionButton"
onClick={handleSubmit}
>
Update API keys
</button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
);
}
/**
* A Lumino Widget that wraps a GamestonkTerminalSettingsComponent.
*
* @class TerminalSettingsWidget (name)
*/
export class TerminalSettingsWidget extends ReactWidget {
/**
* Constructs a new TerminalSettingsWidget.
*/
s: ISettingRegistry.ISettings;
constructor(s: ISettingRegistry.ISettings) {
super();
this.addClass("gamestonkSettingsWidget");
this.s = s;
}
render(): JSX.Element {
return <GamestonkTerminalSettingsComponent s={this.s} />;
}
}

View File

@@ -1,99 +0,0 @@
.gamestonkSettingsWidget {
color: var(--jp-ui-font-color1);
background: var(--jp-layout-color1);
font-size: 16px;
display: flex;
align-items: left;
justify-content: left;
text-align: left;
}
.gamestonkSettings {
width: 100%;
height: 100%;
box-sizing: border-box;
overflow: auto;
display: inline;
justify-content: center;
}
.settingsForm {
min-width: 542px;
min-width: 542px;
width: 85%;
height: 100%;
padding-top: var(--jp-private-launcher-top-padding);
padding-left: var(--jp-private-launcher-side-padding);
padding-right: var(--jp-private-launcher-side-padding);
box-sizing: border-box;
}
.inputFieldLabel {
font-size: 16px;
}
form fieldset {
padding: 6%;
border: 1px solid var(--jp-border-color2);
}
form input[type="text" i],
form input[type="number" i] {
border: 1px solid var(--jp-border-color2);
}
.settingsSectionLabel {
font-size: var(--jp-ui-font-size2);
font-weight: normal;
color: var(--jp-ui-font-color1);
margin-bottom: 5%;
}
.settingsSectionButton {
display:inline-block;
height: 36px;
width: 13em;
margin:0.1em;
padding: 0.2em 1.45em;
border:0.05em solid #CCCCCC;
box-sizing: border-box;
text-decoration:none;
font-size: 16px;
font-weight: lighter;
color:#000000;
background-color:#CCCCCC;
text-align:center;
position:relative;
}
.settingsSectionButton:hover{
border-color:#7a7a7a;
}
.settingsSectionButton:active{
background-color:#999999;
}
.container {
height: 64px;
position: relative;
margin-top: 1em;
}
.center {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.settingsSectionUpdateButton {
}
div.fieldSetData {
display:grid;
grid-template-columns: 50% 50%;
grid-gap:5px;
}
div.fieldSetData label { text-align:right; }
div.fieldSetData label:after { content: ":"; }

View File

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

View File

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

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="256px" height="256px" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>settings</title>
<g id="settings" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<rect id="Rectangle" fill="#424242" x="15" y="18" width="225" height="220"></rect>
<path d="M116.854147,65.1962028 L125.954036,77.5895858 L128.098262,77.5895858 L137.198151,65.2223492 C139.271789,62.3318774 143.062502,61.2489295 146.350338,62.6077114 L161.019987,68.6475247 C164.3054,69.9974845 166.232064,73.4283204 165.674527,76.9359264 L163.347257,92.1008255 L164.890054,93.6434618 L180.056536,91.3164341 C183.564507,90.7589555 186.995701,92.6854186 188.345802,95.9704894 L194.412395,110.638607 C195.781546,113.925512 194.69663,117.722321 191.797484,119.789839 L179.428957,128.888779 L179.428957,131.032782 L191.797484,140.131721 C194.69663,142.19924 195.781546,145.996049 194.412395,149.282954 L188.345802,163.951071 C186.995701,167.236142 183.564507,169.162605 180.056536,168.605127 L164.890054,166.278099 L163.347257,167.820735 L165.674527,182.985634 C166.232064,186.49324 164.3054,189.924076 161.019987,191.274036 L146.350338,197.339996 C145.417331,197.741826 144.411352,197.946561 143.395489,197.941363 C140.941263,197.943952 138.635386,196.766813 137.198151,194.777651 L128.098262,182.410414 L125.954036,182.410414 L116.854147,194.803797 C114.78051,197.694269 110.989797,198.777217 107.70196,197.418435 L93.0323116,191.274036 C89.7468981,189.924076 87.820234,186.49324 88.3777708,182.985634 L90.7050412,167.820735 L89.162244,166.278099 L73.9957627,168.605127 C70.4877907,169.162605 67.0565969,167.236142 65.7064962,163.951071 L59.6399036,149.282954 C58.2707526,145.996049 59.3556682,142.19924 62.2548142,140.131721 L74.6233412,131.032782 L74.6233412,128.888779 L62.202516,119.789839 C59.30337,117.722321 58.2184544,113.925512 59.5876054,110.638607 L65.7064962,95.9704894 C67.0565969,92.6854186 70.4877907,90.7589555 73.9957627,91.3164341 L89.162244,93.6434618 L90.7050412,92.1008255 L88.3777708,76.9359264 C87.820234,73.4283204 89.7468981,69.9974845 93.0323116,68.6475247 L107.70196,62.581565 C110.989797,61.2227831 114.78051,62.305731 116.854147,65.1962028 Z M146.005273,68.5526316 L136.754354,81.1675213 C135.213998,83.2232711 132.818559,84.4622913 130.250677,84.5314919 L124.92439,84.5314919 C122.295546,84.5251197 119.82745,83.2650372 118.280549,81.1394882 L109.029629,68.5526316 L97.4239309,73.2902235 L99.8067434,88.7364551 C100.207815,91.3618086 99.3452187,94.022347 97.4799971,95.9129257 L93.8076625,99.5852603 C91.936076,101.424973 89.3129567,102.285522 86.7152912,101.912007 L71.1849603,99.5572272 L66.4473684,110.994727 L79.034225,120.245646 C81.159774,121.792548 82.4198565,124.260644 82.4262287,126.889488 L82.4262287,132.35594 C82.4198565,134.984785 81.159774,137.45288 79.034225,138.999782 L66.4473684,148.250701 L71.1849603,159.716235 L86.631192,157.333422 C89.231168,156.932646 91.8662632,157.797124 93.7235633,159.660168 L97.4799971,163.192337 C99.3430411,165.049638 100.207519,167.684733 99.8067434,170.284709 L97.3398317,185.81504 L108.805365,190.552632 L118.056284,177.965775 C119.603186,175.840226 122.071281,174.580143 124.700126,174.573771 L130.250677,174.573771 C132.868127,174.600046 135.324102,175.843578 136.894519,177.937742 L146.145438,190.552632 L157.610971,185.81504 L155.228159,170.368808 C154.783184,167.770558 155.582229,165.113994 157.386707,163.192337 L161.087074,159.520003 C162.958661,157.68029 165.58178,156.819741 168.179446,157.193257 L183.625677,159.576069 L188.363269,148.110536 L175.776413,138.859617 C173.721926,137.324487 172.499172,134.920429 172.468508,132.35594 L172.468508,127.029654 C172.47488,124.400809 173.734963,121.932714 175.860512,120.385812 L188.447368,111.134893 L183.709777,99.5572272 L168.263545,101.912007 C165.638191,102.313078 162.977653,101.450482 161.087074,99.5852603 L157.41474,95.9129257 C155.575027,94.0413392 154.714478,91.4182198 155.087993,88.8205544 L157.470806,73.3743228 L146.005273,68.5526316 Z" id="Combined-Shape" fill="#FFFFFF" fill-rule="nonzero"></path>
<path d="M127.5,106 C114.521308,106 104,116.521308 104,129.5 C104,142.478692 114.521308,153 127.5,153 C140.478692,153 151,142.478692 151,129.5 C151,123.267412 148.524114,117.290096 144.117009,112.882991 C139.709904,108.475886 133.732588,106 127.5,106 Z" id="Path" stroke="#FFFFFF" stroke-width="10" fill-rule="nonzero"></path>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 4.4 KiB

View File

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

View File

@@ -1,91 +0,0 @@
# Test
The test will produce a video to help debugging and check what happened.
To execute integration tests, you have two options:
- use docker-compose (cons: needs to know and use docker) - this is a more reliable solution.
- run tests locally (cons: will interact with your JupyterLab user settings)
## Test locally
1. Compile the extension:
```
jlpm install
jlpm run build:prod
```
2. Start JupyterLab _with the extension installed_ without any token or password
```
jupyter lab --ServerApp.token= --ServerApp.password=
```
3. Execute in another console the [Playwright](https://playwright.dev/docs/intro) tests:
```
cd ui-tests
jlpm install
npx playwright install
npx playwright test
```
# Create tests
To create tests, the easiest way is to use the code generator tool of playwright:
1. Compile the extension:
```
jlpm install
jlpm run build:prod
```
2. Start JupyterLab _with the extension installed_ without any token or password:
**Using local installation**
```
jupyter lab --ServerApp.token= --ServerApp.password=
```
3. Launch the code generator tool:
```
cd ui-tests
jlpm install
npx playwright install
npx playwright codegen localhost:8888
```
# Debug tests
To debug tests, a good way is to use the inspector tool of playwright:
1. Compile the extension:
```
jlpm install
jlpm run build:prod
```
Note: When compiling the extension execute the commands in the extension root (`gst-settings`) folder and not the `gst-settings/ui-tests` folder.
2. Start JupyterLab _with the extension installed_ without any token or password:
**Using local installation**
```
jupyter lab --ServerApp.token= --ServerApp.password=
```
3. Launch the code generator tool:
```
cd ui-tests
jlpm install
npx playwright install
PWDEBUG=1 npx playwright test
```

View File

@@ -1,13 +0,0 @@
{
"name": "@gamestonk/settings-tests",
"version": "0.1.0",
"description": "Integration test for the gamestong Settings extension",
"repository": "https://github.com/OpenBB-finance/OpenBBTerminal",
"author": "OpenBB Terminal Contributors",
"license": "MIT",
"private": true,
"devDependencies": {
"@playwright/test": "1.16",
"typescript": "~4.1.3"
}
}

View File

@@ -1,18 +0,0 @@
import { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
timeout: 60000,
use: {
// Browser options
// headless: false,
// slowMo: 500,
// Context options
viewport: { width: 1280, height: 720 },
// Artifacts
video: 'on',
},
};
export default config;

View File

@@ -1,77 +0,0 @@
/*
* E2E scenario for testing the Settings menu UI
*
* Steps:
* - Load the extension
* - Set a feature flag and save
* - Restore settings menu values from user settings
* - Unset the feature flag
*/
import { test, expect } from '@playwright/test';
const TARGET_URL = process.env.TARGET_URL ?? 'http://localhost:8888';
test('Test loading of the settings menu', async ({ page }) => {
// Open lab
await page.goto(`${TARGET_URL}/lab`);
await page.waitForSelector('#jupyterlab-splash', { state: 'detached' });
await page.waitForSelector('div[role="main"] >> text=Launcher');
// Click the Settings button in the Launcher panel
await page.click('text=settingsSettings >> div');
// Verify that the extension panel is visible on the same page
expect(page.url()).toBe('http://localhost:8888/lab');
expect(page.isVisible('#gamestonkSettings')).toBeTruthy();
// Click the "Clear.after.command" feature flag's checkbox
await page.check('#featureFlags > div.fieldSetData > input.Clear.after.command');
// Click "Update Flags" text and catch the dialog message
page.once('dialog', dialog => {
console.log(`Dialog message: ${dialog.message()}`);
dialog.dismiss().catch(() => {});
});
await page.click('text=Update Flags');
// Check the "Clear.after.command" feature flag's checkbox is checked
expect(await page.isChecked('#featureFlags > div.fieldSetData > input.Clear.after.command')).toBeTruthy();
// Reload the page
await page.goto(`${TARGET_URL}/lab`);
await page.waitForSelector('#jupyterlab-splash', { state: 'detached' });
await page.waitForSelector('div[role="main"] >> text=Launcher');
// Click the settings button in the Launcher panel
await page.click('text=settingsSettings >> div');
expect(page.url()).toBe('http://localhost:8888/lab');
// Check the "Clear.after.command" feature flag's checkbox is checked (populated from the user settings)
expect(await page.isChecked('#featureFlags > div.fieldSetData > input.Clear.after.command')).toBeTruthy();
// Uncheck the "Clear.after.command" feature flag's checkbox
await page.uncheck('#featureFlags > div.fieldSetData > input.Clear.after.command');
// Click "Update Flags" text and catch the dialog message
page.once('dialog', dialog => {
console.log(`Dialog message: ${dialog.message()}`);
dialog.dismiss().catch(() => {});
});
await page.click('text=Update Flags');
// Check the "Clear.after.command" feature flag's checkbox is not checked (user settings changed)
expect(await page.isChecked('#featureFlags > div.fieldSetData > input.Clear.after.command')).toBeFalsy();
// Reload the page
await page.goto(`${TARGET_URL}/lab`);
await page.waitForSelector('#jupyterlab-splash', { state: 'detached' });
await page.waitForSelector('div[role="main"] >> text=Launcher');
// Click the settings button in the Launcher panel
await page.click('text=settingsSettings >> div');
expect(page.url()).toBe('http://localhost:8888/lab');
// Check the "Clear.after.command" feature flag's checkbox is not checked (populated from the user settings)
expect(await page.isChecked('#featureFlags > div.fieldSetData > input.Clear.after.command')).toBeFalsy();
});

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -1,53 +0,0 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jsdoc/recommended',
'plugin:prettier/recommended',
'plugin:react/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'jsdoc'],
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',
'double',
{ avoidEscape: true, allowTemplateLiterals: false },
],
curly: ['error', 'all'],
eqeqeq: 'error',
'jsdoc/require-param-type': 'off',
'jsdoc/require-property-type': 'off',
'jsdoc/require-returns-type': 'off',
'jsdoc/no-types': 'warn',
'prefer-arrow-callback': 'error',
},
settings: {
jsdoc: {
mode: 'typescript',
},
react: {
version: 'detect',
},
},
};

View File

@@ -1,22 +0,0 @@
include LICENSE
include README.md
include pyproject.toml
include jupyter-config/openbb_terminal_launcher.json
include package.json
include ts*.json
graft openbb_terminal_launcher/labextension
# Javascript files
graft src
graft style
prune **/node_modules
prune lib
# Patterns to exclude from any directory
global-exclude *~
global-exclude *.pyc
global-exclude *.pyo
global-exclude .git
global-exclude .ipynb_checkpoints

View File

@@ -1,17 +0,0 @@
# OpenBB Terminal Launcher
This extensions adds a button into the OpenBB Terminal category of the Jupyter Lab launcher panel.
## Install, Use and Develop
```bash
pip install -e .
jlpm
jlpm run build:prod
jupyter labextension install .
# Rebuild Typescript source after making changes
jlpm build
# Rebuild JupyterLab after making any changes
jupyter lab build
```

View File

@@ -1,3 +0,0 @@
# Making a new release of gamestonk-settings
Check out the [workflow documentation](https://github.com/jupyter-server/jupyter_releaser#typical-workflow) for information.

View File

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

View File

@@ -1,13 +0,0 @@
import json
import os.path as osp
from ._version import __version__ # noqa: F401
HERE = osp.abspath(osp.dirname(__file__))
with open(osp.join(HERE, "labextension", "package.json")) as fid:
data = json.load(fid)
def _jupyter_labextension_paths():
return [{"src": "labextension", "dest": data["name"]}]

View File

@@ -1,2 +0,0 @@
version_info = (0, 1, 0)
__version__ = ".".join(map(str, version_info))

View File

@@ -1,95 +0,0 @@
{
"name": "@gamestonk/terminal",
"version": "0.1.0",
"description": "Gamestonk terminal launcher",
"keywords": [
"jupyter",
"jupyterlab",
"jupyterlab-extension"
],
"homepage": "https://github.com/OpenBB-finance/OpenBBTerminal",
"bugs": {
"url": "https://github.com/OpenBB-finance/OpenBBTerminal/issues"
},
"license": "MIT",
"author": {
"name": "Gamestonk Contributors",
"email": "dro.lopes@campus.fct.unl.pt"
},
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
"style/index.js"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"style": "style/index.css",
"repository": {
"type": "git",
"url": "https://github.com/OpenBB-finance/OpenBBTerminal.git"
},
"scripts": {
"build": "jlpm run build:lib && jlpm run build:labextension:dev",
"build:all": "jlpm run build:lib && jlpm run build:labextension",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
"build:lib": "tsc",
"build:prod": "jlpm run clean && jlpm run build:lib && jlpm run build:labextension",
"clean": "jlpm run clean:lib",
"clean:all": "jlpm run clean:lib && jlpm run clean:labextension",
"clean:labextension": "rimraf openbb_terminal_launcher/labextension",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"eslint": "eslint . --ext .ts,.tsx --fix",
"eslint:check": "eslint . --ext .ts,.tsx",
"install:extension": "jlpm run build",
"prepare": "jlpm run clean && jlpm run build:prod",
"watch": "run-p watch:src watch:labextension",
"watch:labextension": "jupyter labextension watch .",
"watch:src": "tsc -w"
},
"dependencies": {
"@jupyterlab/application": "^3.2.8",
"@jupyterlab/apputils": "^3.2.8",
"@jupyterlab/filebrowser": "^3.2.8",
"@jupyterlab/launcher": "^3.2.8",
"@jupyterlab/mainmenu": "^3.2.8",
"@jupyterlab/running": "^3.2.8",
"@jupyterlab/services": "^6.2.8",
"@jupyterlab/settingregistry": "^3.2.8",
"@jupyterlab/terminal": "^3.2.8",
"@jupyterlab/translation": "^3.2.8",
"@jupyterlab/ui-components": "^3.2.8",
"@lumino/algorithm": "^1.9.1",
"marked": "^4.0.10"
},
"devDependencies": {
"@jupyterlab/builder": "^3.2.8",
"@typescript-eslint/eslint-plugin": "^5.10.0",
"@typescript-eslint/parser": "^5.10.0",
"eslint": "^8.7.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-jsdoc": "^37.6.3",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.28.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
"typescript": "<4.4"
},
"resolutions": {
"json-schema": "^0.4.0",
"marked": "^4.0.10",
"got": "^11.8.5",
"jpeg-js": "^0.4.4"
},
"sideEffects": [
"style/*.css",
"style/*.svg",
"style/index.js"
],
"jupyterlab": {
"extension": true,
"outputDir": "openbb_terminal_launcher/labextension"
},
"styleModule": "style/index.js"
}

View File

@@ -1,17 +0,0 @@
[build-system]
requires = ["jupyter_packaging~=0.10,<2", "jupyterlab~=3.1"]
build-backend = "jupyter_packaging.build_api"
[tool.jupyter-packaging.options]
skip-if-exists = ["openbb_terminal_launcher/labextension/static/style.js"]
ensured-targets = ["openbb_terminal_launcher/labextension/static/style.js", "openbb_terminal_launcher/labextension/package.json"]
[tool.jupyter-packaging.builder]
factory = "jupyter_packaging.npm_builder"
[tool.jupyter-packaging.build-args]
build_cmd = "build:prod"
npm = ["jlpm"]
[tool.check-manifest]
ignore = ["openbb_terminal_launcher/labextension/**", "yarn.lock", ".*", "package-lock.json"]

View File

@@ -1,84 +0,0 @@
"""
openbb_terminal_launcher setup
"""
import json
import sys
from pathlib import Path
import setuptools
HERE = Path(__file__).parent.resolve()
# The name of the project
name = "openbb_terminal_launcher"
lab_path = HERE / name.replace("-", "_") / "labextension"
# Representative files that should exist after a successful build
ensured_targets = [str(lab_path / "package.json"), str(lab_path / "static/style.js")]
labext_name = "@gamestonk/terminal_launcher"
data_files_spec = [
(
"share/jupyter/labextensions/%s" % labext_name,
str(lab_path.relative_to(HERE)),
"**",
),
("share/jupyter/labextensions/%s" % labext_name, ".", "install.json"),
]
long_description = (HERE / "README.md").read_text()
# Get the package info from package.json
pkg_json = json.loads((HERE / "package.json").read_bytes())
setup_args = dict(
name=name,
version=pkg_json["version"],
url=pkg_json["homepage"],
author=pkg_json["author"]["name"],
author_email=pkg_json["author"]["email"],
description=pkg_json["description"],
license=pkg_json["license"],
long_description=long_description,
long_description_content_type="text/markdown",
packages=setuptools.find_packages(),
install_requires=[],
zip_safe=False,
include_package_data=True,
python_requires=">=3.6",
platforms="Linux, Mac OS X, Windows",
keywords=["Jupyter", "JupyterLab", "JupyterLab3"],
classifiers=[
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Framework :: Jupyter",
],
)
try:
from jupyter_packaging import get_data_files, npm_builder, wrap_installers
post_develop = npm_builder(
build_cmd="install:extension", source_dir="src", build_dir=lab_path
)
setup_args["cmdclass"] = wrap_installers(
post_develop=post_develop, ensured_targets=ensured_targets
)
setup_args["data_files"] = get_data_files(data_files_spec)
except ImportError as e:
import logging
logging.basicConfig(format="%(levelname)s: %(message)s")
logging.warning(
"Build tool `jupyter-packaging` is missing. Install it with pip or conda."
)
if not ("--name" in sys.argv or "--version" in sys.argv):
raise e
if __name__ == "__main__":
setuptools.setup(**setup_args)

View File

@@ -1,170 +0,0 @@
import {
JupyterFrontEnd,
JupyterFrontEndPlugin,
} from "@jupyterlab/application";
import { ICommandPalette } from "@jupyterlab/apputils";
import { ILauncher } from "@jupyterlab/launcher";
import { IMainMenu } from "@jupyterlab/mainmenu";
import { ISettingRegistry } from "@jupyterlab/settingregistry";
import { LabIcon } from "@jupyterlab/ui-components";
import { TerminalManager } from "@jupyterlab/services";
import { Terminal } from "@jupyterlab/terminal";
import appStr from "../style/terminal.svg";
import { ITerminalSettingsInterface } from "./interfaces";
const CATEGORY = "OpenBB Terminal";
/**
* The command IDs used by the OpenBB Terminal Launcher plugin.
*/
namespace CommandIDs {
export const create = "gamestonk:terminal";
}
/**
* Get the section settings values.
*
* The section settings are taken from the user space (`s.user` if section keys
* exist there) or from the default values of the settings schema.
*
* @param section.section
* @param section The section name
* @param section.s
* @returns The state of the section settings.
*/
function getSettingsAsArray({ s }: { s: any }): any {
const values: Array<Record<string, unknown>> = [];
for (const section of ["APP_SETTINGS", "FEATURE_FLAGS", "API_KEYS"]) {
Object.keys(s.schema.properties[section].default).forEach(
(element: string) => {
const settingsValue =
typeof s.user[section] === "undefined"
? s.schema.properties[section].default[element]
: s.user[section][element];
values.push({
key: element,
value: settingsValue,
});
}
);
}
return values;
}
/**
* Initialization data for the OpenBB Terminal Launcher extension.
*/
const extension: JupyterFrontEndPlugin<void> = {
id: "gamestonk:terminal",
autoStart: true,
optional: [ILauncher, IMainMenu, ICommandPalette, ISettingRegistry],
activate: async (
app: JupyterFrontEnd,
launcher: ILauncher | null,
menu: IMainMenu | null,
palette: ICommandPalette | null,
settings: ISettingRegistry
) => {
const { commands } = app;
const command = CommandIDs.create;
const icon = new LabIcon({
name: "gamestonk:terminal",
svgstr: appStr,
});
const s = await settings.load("@gamestonk/settings:settings");
commands.addCommand(command, {
label: (args) =>
args["isPalette"] ? "New OpenBB Terminal" : "OpenBB Terminal",
caption: "New OpenBB Terminal",
icon: (args) => (args["isPalette"] ? null : icon),
execute: async () => {
const appSettings = getSettingsAsArray({ s: s });
let settingsAsBashVariablesString = "";
for (const appSetting of appSettings) {
settingsAsBashVariablesString = `${settingsAsBashVariablesString} && export ${
appSetting.key
}=${
appSetting.value.value === ""
? appSetting.value.default
: appSetting.value.value
}`;
}
const manager = new TerminalManager();
const session = await manager.startNew();
const terminal = new Terminal(session, { theme: "dark" });
terminal.title.closable = true;
session.send({
type: "stdin",
content: ["clear\n"],
});
await new Promise((f) => setTimeout(f, 1000));
session.send({
type: "stdin",
content: [`clear${settingsAsBashVariablesString}\nclear\n`],
});
const pythonBinarySetting: ITerminalSettingsInterface = appSettings.find(
(i: ITerminalSettingsInterface) => i.key === "PYTHON_BINARY"
);
const terminalPath: ITerminalSettingsInterface = appSettings.find(
(i: ITerminalSettingsInterface) => i.key === "TERMINAL_PATH"
);
const launchCommand = `${
pythonBinarySetting.value.value === ""
? pythonBinarySetting.value.default
: pythonBinarySetting.value.value
} ${
terminalPath.value.value === ""
? terminalPath.value.default
: terminalPath.value.value
}\n`;
session.send({
type: "stdin",
content: [launchCommand],
});
return terminal;
},
});
if (launcher) {
launcher.add({
command,
category: CATEGORY,
rank: 2,
});
}
// Add the command to the palette
if (palette) {
palette.addItem({
command,
args: { isPalette: true },
category: CATEGORY,
});
}
// Add the command to the menu
if (menu) {
menu.fileMenu.newMenu.addGroup([{ command }], 30);
}
console.log("Added OpenBB Terminal Launcher Exstension.");
},
};
export default extension;

View File

@@ -1,13 +0,0 @@
interface ITerminalSettingsObject {
default?: string | number;
description?: string;
form?: string;
title?: string;
type?: string;
value?: string;
}
export interface ITerminalSettingsInterface {
key: string;
value: ITerminalSettingsObject;
}

View File

@@ -1,4 +0,0 @@
declare module '*.svg' {
const value: string;
export default value;
}

View File

@@ -1,16 +0,0 @@
.jp-example-view {
background-color: AliceBlue;
}
.jp-example-button {
background-color: red;
border-radius: 12px;
border: none;
color: white;
padding: 15px 32px;
margin: 30px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}

View File

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

View File

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

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 23 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -1,24 +0,0 @@
{
"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": false,
"target": "es2017",
"types": []
},
"include": ["src/*"]
}

View File

@@ -1,92 +0,0 @@
# Test
The test will produce a video to help debugging and check what happened.
To execute integration tests, you have two options:
- use docker-compose (cons: needs to know and use docker) - this is a more reliable solution.
- run tests locally (cons: will interact with your JupyterLab user settings)
## Test locally
1. Compile the extension:
```
jlpm install
jlpm run build:prod
```
2. Start JupyterLab _with the extension installed_ without any token or password
```
jupyter lab --ServerApp.token= --ServerApp.password=
```
3. Execute in another console the [Playwright](https://playwright.dev/docs/intro) tests:
```
cd ui-tests
jlpm install
npx playwright install
npx playwright test
```
# Create tests
To create tests, the easiest way is to use the code generator tool of playwright:
1. Compile the extension:
```
jlpm install
jlpm run build:prod
```
2. Start JupyterLab _with the extension installed_ without any token or password:
**Using local installation**
```
jupyter lab --ServerApp.token= --ServerApp.password=
```
3. Launch the code generator tool:
```
cd ui-tests
jlpm install
npx playwright install
npx playwright codegen localhost:8888
```
# Debug tests
To debug tests, a good way is to use the inspector tool of playwright:
1. Compile the extension:
```
jlpm install
jlpm run build:prod
```
Note: When compiling the extension execute the commands in the extension root (`gst`) folder and not the `gst/ui-tests` folder.
2. Start JupyterLab _with the extension installed_ without any token or password:
**Using local installation**
```
jupyter lab --ServerApp.token= --ServerApp.password=
```
3. Launch the code generator tool:
```
cd ui-tests
jlpm install
npx playwright install
PWDEBUG=1 npx playwright test --headed
```

View File

@@ -1,13 +0,0 @@
{
"name": "@gamestonk/launcher-tests",
"version": "0.1.0",
"description": "Integration test for terminal launcher",
"repository": "https://github.com/OpenBB-finance/OpenBBTerminal",
"author": "OpenBB Terminal Contributors",
"license": "MIT",
"private": true,
"devDependencies": {
"@playwright/test": "1.16",
"typescript": "~4.1.3"
}
}

View File

@@ -1,18 +0,0 @@
import { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
timeout: 60000,
use: {
// Browser options
// headless: false,
// slowMo: 500,
// Context options
viewport: { width: 1280, height: 720 },
// Artifacts
video: 'on',
},
};
export default config;

View File

@@ -1,37 +0,0 @@
/*
* Simple scenario placeholder for testing the Gamestonk Launcher
*
* Steps:
* - Wait for the launcher panel to load
* - Launch the terminal
* - Wait for the terminal to initialize
* - Press "return" three times
*
* This is a placeholder for the test.
* Depending on the future testing/QA decisions this test can be expanded.
*/
import { test, expect } from '@playwright/test';
const TARGET_URL = process.env.TARGET_URL ?? 'http://localhost:8888';
test('Should open a panel with the OpenBBTerminal and send "Enter" three times', async ({ page }) => {
await page.goto(`${TARGET_URL}/lab`);
await page.waitForSelector('#jupyterlab-splash', { state: 'detached' });
await page.waitForSelector('div[role="main"] >> text=Launcher');
await Promise.all([
page.waitForNavigation(/*{ url: 'http://localhost:8888/lab' }*/),
page.click('p:has-text("OpenBB Terminal")')
]);
expect(
await page.waitForSelector('[aria-label="Terminal input"]', { timeout: 1000 })
).toBeTruthy();
// Press Enter a couple of times
await page.waitForTimeout(3000)
await page.press('[aria-label="Terminal input"]', 'Enter');
await page.press('[aria-label="Terminal input"]', 'Enter');
await page.press('[aria-label="Terminal input"]', 'Enter');
await page.waitForTimeout(1000)
});

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff