Skip to content

Commit

Permalink
Extract out ICollaborativeDrive to @jupyter/collaborativedrive
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Sep 18, 2024
1 parent 7d58496 commit 95c62d1
Show file tree
Hide file tree
Showing 16 changed files with 125 additions and 32 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
Expand All @@ -71,6 +71,7 @@ jobs:
pip install "jupyterlab>=4.0.0,<5"
pip install -e .
jlpm
jlpm build
- name: Run Tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ repos:
rev: v0.991
hooks:
- id: mypy
exclude: "(^binder/jupyter_config\\.py$)|(/setup\\.py$)"
exclude: "(^binder/jupyter_config\\.py$)|(/setup\\.py$)|(^scripts/bump_version\\.py$)"
args: ["--config-file", "pyproject.toml"]
additional_dependencies: [tornado, pytest]
stages: [manual]
Expand Down
5 changes: 5 additions & 0 deletions packages/collaboration-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
},
"dependencies": {
"@jupyter/collaboration": "^3.0.0-beta.4",
"@jupyter/collaborativedrive": "^3.0.0-beta.4",
"@jupyter/docprovider": "^3.0.0-beta.4",
"@jupyter/ydoc": "^2.0.0 || ^3.0.0-a3",
"@jupyterlab/application": "^4.2.0",
Expand Down Expand Up @@ -102,6 +103,10 @@
"bundled": true,
"singleton": true
},
"@jupyter/collaborativedrive": {
"bundled": true,
"singleton": true
},
"@jupyter/docprovider": {
"bundled": true,
"singleton": true
Expand Down
6 changes: 2 additions & 4 deletions packages/collaboration-extension/src/collaboration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ import {
EditorExtensionRegistry,
IEditorExtensionRegistry
} from '@jupyterlab/codemirror';
import {
IGlobalAwareness,
WebSocketAwarenessProvider
} from '@jupyter/docprovider';
import { IGlobalAwareness } from '@jupyter/collaborativedrive';
import { WebSocketAwarenessProvider } from '@jupyter/docprovider';
import { SidePanel, usersIcon } from '@jupyterlab/ui-components';
import { URLExt } from '@jupyterlab/coreutils';
import { ServerConnection } from '@jupyterlab/services';
Expand Down
55 changes: 55 additions & 0 deletions packages/collaborativedrive/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "@jupyter/collaborativedrive",
"version": "3.0.0-beta.4",
"description": "JupyterLab - Collaborative Drive",
"homepage": "https://github.com/jupyterlab/jupyter-collaboration",
"bugs": {
"url": "https://github.com/jupyterlab/jupyter-collaboration/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/jupyterlab/jupyter-collaboration.git"
},
"license": "BSD-3-Clause",
"author": "Project Jupyter",
"sideEffects": [
"style/**/*"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"directories": {
"lib": "lib/"
},
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"schema/*.json",
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
"style/index.js"
],
"scripts": {
"build": "tsc -b",
"build:prod": "jlpm run build",
"build:test": "tsc --build tsconfig.test.json",
"clean": "rimraf lib tsconfig.tsbuildinfo",
"clean:lib": "jlpm run clean:all",
"clean:all": "rimraf lib tsconfig.tsbuildinfo node_modules",
"install:extension": "jlpm run build",
"watch": "tsc -b --watch"
},
"dependencies": {
"@jupyter/ydoc": "^2.0.0 || ^3.0.0-a3",
"@jupyterlab/coreutils": "^6.2.0"
},
"devDependencies": {
"rimraf": "^4.1.2",
"typescript": "~5.0.4"
},
"publishConfig": {
"access": "public"
},
"typedoc": {
"entryPoint": "./src/index.ts",
"displayName": "@jupyter/collaborativedrive",
"tsconfig": "./tsconfig.json"
}
}
10 changes: 10 additions & 0 deletions packages/collaborativedrive/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* -----------------------------------------------------------------------------
| Copyright (c) Jupyter Development Team.
| Distributed under the terms of the Modified BSD License.
|----------------------------------------------------------------------------*/
/**
* @packageDocumentation
* @module collaborativedrive
*/

