Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reoganize the project to split typescript packages and extensions #78

Merged
merged 11 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ jobs:
- name: Package extension
run: |
set -eux
pip install build packages/jupyterlab-${{ matrix.extension }}-chat
python -m build packages/jupyterlab-${{ matrix.extension }}-chat
pip install build python/jupyterlab-${{ matrix.extension }}-chat
python -m build python/jupyterlab-${{ matrix.extension }}-chat
pip uninstall -y "jupyterlab_${{ matrix.extension }}_chat" jupyterlab

- name: Upload package
uses: actions/upload-artifact@v3
with:
name: jupyterlab_${{ matrix.extension }}_chat-artifacts
path: packages/jupyterlab-${{ matrix.extension }}-chat/dist/jupyterlab_${{ matrix.extension }}_chat*
path: python/jupyterlab-${{ matrix.extension }}-chat/dist/jupyterlab_${{ matrix.extension }}_chat*
if-no-files-found: error

integration-tests:
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
python -m pip install "jupyterlab>=4.0.0,<5" jupyterlab_${{ matrix.extension }}_chat*.whl

- name: Install dependencies
working-directory: packages/jupyterlab-${{ matrix.extension }}-chat/ui-tests
working-directory: python/jupyterlab-${{ matrix.extension }}-chat/ui-tests
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: 0
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
Expand All @@ -120,10 +120,10 @@ jobs:

- name: Install browser
run: jlpm playwright install chromium
working-directory: packages/jupyterlab-${{ matrix.extension }}-chat/ui-tests
working-directory: python/jupyterlab-${{ matrix.extension }}-chat/ui-tests

- name: Execute integration tests
working-directory: packages/jupyterlab-${{ matrix.extension }}-chat/ui-tests
working-directory: python/jupyterlab-${{ matrix.extension }}-chat/ui-tests
run: |
jlpm playwright test --retries=2

Expand All @@ -133,8 +133,8 @@ jobs:
with:
name: jupyterlab_${{ matrix.extension }}_chat-playwright-tests
path: |
packages/jupyterlab-${{ matrix.extension }}-chat/ui-tests/test-results
packages/jupyterlab-${{ matrix.extension }}-chat/ui-tests/playwright-report
python/jupyterlab-${{ matrix.extension }}-chat/ui-tests/test-results
python/jupyterlab-${{ matrix.extension }}-chat/ui-tests/playwright-report

check_links:
name: Check Links
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Playwright knows how to start JupyterLab server
start_server_script: 'null'
test_folder: packages/jupyterlab-ws-chat/ui-tests
test_folder: python/jupyterlab-ws-chat/ui-tests

- uses: jupyterlab/maintainer-tools/.github/actions/update-snapshots@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Playwright knows how to start JupyterLab server
start_server_script: 'null'
test_folder: packages/jupyterlab-collaborative-chat/ui-tests
test_folder: python/jupyterlab-collaborative-chat/ui-tests
13 changes: 9 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@ node_modules/
*.egg-info/
.ipynb_checkpoints
*.tsbuildinfo
jupyter_chat/labextension
.jupyter_ystore.db
labextension

# Version file is handled by hatchling
jupyter_chat/_version.py
python/**/_version.py

# jest test reports
packages/jupyter-chat/junit.xml
packages/jupyterlab-collaborative-chat/junit.xml

# Integration tests
ui-tests/test-results/
ui-tests/playwright-report/
python/jupyterlab-collaborative-chat/ui-tests/test-results/
python/jupyterlab-collaborative-chat/ui-tests/playwright-report/

# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python
Expand Down
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,36 @@ Many components of this chat project come from [jupyter-ai](https://github.com/j

### Typescript package

#### @jupyter/chat

The typescript package is located in *packages/jupyter-chat* and builds an NPM
package named `@jupyter/chat`.

This package provides a frontend library (using react), and is intended to be
used by a jupyterlab extension to create a chat.

#### jupyterlab-collaborative-chat

The typescript package is located in *packages/jupyterlab-collaborative-chat* and
builds an NPM package named `jupyterlab-collaborative-chat`.

This package relies on `@jupyter/chat` and provides a typescript library.
It is intended to be used by a jupyterlab extension to create a collaborative chat.

### Jupyterlab extensions

#### Chat extension based on shared document: *packages/jupyterlab-collaborative-chat*
#### Chat extension based on shared document: *python/jupyterlab-collaborative-chat*

This extension is an implementation of the `@jupyter/chat` package, relying on
shared document (see [jupyter_ydoc](https://github.com/jupyter-server/jupyter_ydoc)).
This extension is an implementation of the `jupyter-collaborative-chat` 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`.
- a NPM package named `jupyterlab-collaborative-chat-extension`.

#### Chat extension based on websocket: *packages/jupyterlab-ws-chat*
#### Chat extension based on websocket: *python/jupyterlab-ws-chat*

This extension is an implementation of the `@jupyter/chat` package, relying on
websocket for the communication between server and front end.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The following commands install the extension in development mode:
./scripts/install.sh collaborative

# Symlink the assets
jupyter labextension develop --overwrite packages/jupyterlab-collaborative-chat
jupyter labextension develop --overwrite python/jupyterlab-collaborative-chat
```

To uninstall it, run:
Expand All @@ -44,27 +44,27 @@ jlpm build:collaborative

### Unit tests

There are a few unit tests in *packages/jupyterlab-collaborative-chat/src/\_\_tests\_\_*.
There are a few unit tests in *python/jupyterlab-collaborative-chat/src/\_\_tests\_\_*.

They make use of [jest](https://jestjs.io/).

The following commands run them:

```bash
cd ./packages/jupyterlab-collaborative-chat
cd ./python/jupyterlab-collaborative-chat
jlpm test
```

### Integration tests

The integration tests are located in *packages/jupyterlab-collaborative-chat/ui-tests*.
The integration tests are located in *python/jupyterlab-collaborative-chat/ui-tests*.

They make use of [playwright](https://playwright.dev/).

The following commands run them:

```bash
cd ./packages/jupyterlab-collaborative-chat/ui-tests
cd ./python/jupyterlab-collaborative-chat/ui-tests

# Install the tests dependencies
jlpm install
Expand Down
2 changes: 1 addition & 1 deletion docs/source/developers/contributing/jupyterlab-ws-chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The following commands install the extension in development mode:
./scripts/install.sh ws

# Symlink the assets
jupyter labextension develop --overwrite packages/jupyterlab-ws-chat
jupyter labextension develop --overwrite python/jupyterlab-ws-chat
```

To uninstall it, run:
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
"url": "https://github.com/jupyterlab/jupyter-chat.git"
},
"workspaces": [
"packages/*"
"packages/*",
"python/jupyterlab-collaborative-chat",
"python/jupyterlab-ws-chat"
],
"scripts": {
"build": "lerna run build --stream",
"build:core": "lerna run build --stream --scope \"@jupyter/chat\"",
"build:collaborative": "lerna run build --scope=jupyterlab-collaborative-chat --include-filtered-dependencies",
"build:ws": "lerna run build --scope=jupyterlab-ws-chat --include-filtered-dependencies",
"build:collaborative": "lerna run build --scope=jupyterlab-collaborative-chat-extension --include-filtered-dependencies",
"build:ws": "lerna run build --scope=jupyterlab-ws-chat-extension --include-filtered-dependencies",
"build:prod": "lerna run build:prod --stream",
"clean": "lerna run clean",
"clean:all": "lerna run clean:all",
Expand Down
2 changes: 1 addition & 1 deletion packages/jupyter-chat/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
* Distributed under the terms of the Modified BSD License.
*/

module.exports = require('@jupyterlab/testutils/lib/babel.config');
module.exports = require('@jupyterlab/testing/lib/babel-config');
2 changes: 1 addition & 1 deletion packages/jupyter-chat/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Distributed under the terms of the Modified BSD License.
*/

const jestJupyterLab = require('@jupyterlab/testutils/lib/jest-config');
const jestJupyterLab = require('@jupyterlab/testing/lib/jest-config');

const esModules = [
'@codemirror',
Expand Down
15 changes: 1 addition & 14 deletions packages/jupyter-chat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@jupyterlab/testing": "^4.2.0",
"@types/jest": "^29.2.0",
"@types/json-schema": "^7.0.11",
"@types/react": "^18.2.0",
Expand Down Expand Up @@ -102,20 +103,6 @@
"publishConfig": {
"access": "public"
},
"jupyterlab": {
"discovery": {
"server": {
"managers": [
"pip"
],
"base": {
"name": "jupyter_chat"
}
}
},
"extension": false,
"schemaDir": "schema"
},
"eslintIgnore": [
"node_modules",
"dist",
Expand Down
125 changes: 0 additions & 125 deletions packages/jupyterlab-collaborative-chat/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion packages/jupyterlab-collaborative-chat/.yarnrc.yml

This file was deleted.

2 changes: 1 addition & 1 deletion packages/jupyterlab-collaborative-chat/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
* Distributed under the terms of the Modified BSD License.
*/

module.exports = require('@jupyterlab/testutils/lib/babel.config');
module.exports = require('@jupyterlab/testing/lib/babel-config');
2 changes: 1 addition & 1 deletion packages/jupyterlab-collaborative-chat/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Distributed under the terms of the Modified BSD License.
*/

const jestJupyterLab = require('@jupyterlab/testutils/lib/jest-config');
const jestJupyterLab = require('@jupyterlab/testing/lib/jest-config');

const esModules = [
'@codemirror',
Expand Down
Loading
Loading