Skip to content

Commit

Permalink
Monorepo improvements (#10)
Browse files Browse the repository at this point in the history
* Add minimal info in readme(s)

* The extension to install can be choosen in script

* Split the build github action per package

* Update build extension test

* Fix the environment variables

* Try to fix the environment variables

* Try to fix the environment variables... 2nd

* Try to fix the environment variables... 3rd

* Avoid using variables in workflow

* Specify the name of artifacts
  • Loading branch information
brichet authored Apr 8, 2024
1 parent 8965000 commit c9e24e5
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 38 deletions.
58 changes: 33 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions packages/jupyterlab-collaborative-chat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/jupyterlab-ws-chat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 12 additions & 5 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c9e24e5

Please sign in to comment.