Skip to content

Commit 0e3a88d

Browse files
authored
Merge pull request #8 from martinRenou/update_rest
Remove RESTContentProvider dependency + add some basic CI
2 parents 624caee + 9aed5c8 commit 0e3a88d

File tree

7 files changed

+1951
-768
lines changed

7 files changed

+1951
-768
lines changed

.github/workflows/main.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
defaults:
12+
run:
13+
shell: bash -l {0}
14+
15+
jobs:
16+
build:
17+
runs-on: ${{ matrix.os }}
18+
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os: [ubuntu-latest]
23+
python-version: ['3.14']
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v6
28+
29+
- name: Install Conda environment with Micromamba
30+
uses: mamba-org/setup-micromamba@v2
31+
with:
32+
environment-name: ci
33+
channels: conda-forge
34+
create-args: >-
35+
python=${{ matrix.python-version }}
36+
jupyterlab
37+
python-build
38+
39+
- name: Test TS build
40+
run: |
41+
jlpm
42+
jlpm run build
43+
44+
- name: Test Python build
45+
run: python -m build

packages/my-shared-docprovider-extension/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@
5353
"watch:labextension": "jupyter labextension watch ."
5454
},
5555
"dependencies": {
56-
"@jupyter/collaborative-drive": "^4.0.0",
56+
"@jupyter/collaborative-drive": "^4.1.1",
5757
"@jupyter/my-shared-docprovider": "^0.2.1",
58-
"@jupyterlab/filebrowser": "^4.4.0",
59-
"@jupyterlab/fileeditor": "^4.4.0",
60-
"@jupyterlab/notebook": "^4.4.0"
58+
"@jupyterlab/filebrowser": "^4.5.0",
59+
"@jupyterlab/fileeditor": "^4.5.0",
60+
"@jupyterlab/notebook": "^4.5.0"
6161
},
6262
"devDependencies": {
63-
"@jupyterlab/builder": "^4.4.0",
63+
"@jupyterlab/builder": "^4.5.0",
6464
"npm-run-all": "^4.1.5",
6565
"rimraf": "^4.1.2",
6666
"typescript": "~5.0.4"

packages/my-shared-docprovider-extension/src/filebrowser.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ export const rtcContentProvider: JupyterFrontEndPlugin<ICollaborativeContentProv
5353
);
5454
}
5555
const rtcContentProvider = new RtcContentProvider(app, {
56-
apiEndpoint: '/api/contents',
57-
serverSettings: defaultDrive.serverSettings,
56+
currentDrive: defaultDrive,
5857
user: app.serviceManager.user,
5958
trans
6059
});

packages/my-shared-docprovider/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
"watch": "tsc -b --watch"
4242
},
4343
"dependencies": {
44-
"@jupyter/collaborative-drive": "^4.0.0",
44+
"@jupyter/collaborative-drive": "^4.1.1",
4545
"@jupyter/ydoc": "^2.0.0 || ^3.0.0",
46-
"@jupyterlab/application": "^4.4.0",
47-
"@jupyterlab/services": "^7.4.0",
48-
"@jupyterlab/translation": "^4.4.0",
46+
"@jupyterlab/application": "^4.5.0",
47+
"@jupyterlab/services": "^7.5.0",
48+
"@jupyterlab/translation": "^4.5.0",
4949
"@lumino/signaling": "^2.1.0"
5050
},
5151
"devDependencies": {

packages/my-shared-docprovider/src/drive.ts

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { TranslationBundle } from '@jupyterlab/translation';
77
import {
88
Contents,
99
IContentProvider,
10-
RestContentProvider,
1110
SharedDocumentFactory,
1211
User
1312
} from '@jupyterlab/services';
@@ -21,26 +20,24 @@ import {
2120
} from '@jupyter/collaborative-drive';
2221

2322
namespace RtcContentProvider {
24-
export interface IOptions extends RestContentProvider.IOptions {
23+
export interface IOptions {
24+
currentDrive: Contents.IDrive;
2525
user: User.IManager;
2626
trans: TranslationBundle;
2727
}
2828
}
2929

30-
export class RtcContentProvider
31-
extends RestContentProvider
32-
implements IContentProvider
33-
{
30+
export class RtcContentProvider implements IContentProvider {
3431
/**
3532
* Construct a new drive object.
3633
*
3734
* @param user - The user manager to add the identity to the awareness of documents.
3835
*/
3936
constructor(app: JupyterFrontEnd, options: RtcContentProvider.IOptions) {
40-
super(options);
4137
this._app = app;
4238
this._user = options.user;
4339
this._trans = options.trans;
40+
this._currentDrive = options.currentDrive;
4441
this._providers = new Map<string, MyProvider>();
4542
this.sharedModelFactory = new SharedModelFactory(this._onCreate);
4643
this._saveLock = new AsyncLock();
@@ -80,7 +77,11 @@ export class RtcContentProvider
8077
// Use `Promise.all` to reject as soon as possible. The Context will
8178
// show a dialog to the user.
8279
const [model] = await Promise.all([
83-
super.get(localPath, { ...options, content: false }),
80+
this._currentDrive.get(localPath, {
81+
...options,
82+
content: false,
83+
contentProviderId: undefined
84+
}),
8485
provider.ready
8586
]);
8687
// The server doesn't return a model with a format when content is false,
@@ -89,7 +90,10 @@ export class RtcContentProvider
8990
}
9091
}
9192

92-
return await super.get(localPath, options);
93+
return await this._currentDrive.get(localPath, {
94+
...options,
95+
contentProviderId: undefined
96+
});
9397
}
9498

9599
async listCheckpoints(path: string): Promise<Contents.ICheckpointModel[]> {
@@ -132,7 +136,7 @@ export class RtcContentProvider
132136
*/
133137
async save(
134138
localPath: string,
135-
options: Partial<Contents.IModel> = {}
139+
options: Partial<Contents.IModel> & Contents.IContentProvisionOptions = {}
136140
): Promise<Contents.IModel> {
137141
// Check that there is a provider - it won't e.g. if the document model is not collaborative.
138142
if (options.format && options.type) {
@@ -150,7 +154,10 @@ export class RtcContentProvider
150154
}
151155
}
152156

153-
return await super.save(localPath, options);
157+
return await this._currentDrive.save(localPath, {
158+
...options,
159+
contentProviderId: undefined
160+
});
154161
}
155162

156163
/**
@@ -254,6 +261,7 @@ export class RtcContentProvider
254261
return sharedModel;
255262
};
256263

264+
private _currentDrive: Contents.IDrive;
257265
private _app: JupyterFrontEnd;
258266
private _user: User.IManager;
259267
private _trans: TranslationBundle;

typedoc.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{
22
"entryPointStrategy": "packages",
3-
"entryPoints": [
4-
"packages/my-shared-docprovider"
5-
],
3+
"entryPoints": ["packages/my-shared-docprovider"],
64
"externalSymbolLinkMappings": {
75
"@codemirror/state": {
86
"Extension": "https://codemirror.net/docs/ref/#state.Extension"

0 commit comments

Comments
 (0)