export * from './tokens';
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import { DocumentChange, IAwareness, YDocument } from '@jupyter/ydoc';
import { Contents } from '@jupyterlab/services';
import { IDisposable } from '@lumino/disposable';

import { Token } from '@lumino/coreutils';
import { WebSocketProvider } from './yprovider';

/**
* The collaborative drive.
Expand Down Expand Up @@ -38,7 +38,7 @@ export interface ICollaborativeDrive extends Contents.IDrive {
*/
readonly sharedModelFactory: ISharedModelFactory;

readonly providers: Map<string, WebSocketProvider>;
readonly providers: Map<string, IDocumentProvider>;
}

/**
Expand All @@ -56,3 +56,13 @@ export interface ISharedModelFactory extends Contents.ISharedFactory {
factory: SharedDocumentFactory
): void;
}

/**
* An interface for a document provider.
*/
export interface IDocumentProvider extends IDisposable {
/**
* Returns a Promise that resolves when the document provider is ready.
*/
readonly ready: Promise<void>;
}
9 changes: 9 additions & 0 deletions packages/collaborativedrive/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
},
"include": ["src/*"],
"exclude": ["src/__tests__/*"]
}
5 changes: 5 additions & 0 deletions packages/docprovider-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"watch:labextension": "jupyter labextension watch ."
},
"dependencies": {
"@jupyter/collaborativedrive": "^3.0.0-beta.4",
"@jupyter/docprovider": "^3.0.0-beta.4",
"@jupyter/ydoc": "^2.0.0 || ^3.0.0-a3",
"@jupyterlab/application": "^4.2.0",
Expand Down Expand Up @@ -105,6 +106,10 @@
"bundled": false,
"singleton": true
},
"@jupyter/collaborativedrive": {
"bundled": true,
"singleton": true
},
"@jupyter/docprovider": {
"bundled": true,
"singleton": true
Expand Down
12 changes: 4 additions & 8 deletions packages/docprovider-extension/src/filebrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,9 @@ import { CommandRegistry } from '@lumino/commands';

import { YFile, YNotebook } from '@jupyter/ydoc';

import {
ICollaborativeDrive,
IForkProvider,
IGlobalAwareness,
TimelineWidget,
YDrive
} from '@jupyter/docprovider';
import { IGlobalAwareness } from '@jupyter/collaborativedrive';
import { IForkProvider, TimelineWidget, YDrive } from '@jupyter/docprovider';
import { ICollaborativeDrive } from '@jupyter/collaborativedrive';
import { Awareness } from 'y-protocols/awareness';
import { URLExt } from '@jupyterlab/coreutils';

Expand Down Expand Up @@ -167,7 +163,7 @@ export const statusBarTimeline: JupyterFrontEndPlugin<void> = {
const [format, type] = documentId.split(':');
const provider = drive.providers.get(
`${format}:${type}:${documentPath}`
) as IForkProvider;
) as unknown as IForkProvider;
const fullPath = URLExt.join(
app.serviceManager.serverSettings.baseUrl,
DOCUMENT_TIMELINE_URL,
Expand Down
1 change: 1 addition & 0 deletions packages/docprovider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"watch": "tsc -b --watch"
},
"dependencies": {
"@jupyter/collaborativedrive": "^3.0.0-beta.3",
"@jupyter/ydoc": "^2.0.0 || ^3.0.0-a3",
"@jupyterlab/apputils": "^4.2.0",
"@jupyterlab/cells": "^4.2.0",
Expand Down
1 change: 0 additions & 1 deletion packages/docprovider/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ export * from './notebookCellExecutor';
export * from './requests';
export * from './ydrive';
export * from './yprovider';
export * from './tokens';
export * from './TimelineSlider';
2 changes: 1 addition & 1 deletion packages/docprovider/src/ydrive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
ICollaborativeDrive,
ISharedModelFactory,
SharedDocumentFactory
} from './tokens';
} from '@jupyter/collaborativedrive';
import { Awareness } from 'y-protocols/awareness';

