Skip to content

Commit

Permalink
JupyterLab WIPP Plugin Creator 0.2.4 (#34)
Browse files Browse the repository at this point in the history
feat: Using an official WIPP JSON schema for everything other than UI key
feat: Autogenerate UI part of the schema based on the user-provided inputs and outputs
feat: Live validation of the user inputs (noisy, but will be fixed in 0.2.5)
feat: Ability to choose additional files for a new plugin from the Plugin Creator sidebar using file picker (previously only possible through context menu in the Jupyter file browser)
feat: Alerts confirming the creation of the plugin (previously only console.log output)
feat: Ability for user to choose the base image for their plugin Docker image
feat: Environment variables to turn off WIPP Plugin registration and Docker image builds in Argo (useful for testing)
feat: Checks for many user inputs on the backend

Co-authored-by: Konstantin Taletskiy <[email protected]>
  • Loading branch information
Wktx and ktaletsk authored Oct 29, 2021
1 parent 6b16520 commit 8b16afe
Show file tree
Hide file tree
Showing 9 changed files with 868 additions and 280 deletions.
61 changes: 50 additions & 11 deletions jupyterlab_wipp_plugin_creator/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# JupyterLab WIPP Plugin Creator extension

<!-- Create wipp plugin by containerizing local code in various languages, automate the Plugin generation and testing process using both static analysis and templates. -->
Enter your plugin information, select the code you wish to containerize, create WIPP plugin automatically.
Enter your plugin information. Select the code you wish to containerize. Create WIPP plugin automatically.

This extension is composed of a Python package named `jupyterlab_wipp_plugin_creator`
for the server extension and a NPM package named `jupyterlab_wipp_plugin_creator`
Expand All @@ -11,6 +10,8 @@ for the frontend extension.
## Requirements

* JupyterLab >= 3.0
* wipp-client
* kubernetes

## Install

Expand All @@ -21,10 +22,10 @@ pip install jupyterlab_wipp_plugin_creator
export WIPP_API_INTERNAL_URL="enter wipp api url"
export PLUGIN_TEMP_PATH="enter the path to temprorary plugins folder"
```
Note that all paths above should be absolute.
Note that all paths above should be absolute. Environment variables set using export commands will be lost if bash session is restarted, hence needed to be created by running the export commands again.

- `WIPP_API_INTERNAL_URL` is the internal URL of WIPP API (usually internal URL on Kubernetes cluster).
- `PLUGIN_TEMP_PATH` is the local path to WIPP's `temp/plugins` folder, where the source, manifest and build dependecies are copied to.
- `PLUGIN_TEMP_PATH` is the local path to WIPP's `temp/plugins` folder, where the source code is copied and plugin manifest and build dependecies are generated.

## Uninstall

Expand All @@ -51,20 +52,58 @@ the frontend extension, check the frontend extension is installed:
jupyter labextension list
```

If Jupyter Lab is not hosted on a Kubernetes environement, or local testing is desired, use this command to disable the Kubernetes Client to avoid error. Note: no image will be built or published but plugin.json, requirements.txt and Dockerfile will be generated in the folder set by environment variable PLUGIN_TEMP_PATH:

```bash
export WIPP_PLUGIN_CREATOR_DISABLE_BUILD=1
```

If the access to a running instance of WIPP is not possible, or local testing is desired, use this command to disable plugin registration in WIPP:

```bash
export WIPP_PLUGIN_CREATOR_DISABLE_REGISTER=1
```

To renable image build and plugin registration, you can set the variables to zero:

```bash
export WIPP_PLUGIN_CREATOR_DISABLE_BUILD=0
export WIPP_PLUGIN_CREATOR_DISABLE_REGISTER=0
```

Wh


## Contributing

### Architecture

Current features:
#### Current features:

- Right click on file 'Add to WIPP' to mark code to mark code for containerization.
- On click of 'Create Plugin' button, Post API request containing user input is sent over to the backend.
- Right click on file 'Add to WIPP' to select code for containerization.
- Filemanager to select multiple codes for containerization via Ctrl + Left Click.
- Session persistent frontend database to store paths to marked files using IStateDB.
- Create plugin.json, dockerfile, requirements.txt based on inputs.
- Register plugin automatically on WIPP CI https://wipp-ui.ci.aws.labshare.org/plugins.
- Create temp staging folder with random ID and copy selected codes inside.

- Live Validation of user inputs.
- On click of 'Create Plugin' button:
- Send post API request containing user input to the backend.
- Create plugin.json, dockerfile, requirements.txt based on inputs.
- Generate 'ui' keys for plugin.json based on 'input' keys.
- Register plugin on WIPP CI https://wipp-ui.ci.aws.labshare.org/plugins.
- Create temp staging folder with random ID and copy selected codes inside.
- Use Jinga2 template to generate Dockerfile, including pip install of requirements.txt.
- Submit Argo job via Kubernetes Client to build the image via a Kaniko container.
- Publish the image on PolusAI Dockerhub.

#### Known issues:

- As of 0.2.4, after selecting file to add to wipp plugin either through right click menu or file manager, user need to manually hit button "Update list of files" at the top in order for database to update.
- As of 0.2.4, UI key is automatically generated and will only contain "key" (name), "title", and "description". Hard-coding and more complex 'ui' keys with more fields such as "default" and "condition" are not supported.

#### Planned improvements:

- Support of Jupyter notebooks as a file source
- Support of multiple languages
- Static analysis of dependencies

### Development install

Expand Down
Loading

0 comments on commit 8b16afe

Please sign in to comment.