diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc9bfed..e98107c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,83 +15,83 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - - 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: Lint the extension - run: | - set -eux - jlpm - jlpm run lint:check - - - name: Test the extension - run: | - set -eux - jlpm run test - - - name: Build the extension - run: | - set -eux - python -m pip install .[test] - - pytest -vv -r ap --cov jupyter_server_documents - jupyter server extension list - jupyter server extension list 2>&1 | grep -ie "jupyter_server_documents.*OK" - - jupyter labextension list - jupyter labextension list 2>&1 | grep -ie "@jupyter/server-documents.*OK" - python -m jupyterlab.browser_check - - - name: Package the extension - run: | - set -eux - - pip install build - python -m build - pip uninstall -y "jupyter_server_documents" jupyterlab - - - name: Upload extension packages - uses: actions/upload-artifact@v4 - with: - name: extension-artifacts - path: dist/jupyter_server_documents* - if-no-files-found: error + - name: Checkout + uses: actions/checkout@v4 + + - 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: Lint the extension + run: | + set -eux + jlpm + jlpm run lint:check + + - name: Test the extension + run: | + set -eux + jlpm run test + + - name: Build the extension + run: | + set -eux + python -m pip install .[test] + + pytest -vv -r ap --cov jupyter_server_documents + jupyter server extension list + jupyter server extension list 2>&1 | grep -ie "jupyter_server_documents.*OK" + + jupyter labextension list + jupyter labextension list 2>&1 | grep -ie "@jupyter-ai-contrib/server-documents.*OK" + python -m jupyterlab.browser_check + + - name: Package the extension + run: | + set -eux + + pip install build + python -m build + pip uninstall -y "jupyter_server_documents" jupyterlab + + - name: Upload extension packages + uses: actions/upload-artifact@v4 + with: + name: extension-artifacts + path: dist/jupyter_server_documents* + if-no-files-found: error test_isolated: needs: build runs-on: ubuntu-latest steps: - - name: Install Python - uses: actions/setup-python@v5 - with: - python-version: '3.10' - architecture: 'x64' - - uses: actions/download-artifact@v4 - with: - name: extension-artifacts - - name: Install and Test - run: | - set -eux - # Remove NodeJS, twice to take care of system and locally installed node versions. - sudo rm -rf $(which node) - sudo rm -rf $(which node) - - pip install "jupyterlab>=4.0.0,<5" jupyter_server_documents*.whl - - - jupyter server extension list - jupyter server extension list 2>&1 | grep -ie "jupyter_server_documents.*OK" - - jupyter labextension list - jupyter labextension list 2>&1 | grep -ie "@jupyter/server-documents.*OK" - python -m jupyterlab.browser_check --no-browser-test + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + architecture: 'x64' + - uses: actions/download-artifact@v4 + with: + name: extension-artifacts + - name: Install and Test + run: | + set -eux + # Remove NodeJS, twice to take care of system and locally installed node versions. + sudo rm -rf $(which node) + sudo rm -rf $(which node) + + pip install "jupyterlab>=4.0.0,<5" jupyter_server_documents*.whl + + + jupyter server extension list + jupyter server extension list 2>&1 | grep -ie "jupyter_server_documents.*OK" + + jupyter labextension list + jupyter labextension list 2>&1 | grep -ie "@jupyter-ai-contrib/server-documents.*OK" + python -m jupyterlab.browser_check --no-browser-test integration-tests: name: Integration tests @@ -102,53 +102,53 @@ jobs: PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Base Setup - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - - - name: Download extension package - uses: actions/download-artifact@v4 - with: - name: extension-artifacts - - - name: Install the extension - run: | - set -eux - python -m pip install "jupyterlab>=4.0.0,<5" jupyter_server_documents*.whl - - - name: Install dependencies - working-directory: ui-tests - env: - YARN_ENABLE_IMMUTABLE_INSTALLS: 0 - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - run: jlpm install - - - name: Set up browser cache - uses: actions/cache@v4 - with: - path: | - ${{ github.workspace }}/pw-browsers - key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }} - - - name: Install browser - run: jlpm playwright install chromium - working-directory: ui-tests - - - name: Execute integration tests - working-directory: ui-tests - run: | - jlpm playwright test - - - name: Upload Playwright Test report - if: always() - uses: actions/upload-artifact@v4 - with: - name: jupyter_server_documents-playwright-tests - path: | - ui-tests/test-results - ui-tests/playwright-report + - name: Checkout + uses: actions/checkout@v4 + + - name: Base Setup + uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + + - name: Download extension package + uses: actions/download-artifact@v4 + with: + name: extension-artifacts + + - name: Install the extension + run: | + set -eux + python -m pip install "jupyterlab>=4.0.0,<5" jupyter_server_documents*.whl + + - name: Install dependencies + working-directory: ui-tests + env: + YARN_ENABLE_IMMUTABLE_INSTALLS: 0 + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 + run: jlpm install + + - name: Set up browser cache + uses: actions/cache@v4 + with: + path: | + ${{ github.workspace }}/pw-browsers + key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }} + + - name: Install browser + run: jlpm playwright install chromium + working-directory: ui-tests + + - name: Execute integration tests + working-directory: ui-tests + run: | + jlpm playwright test + + - name: Upload Playwright Test report + if: always() + uses: actions/upload-artifact@v4 + with: + name: jupyter_server_documents-playwright-tests + path: | + ui-tests/test-results + ui-tests/playwright-report check_links: name: Check Links diff --git a/README.md b/README.md index 3ba7679..4ea86fd 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Jupyter Server Documents This extension is composed of a Python package named `jupyter_server_documents` -for the server extension and a NPM package named `@jupyter/server-documents` +for the server extension and a NPM package named `@jupyter-ai-contrib/server-documents` for the frontend extension. ## Overview @@ -179,7 +179,7 @@ jlpm dev:uninstall In development mode, you will also need to remove the symlink created by `jupyter labextension develop` command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions` folder is -located. Then you can remove the symlink named `@jupyter/server-documents` within that +located. Then you can remove the symlink named `@jupyter-ai-contrib/server-documents` within that folder. ### Testing the extension diff --git a/jupyter_server_documents/__init__.py b/jupyter_server_documents/__init__.py index e609f8f..610bdb6 100644 --- a/jupyter_server_documents/__init__.py +++ b/jupyter_server_documents/__init__.py @@ -16,7 +16,7 @@ def _jupyter_labextension_paths(): return [{ "src": "labextension", - "dest": "@jupyter/server-documents" + "dest": "@jupyter-ai-contrib/server-documents" }] diff --git a/package.json b/package.json index a269975..ed853b2 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@jupyter/server-documents", + "name": "@jupyter-ai-contrib/server-documents", "version": "0.1.0-a6", "description": "A JupyterLab extension that provides RTC capabilities.", "keywords": [ diff --git a/pyproject.toml b/pyproject.toml index 8d6a2c9..ab8f111 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,8 +57,8 @@ artifacts = ["jupyter_server_documents/labextension"] exclude = [".github", "binder"] [tool.hatch.build.targets.wheel.shared-data] -"jupyter_server_documents/labextension" = "share/jupyter/labextensions/@jupyter/server-documents" -"install.json" = "share/jupyter/labextensions/@jupyter/server-documents/install.json" +"jupyter_server_documents/labextension" = "share/jupyter/labextensions/@jupyter-ai-contrib/server-documents" +"install.json" = "share/jupyter/labextensions/@jupyter-ai-contrib/server-documents/install.json" "jupyter-config/server-config" = "etc/jupyter/jupyter_server_config.d" [tool.hatch.build.hooks.version] diff --git a/schema/plugin.json b/schema/plugin.json index dd27853..0b3704e 100644 --- a/schema/plugin.json +++ b/schema/plugin.json @@ -1,7 +1,7 @@ { "jupyter.lab.shortcuts": [], - "title": "@jupyter/server-documents", - "description": "@jupyter/server-documents settings.", + "title": "@jupyter-ai-contrib/server-documents", + "description": "@jupyter-ai-contrib/server-documents settings.", "type": "object", "properties": {}, "additionalProperties": false, diff --git a/src/__tests__/jupyter_rtc_core.spec.ts b/src/__tests__/jupyter_rtc_core.spec.ts index dd7d54d..6bf6bd2 100644 --- a/src/__tests__/jupyter_rtc_core.spec.ts +++ b/src/__tests__/jupyter_rtc_core.spec.ts @@ -2,7 +2,7 @@ * Example of [Jest](https://jestjs.io/docs/getting-started) unit tests */ -describe('@jupyter/server-documents', () => { +describe('@jupyter-ai-contrib/server-documents', () => { it('should be tested', () => { expect(1 + 1).toEqual(2); }); diff --git a/src/codemirror-binding/plugin.ts b/src/codemirror-binding/plugin.ts index 60917fb..f2adbda 100644 --- a/src/codemirror-binding/plugin.ts +++ b/src/codemirror-binding/plugin.ts @@ -18,7 +18,7 @@ import { ybinding } from './ybinding'; * CodeMirror shared model binding provider. */ export const codemirrorYjsPlugin: JupyterFrontEndPlugin = { - id: '@jupyter/server-documents:ybinding', + id: '@jupyter-ai-contrib/server-documents:ybinding', description: 'Register the CodeMirror extension factory binding the editor and the shared model.', autoStart: true, diff --git a/src/disablesave.ts b/src/disablesave.ts index dfc5c3c..2221051 100644 --- a/src/disablesave.ts +++ b/src/disablesave.ts @@ -23,7 +23,7 @@ const NOTIFICATION_INTERVAL = 20; * Plugin to disable save commands */ export const disableSavePlugin: JupyterFrontEndPlugin = { - id: 'disable-save:plugin', + id: '@jupyter-ai-contrib/server-documents:disable-save-plugin', description: 'Disables save commands and removes their keyboard shortcuts since documents are autosaved', autoStart: true, diff --git a/src/docprovider/filebrowser.ts b/src/docprovider/filebrowser.ts index 1fe9341..9a8073f 100644 --- a/src/docprovider/filebrowser.ts +++ b/src/docprovider/filebrowser.ts @@ -45,7 +45,7 @@ const TWO_SESSIONS_WARNING = export const rtcContentProvider: JupyterFrontEndPlugin = { - id: '@jupyter/server-documents:rtc-content-provider', + id: '@jupyter-ai-contrib/server-documents:rtc-content-provider', description: 'The RTC content provider', provides: ICollaborativeContentProvider, requires: [ITranslator], @@ -86,7 +86,7 @@ export const rtcContentProvider: JupyterFrontEndPlugin = { - id: '@jupyter/server-documents:yfile', + id: '@jupyter-ai-contrib/server-documents:yfile', description: "Plugin to register the shared model factory for the content type 'file'", autoStart: true, @@ -111,7 +111,7 @@ export const yfile: JupyterFrontEndPlugin = { * Plugin to register the shared model factory for the content type 'notebook'. */ export const ynotebook: JupyterFrontEndPlugin = { - id: '@jupyter/server-documents:ynotebook', + id: '@jupyter-ai-contrib/server-documents:ynotebook', description: "Plugin to register the shared model factory for the content type 'notebook'", autoStart: true, @@ -167,7 +167,7 @@ export const ynotebook: JupyterFrontEndPlugin = { * was reset. It then clears the content. */ export const ychat: JupyterFrontEndPlugin = { - id: '@jupyter/server-documents:ychat', + id: '@jupyter-ai-contrib/server-documents:ychat', description: 'Plugin to register a custom YChat factory and handle document resets.', autoStart: true, @@ -232,7 +232,7 @@ export const ychat: JupyterFrontEndPlugin = { * The default collaborative drive provider. */ export const logger: JupyterFrontEndPlugin = { - id: '@jupyter/server-documents:rtc-drive-logger', + id: '@jupyter-ai-contrib/server-documents:rtc-drive-logger', description: 'A logging plugin for debugging purposes.', autoStart: true, optional: [ILoggerRegistry, IEditorTracker, INotebookTracker, ITranslator], diff --git a/src/index.ts b/src/index.ts index 383a64b..acc9ccd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -52,10 +52,10 @@ import { notebookFactoryPlugin } from './notebook-factory'; import { disableSavePlugin } from './disablesave'; /** - * Initialization data for the @jupyter/server-documents extension. + * Initialization data for the @jupyter-ai-contrib/server-documents extension. */ export const plugin: JupyterFrontEndPlugin = { - id: '@jupyter/server-documents:plugin', + id: '@jupyter-ai-contrib/server-documents:plugin', description: 'A JupyterLab extension that provides RTC capabilities.', autoStart: true, optional: [ISettingRegistry], @@ -63,20 +63,22 @@ export const plugin: JupyterFrontEndPlugin = { app: JupyterFrontEnd, settingRegistry: ISettingRegistry | null ) => { - console.log('JupyterLab extension @jupyter/server-documents is activated!'); + console.log( + 'JupyterLab extension @jupyter-ai-contrib/server-documents is activated!' + ); if (settingRegistry) { settingRegistry .load(plugin.id) .then(settings => { console.log( - '@jupyter/server-documents settings loaded:', + '@jupyter-ai-contrib/server-documents settings loaded:', settings.composite ); }) .catch(reason => { console.error( - 'Failed to load settings for @jupyter/server-documents.', + 'Failed to load settings for @jupyter-ai-contrib/server-documents.', reason ); }); @@ -98,7 +100,7 @@ export const plugin: JupyterFrontEndPlugin = { * Jupyter plugin creating a global awareness for RTC. */ export const rtcGlobalAwarenessPlugin: JupyterFrontEndPlugin = { - id: '@jupyter/server-documents:rtc-global-awareness', + id: '@jupyter-ai-contrib/server-documents:rtc-global-awareness', description: 'Add global awareness to share working document of users.', requires: [IStateDB], provides: IGlobalAwareness, @@ -152,7 +154,7 @@ class AwarenessExecutionIndicatorIcon * A plugin that provides a execution indicator item to the status bar. */ export const executionIndicator: JupyterFrontEndPlugin = { - id: '@jupyter/server-documents:awareness-execution-indicator', + id: '@jupyter-ai-contrib/server-documents:awareness-execution-indicator', description: 'Adds a notebook execution status widget.', autoStart: true, requires: [INotebookTracker, ILabShell, ITranslator, IToolbarWidgetRegistry], @@ -180,7 +182,7 @@ export const executionIndicator: JupyterFrontEndPlugin = { * A plugin that provides a kernel status item to the status bar. */ export const kernelStatus: JupyterFrontEndPlugin = { - id: '@jupyter/server-documents:awareness-kernel-status', + id: '@jupyter-ai-contrib/server-documents:awareness-kernel-status', description: 'Provides the kernel status indicator model.', autoStart: true, requires: [IStatusBar], @@ -301,7 +303,7 @@ export const kernelStatus: JupyterFrontEndPlugin = { */ export const backupCellExecutorPlugin: JupyterFrontEndPlugin = { - id: '@jupyter/server-documents:backup-cell-executor', + id: '@jupyter-ai-contrib/server-documents:backup-cell-executor', description: 'Provides a backup default implementation of the notebook cell executor.', autoStart: false, diff --git a/src/notebook-factory/plugin.ts b/src/notebook-factory/plugin.ts index 5867953..a482f06 100644 --- a/src/notebook-factory/plugin.ts +++ b/src/notebook-factory/plugin.ts @@ -14,7 +14,7 @@ type NotebookFactoryPlugin = * Custom `Notebook` factory plugin. */ export const notebookFactoryPlugin: NotebookFactoryPlugin = { - id: '@jupyter/server-documents:notebook-factory', + id: '@jupyter-ai-contrib/server-documents:notebook-factory', description: 'Provides the notebook cell factory.', provides: NotebookPanel.IContentFactory, requires: [IEditorServices], diff --git a/ui-tests/package.json b/ui-tests/package.json index 830fe84..673e905 100644 --- a/ui-tests/package.json +++ b/ui-tests/package.json @@ -1,7 +1,7 @@ { - "name": "@jupyter/server-documents-ui-tests", + "name": "@jupyter-ai-contrib/server-documents-ui-tests", "version": "1.0.0", - "description": "JupyterLab @jupyter/server-documents Integration Tests", + "description": "JupyterLab @jupyter-ai-contrib/server-documents Integration Tests", "private": true, "scripts": { "start": "jupyter lab --config jupyter_server_test_config.py", diff --git a/ui-tests/tests/jupyter_server_documents.spec.ts b/ui-tests/tests/jupyter_server_documents.spec.ts index f37bf1f..e6b262f 100644 --- a/ui-tests/tests/jupyter_server_documents.spec.ts +++ b/ui-tests/tests/jupyter_server_documents.spec.ts @@ -17,7 +17,9 @@ test('should emit an activation console message', async ({ page }) => { expect( logs.filter( - s => s === 'JupyterLab extension @jupyter/server-documents is activated!' + s => + s === + 'JupyterLab extension @jupyter-ai-contrib/server-documents is activated!' ) ).toHaveLength(1); }); diff --git a/yarn.lock b/yarn.lock index 4dff1cd..44a5ca3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2306,6 +2306,61 @@ __metadata: languageName: node linkType: hard +"@jupyter-ai-contrib/server-documents@workspace:.": + version: 0.0.0-use.local + resolution: "@jupyter-ai-contrib/server-documents@workspace:." + dependencies: + "@jupyter/chat": ">=0.6.0 <1" + "@jupyter/collaborative-drive": ^4 + "@jupyter/ydoc": ^2.1.3 || ^3.0.0 + "@jupyterlab/application": ^4.4.0 + "@jupyterlab/apputils": ^4.4.0 + "@jupyterlab/builder": ^4.0.0 + "@jupyterlab/cells": ^4.4.0 + "@jupyterlab/coreutils": ^6.4.0 + "@jupyterlab/docregistry": ^4.4.0 + "@jupyterlab/filebrowser": ^4.4.0 + "@jupyterlab/fileeditor": ^4.4.0 + "@jupyterlab/logconsole": ^4.4.0 + "@jupyterlab/notebook": ^4.4.0 + "@jupyterlab/services": ^7.4.0 + "@jupyterlab/settingregistry": ^4.4.0 + "@jupyterlab/testing": ^4.4.0 + "@jupyterlab/testutils": ^4.0.0 + "@jupyterlab/translation": ^4.4.0 + "@lumino/coreutils": ^2.2.1 + "@lumino/disposable": ^2.1.4 + "@lumino/signaling": ^2.1.4 + "@types/jest": ^29.2.0 + "@types/json-schema": ^7.0.11 + "@types/react": ^18.0.26 + "@types/react-addons-linked-state-mixin": ^0.14.22 + "@typescript-eslint/eslint-plugin": ^6.1.0 + "@typescript-eslint/parser": ^6.1.0 + css-loader: ^6.7.1 + eslint: ^8.36.0 + eslint-config-prettier: ^8.8.0 + eslint-plugin-prettier: ^5.0.0 + jest: ^29.2.0 + jupyterlab-chat: ">=0.6.0 <1" + mkdirp: ^1.0.3 + npm-run-all2: ^7.0.1 + prettier: ^3.0.0 + rimraf: ^5.0.1 + source-map-loader: ^1.0.2 + style-loader: ^3.3.1 + stylelint: ^15.10.1 + stylelint-config-recommended: ^13.0.0 + stylelint-config-standard: ^34.0.0 + stylelint-csstree-validator: ^3.0.0 + stylelint-prettier: ^4.0.0 + typescript: ~5.0.2 + y-protocols: ^1.0.5 + y-websocket: ^1.3.15 + yjs: ^13.5.0 + languageName: unknown + linkType: soft + "@jupyter/chat@npm:>=0.6.0 <1, @jupyter/chat@npm:^0.18.2": version: 0.18.2 resolution: "@jupyter/chat@npm:0.18.2" @@ -2383,61 +2438,6 @@ __metadata: languageName: node linkType: hard -"@jupyter/server-documents@workspace:.": - version: 0.0.0-use.local - resolution: "@jupyter/server-documents@workspace:." - dependencies: - "@jupyter/chat": ">=0.6.0 <1" - "@jupyter/collaborative-drive": ^4 - "@jupyter/ydoc": ^2.1.3 || ^3.0.0 - "@jupyterlab/application": ^4.4.0 - "@jupyterlab/apputils": ^4.4.0 - "@jupyterlab/builder": ^4.0.0 - "@jupyterlab/cells": ^4.4.0 - "@jupyterlab/coreutils": ^6.4.0 - "@jupyterlab/docregistry": ^4.4.0 - "@jupyterlab/filebrowser": ^4.4.0 - "@jupyterlab/fileeditor": ^4.4.0 - "@jupyterlab/logconsole": ^4.4.0 - "@jupyterlab/notebook": ^4.4.0 - "@jupyterlab/services": ^7.4.0 - "@jupyterlab/settingregistry": ^4.4.0 - "@jupyterlab/testing": ^4.4.0 - "@jupyterlab/testutils": ^4.0.0 - "@jupyterlab/translation": ^4.4.0 - "@lumino/coreutils": ^2.2.1 - "@lumino/disposable": ^2.1.4 - "@lumino/signaling": ^2.1.4 - "@types/jest": ^29.2.0 - "@types/json-schema": ^7.0.11 - "@types/react": ^18.0.26 - "@types/react-addons-linked-state-mixin": ^0.14.22 - "@typescript-eslint/eslint-plugin": ^6.1.0 - "@typescript-eslint/parser": ^6.1.0 - css-loader: ^6.7.1 - eslint: ^8.36.0 - eslint-config-prettier: ^8.8.0 - eslint-plugin-prettier: ^5.0.0 - jest: ^29.2.0 - jupyterlab-chat: ">=0.6.0 <1" - mkdirp: ^1.0.3 - npm-run-all2: ^7.0.1 - prettier: ^3.0.0 - rimraf: ^5.0.1 - source-map-loader: ^1.0.2 - style-loader: ^3.3.1 - stylelint: ^15.10.1 - stylelint-config-recommended: ^13.0.0 - stylelint-config-standard: ^34.0.0 - stylelint-csstree-validator: ^3.0.0 - stylelint-prettier: ^4.0.0 - typescript: ~5.0.2 - y-protocols: ^1.0.5 - y-websocket: ^1.3.15 - yjs: ^13.5.0 - languageName: unknown - linkType: soft - "@jupyter/web-components@npm:^0.15.3": version: 0.15.3 resolution: "@jupyter/web-components@npm:0.15.3"