const DISABLE_RTC =
Expand Down
12 changes: 1 addition & 11 deletions packages/docprovider/src/yprovider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
| Distributed under the terms of the Modified BSD License.
|----------------------------------------------------------------------------*/

import { IDocumentProvider } from '@jupyter/collaborativedrive';
import { showErrorMessage, Dialog } from '@jupyterlab/apputils';
import { User } from '@jupyterlab/services';
import { TranslationBundle } from '@jupyterlab/translation';

import { PromiseDelegate } from '@lumino/coreutils';
import { IDisposable } from '@lumino/disposable';
import { Signal } from '@lumino/signaling';

import { DocumentChange, YDocument } from '@jupyter/ydoc';
Expand All @@ -19,16 +19,6 @@ import { WebsocketProvider as YWebsocketProvider } from 'y-websocket';
import { requestDocSession } from './requests';
import { IForkProvider } from './ydrive';

/**
* An interface for a document provider.
*/
export interface IDocumentProvider extends IDisposable {
/**
* Returns a Promise that resolves when the document provider is ready.
*/
readonly ready: Promise<void>;
}

/**
* A class to provide Yjs synchronization over WebSocket.
*
Expand Down
2 changes: 1 addition & 1 deletion scripts/bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import click
import tomlkit
from jupyter_releaser.util import get_version, run
from pkg_resources import parse_version # type: ignore
from pkg_resources import parse_version

LERNA_CMD = "jlpm run lerna version --no-push --force-publish --no-git-tag-version"

Expand Down
14 changes: 14 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2076,6 +2076,7 @@ __metadata:
resolution: "@jupyter/collaboration-extension@workspace:packages/collaboration-extension"
dependencies:
"@jupyter/collaboration": ^3.0.0-beta.4
"@jupyter/collaborativedrive": ^3.0.0-beta.4
"@jupyter/docprovider": ^3.0.0-beta.4
"@jupyter/ydoc": ^2.0.0 || ^3.0.0-a3
"@jupyterlab/application": ^4.2.0
Expand Down Expand Up @@ -2122,10 +2123,22 @@ __metadata:
languageName: unknown
linkType: soft

"@jupyter/collaborativedrive@^3.0.0-beta.3, @jupyter/collaborativedrive@^3.0.0-beta.4, @jupyter/collaborativedrive@workspace:packages/collaborativedrive":
version: 0.0.0-use.local
resolution: "@jupyter/collaborativedrive@workspace:packages/collaborativedrive"
dependencies:
"@jupyter/ydoc": ^2.0.0 || ^3.0.0-a3
"@jupyterlab/coreutils": ^6.2.0
rimraf: ^4.1.2
typescript: ~5.0.4
languageName: unknown
linkType: soft

"@jupyter/docprovider-extension@workspace:packages/docprovider-extension":
version: 0.0.0-use.local
resolution: "@jupyter/docprovider-extension@workspace:packages/docprovider-extension"
dependencies:
"@jupyter/collaborativedrive": ^3.0.0-beta.4
"@jupyter/docprovider": ^3.0.0-beta.4
"@jupyter/ydoc": ^2.0.0 || ^3.0.0-a3
"@jupyterlab/application": ^4.2.0
Expand Down Expand Up @@ -2153,6 +2166,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@jupyter/docprovider@workspace:packages/docprovider"
dependencies:
"@jupyter/collaborativedrive": ^3.0.0-beta.3
"@jupyter/ydoc": ^2.0.0 || ^3.0.0-a3
"@jupyterlab/apputils": ^4.2.0
"@jupyterlab/cells": ^4.2.0
Expand Down

0 comments on commit 95c62d1

Please sign in to comment.