diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 37ab699..688e380 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,8 +11,9 @@ concurrency: cancel-in-progress: true jobs: - build: + build_jupyter-chat: runs-on: ubuntu-latest + name: Build jupyter_chat steps: - name: Checkout @@ -24,48 +25,55 @@ jobs: - name: Install dependencies run: python -m pip install -U "jupyterlab>=4.0.0,<5" - - name: Lint the extension + - name: Lint the packages run: | set -eux jlpm jlpm run lint:check + - name: Build the core package + run: jlpm build:core + - name: Test the packages run: | set -eux jlpm run test - - name: Build packages - run: jlpm build + build_extensions: + runs-on: ubuntu-latest + needs: build_jupyter-chat + strategy: + matrix: + extension: [collaborative, ws] + name: Build ${{ matrix.extension }} chat extension - - name: Package jupyterlab_ws_chat - working-directory: packages/jupyterlab-ws-chat - run: | - set -eux - pip install build - python -m build - pip uninstall -y "jupyterlab_ws_chat" jupyterlab + steps: + - name: Checkout + uses: actions/checkout@v3 - - name: Upload jupyterlab_ws_chat packages - uses: actions/upload-artifact@v3 - with: - name: package-artifacts - path: packages/jupyterlab-ws-chat/dist/jupyterlab_ws_chat* - if-no-files-found: error + - name: Base Setup + uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + + - name: Install dependencies + run: python -m pip install -U "jupyterlab>=4.0.0,<5" + + - name: Build package + run: | + jlpm install + jlpm build:${{ matrix.extension }} - - name: Package jupyterlab_collaborative_chat - working-directory: packages/jupyterlab-collaborative-chat + - name: Package extension run: | set -eux - pip install build - python -m build - pip uninstall -y "jupyterlab_collaborative_chat" jupyterlab + pip install build packages/jupyterlab-${{ matrix.extension }}-chat + python -m build packages/jupyterlab-${{ matrix.extension }}-chat + pip uninstall -y "jupyterlab_${{ matrix.extension }}_chat" jupyterlab - - name: Upload jupyterlab_collaborative_chat packages + - name: Upload package uses: actions/upload-artifact@v3 with: - name: package-artifacts - path: packages/jupyterlab-collaborative-chat/dist/jupyterlab_collaborative_chat* + name: jupyterlab_${{ matrix.extension }}_chat-artifacts + path: packages/jupyterlab-${{ matrix.extension }}-chat/dist/jupyterlab_${{ matrix.extension }}_chat* if-no-files-found: error check_links: diff --git a/README.md b/README.md index 21d7bee..2e53176 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ [![Github Actions Status](https://github.com/jupyterlab-contrib/jupyter-chat/workflows/Build/badge.svg)](https://github.com/jupyterlab-contrib/jupyter-chat/actions/workflows/build.yml) -A chat package for Jupyterlab extension, but also an extension for Jupyterab. +This project is a monorepo containing the frontend components and extensions to build +a chat in Jupyter. A lot of the components of this chat project come from [jupyter-ai](https://github.com/jupyterlab/jupyter-ai). @@ -15,18 +16,29 @@ The typescript package is located in *packages/jupyter-chat* and builds an NPM package named `chat-jupyter`. This package provides a frontend library (using react), and is intended to be -used by a jupyterlab extension. +used by a jupyterlab extension to create a chat. -### Jupyterab extension +### Jupyterlab extensions -The Jupyterlab extension is located in *packages/jupyterlab-ws-chat*. +#### Chat extension based on shared document: *packages/jupyterlab-collaborative-chat* -It is composed of a Python package named `jupyterlab_ws_chat` -for the server side and a NPM package named `jupyterlab-ws-chat`. +This extension is an implementation of the `chat-jupyter` package, relying on +shared document (see [jupyter_ydoc](https://github.com/jupyter-server/jupyter_ydoc)). + +It is composed of: + +- a Python package named `jupyterlab_collaborative_chat`, which register + the `YChat` shared document in jupyter_ydoc +- a NPM package named `jupyterlab-collaborative-chat`. + +#### Chat extension based on websocket: *packages/jupyterlab-ws-chat* This extension is an implementation of the `chat-jupyter` package, relying on websocket for the communication between server and front end. +It is composed of a Python package named `jupyterlab_ws_chat` +for the server side and a NPM package named `jupyterlab-ws-chat`. + ## Contributing See the contributing part of each package for details. diff --git a/package.json b/package.json index 467827b..765dd8a 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "build": "lerna run build --stream", "build:core": "lerna run build --stream --scope \"chat-jupyter\"", "build:collaborative": "lerna run build --scope=jupyterlab-collaborative-chat --include-filtered-dependencies", - "build:websocket": "lerna run build --scope=jupyterlab-ws-chat --include-filtered-dependencies", + "build:ws": "lerna run build --scope=jupyterlab-ws-chat --include-filtered-dependencies", "build:prod": "lerna run build:prod --stream", "clean": "lerna run clean", "clean:all": "lerna run clean:all", diff --git a/packages/jupyterlab-collaborative-chat/README.md b/packages/jupyterlab-collaborative-chat/README.md index 0d97d5a..81f5de2 100644 --- a/packages/jupyterlab-collaborative-chat/README.md +++ b/packages/jupyterlab-collaborative-chat/README.md @@ -7,6 +7,11 @@ This extension is composed of a Python package named `jupyterlab_collaborative_c for the server extension and a NPM package named `jupyterlab-collaborative-chat` for the frontend extension. +This extension registers a `YChat` shared document, and associate the document to a +chat widget in the front end. + +![screenshot](screenshot.gif 'collaborative chat extension') + ## Requirements - JupyterLab >= 4.0.0 diff --git a/packages/jupyterlab-collaborative-chat/screenshot.gif b/packages/jupyterlab-collaborative-chat/screenshot.gif new file mode 100644 index 0000000..182e476 Binary files /dev/null and b/packages/jupyterlab-collaborative-chat/screenshot.gif differ diff --git a/packages/jupyterlab-ws-chat/README.md b/packages/jupyterlab-ws-chat/README.md index a2adf6e..5bbb63c 100644 --- a/packages/jupyterlab-ws-chat/README.md +++ b/packages/jupyterlab-ws-chat/README.md @@ -7,7 +7,7 @@ A chat extension for Jupyterlab This package is composed of a Python package named `jupyterlab_ws_chat` for the server side and a NPM package named `jupyterlab-ws-chat` -![screenshot](screenshot.png 'chat extension') +![screenshot](screenshot.png 'WS chat extension') ## Requirements diff --git a/scripts/install.sh b/scripts/install.sh index d77333d..ffd0949 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -2,14 +2,21 @@ # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. +EXTENSION=$1 # install core packages pip install jupyterlab~=4.0 jlpm install -jlpm build -# install the collaborative chat extension -pip install -e packages/jupyterlab-collaborative-chat[test] +if [ -z "${EXTENSION}" ]; then + jlpm build + # install the collaborative chat extension + pip install -e packages/jupyterlab-collaborative-chat[test] -# install websocket chat extension -pip install -e packages/jupyterlab-ws-chat[test] + # install websocket chat extension + pip install -e packages/jupyterlab-ws-chat[test] +else + PACKAGE="jupyterlab-${EXTENSION}-chat" + jlpm build:${EXTENSION} + pip install -e packages/${PACKAGE}[test] +fi