Skip to content

Commit 7227449

Browse files
hbcarlosfcollonval
andauthored
Updates jupyter_ydoc, removes the docprovider and uses drives as providers (jupyterlab#13786)
* Update JupyterYDoc * Restore ModelDBFactory as shared model IFactory * Removes docprovider-extension and uses a drive as a provider * Small fixes * Review * Rebase * Fixes tests * Adds the API changes to the migration guide * Fixes docs * Review * Fixes tests * Update migration guide * Review * Clean up the interfaces * Fix mock-up for Contents service manager * Update @jupyter/ydoc * Update jupyter_ydoc * Clean up the top package dependencies * Fix integrity Co-authored-by: Frédéric Collonval <[email protected]> Co-authored-by: Frédéric Collonval <[email protected]>
1 parent a759b47 commit 7227449

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+618
-487
lines changed

.github/labeler.yml

-2
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ pkg:docmanager:
115115
pkg:docprovider:
116116
- packages/docprovider/**/*
117117
- packages/docprovider/*
118-
- packages/docprovider-extension/**/*
119-
- packages/docprovider-extension/*
120118

121119
pkg:docregistry:
122120
- packages/docregistry/**/*

buildutils/src/ensure-repo.ts

-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ const SKIP_CSS: Dict<string[]> = {
196196
'@jupyterlab/debugger',
197197
'@jupyterlab/debugger-extension',
198198
'@jupyterlab/docmanager-extension',
199-
'@jupyterlab/docprovider-extension',
200199
'@jupyterlab/documentsearch-extension',
201200
'@jupyterlab/extensionmanager',
202201
'@jupyterlab/extensionmanager-extension',

dev_mode/package.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"watch": "webpack --watch"
1717
},
1818
"resolutions": {
19-
"@jupyter/ydoc": "~0.2.2",
19+
"@jupyter/ydoc": "~0.3.0",
2020
"@jupyterlab/application": "~4.0.0-alpha.17",
2121
"@jupyterlab/application-extension": "~4.0.0-alpha.17",
2222
"@jupyterlab/apputils": "~4.0.0-alpha.17",
@@ -44,7 +44,6 @@
4444
"@jupyterlab/docmanager": "~4.0.0-alpha.17",
4545
"@jupyterlab/docmanager-extension": "~4.0.0-alpha.17",
4646
"@jupyterlab/docprovider": "~4.0.0-alpha.17",
47-
"@jupyterlab/docprovider-extension": "~4.0.0-alpha.17",
4847
"@jupyterlab/docregistry": "~4.0.0-alpha.17",
4948
"@jupyterlab/documentsearch": "~4.0.0-alpha.17",
5049
"@jupyterlab/documentsearch-extension": "~4.0.0-alpha.17",
@@ -146,7 +145,6 @@
146145
"@jupyterlab/csvviewer-extension": "~4.0.0-alpha.17",
147146
"@jupyterlab/debugger-extension": "~4.0.0-alpha.17",
148147
"@jupyterlab/docmanager-extension": "~4.0.0-alpha.17",
149-
"@jupyterlab/docprovider-extension": "~4.0.0-alpha.17",
150148
"@jupyterlab/documentsearch-extension": "~4.0.0-alpha.17",
151149
"@jupyterlab/extensionmanager-extension": "~4.0.0-alpha.17",
152150
"@jupyterlab/filebrowser-extension": "~4.0.0-alpha.17",
@@ -228,7 +226,6 @@
228226
"@jupyterlab/csvviewer-extension": "",
229227
"@jupyterlab/debugger-extension": "",
230228
"@jupyterlab/docmanager-extension": "",
231-
"@jupyterlab/docprovider-extension": "",
232229
"@jupyterlab/documentsearch-extension": "",
233230
"@jupyterlab/extensionmanager-extension": "",
234231
"@jupyterlab/filebrowser-extension": "",
@@ -352,7 +349,6 @@
352349
"@jupyterlab/docmanager": "../packages/docmanager",
353350
"@jupyterlab/docmanager-extension": "../packages/docmanager-extension",
354351
"@jupyterlab/docprovider": "../packages/docprovider",
355-
"@jupyterlab/docprovider-extension": "../packages/docprovider-extension",
356352
"@jupyterlab/docregistry": "../packages/docregistry",
357353
"@jupyterlab/documentsearch": "../packages/documentsearch",
358354
"@jupyterlab/documentsearch-extension": "../packages/documentsearch-extension",

dev_mode/style.js

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import '@jupyterlab/console-extension/style/index.js';
1212
import '@jupyterlab/csvviewer-extension/style/index.js';
1313
import '@jupyterlab/debugger-extension/style/index.js';
1414
import '@jupyterlab/docmanager-extension/style/index.js';
15-
import '@jupyterlab/docprovider-extension/style/index.js';
1615
import '@jupyterlab/documentsearch-extension/style/index.js';
1716
import '@jupyterlab/extensionmanager-extension/style/index.js';
1817
import '@jupyterlab/filebrowser-extension/style/index.js';

docs/source/extension/extension_migration.rst

+15-2
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,14 @@ bumped their major version (following semver convention). We want to point out p
9696
* The interface ``DocumentManager.IWidgetOpener`` is now ``IDocumentWidgetOpener`` and is provided
9797
by a new plugin ``@jupyterlab/docmanager-extension:opener``.
9898
The ``IDocumentWidgetOpener`` interface also now defines an ```opened``` signal that is emitted when a widget is opened.
99+
* Removed the property ``docProviderFactory`` from the interface ``DocumentManager.IOptions``.
99100
- ``@jupyterlab/docprovider`` from 3.x to 4.x
100101
* ``WebSocketProviderWithLocks`` has been renamed to ``WebSocketProvider``.
101102
``acquireLock``, ``releaseLock``, ``requestInitialContent`` and ``putInitializedState`` have been removed from ``IDocumentProvider``.
102103
``renameAck`` is not optional anymore in ``IDocumentProvider``.
103-
* ``IDocumentProviderFactory.IOptions`` is now templated with ``T extends ISharedDocument``.
104-
And the ``ymodel`` attribute has been renamed ``model`` typed ``T`` (relaxing typing from ``YDocument`` to ``ISharedDocument``).
104+
* Removed the token and type ``IDocumentProviderFactory``.
105+
* Removed the property collaborative from the interface ``WebSocketProvider.IOptions``. It doesn't extend from
106+
``IDocumentProviderFactory.IOptions``. And the ``ymodel`` attribute has been renamed ``model``.
105107
- ``@jupyterlab/documentsearch`` from 3.x to 4.x
106108
* ``@jupyterlab/documentsearch:plugin`` has been renamed to ``@jupyterlab/documentsearch-extension:plugin``
107109
* ``@jupyterlab/documentsearch:labShellWidgetListener`` has been renamed to ``@jupyterlab/documentsearch-extension:labShellWidgetListener``
@@ -117,6 +119,9 @@ bumped their major version (following semver convention). We want to point out p
117119
by defining an entry point in the Python package; see ``pyproject.toml::project.entry-points."jupyterlab.extension_manager_v1"``.
118120
- ``@jupyterlab/fileeditor`` from 3.x to 4.x
119121
Remove the class ``FileEditorCodeWrapper``, instead, you can use ``CodeEditorWrapper`` from ``@jupyterlab/codeeditor``.
122+
- ``@jupyterlab/filebrowser`` from 3.x to 4.x
123+
Remove the property ``defaultBrowser`` from the interface ``IFileBrowserFactory``. The default browser is now provided by it own
124+
plugin by requiring the token ``IDefaultFileBrowser``.
120125
- ``@jupyterlab/filebrowser-extension`` from 3.x to 4.x
121126
Remove command ``filebrowser:create-main-launcher``. You can replace by ``launcher:create`` (same behavior)
122127
All launcher creation actions are moved to ``@jupyterlab/launcher-extension``.
@@ -126,6 +131,11 @@ bumped their major version (following semver convention). We want to point out p
126131
``galata.newContentsHelper(baseURL, page?, request?)`` -> ``galata.newContentsHelper(request?, page?)``
127132
you need to provide ``request`` or ``page``; they both are fixtures provided by Playwright.
128133
* ``galata.Mock.clearRunners(baseURL, runners, type)`` -> ``galata.Mock.clearRunners(request, runners, type)``
134+
- ``@jupyterlab/docregistry`` from 3.x to 4.x
135+
* Removed the property ``docProviderFactory`` from the interface ``Context.IOptions``.
136+
* The constructor of the class ``DocumentModel`` receives a parameter ``DocumentModel.IOptions``.
137+
* The method ``IModelFactory.createNew`` receives a parameter ``DocumentRegistry.IModelOptions``.
138+
* The method ``TextModelFactory.createNew`` receives a parameter ``DocumentModel.IOptions``.
129139
- ``@jupyterlab/notebook`` from 3.x to 4.x
130140
* The ``NotebookPanel._onSave`` method is now ``private``.
131141
* ``NotebookActions.collapseAll`` method renamed to ``NotebookActions.collapseAllHeadings``.
@@ -142,6 +152,8 @@ bumped their major version (following semver convention). We want to point out p
142152
``observedTopMargin`` and ``observedBottomMargin`` have been removed. Instead a ``windowingMode``
143153
with value of *defer*, *full* or *none* and ``overscanCount`` have been added to manage the rendering
144154
mode.
155+
* Added the property ``sharedModel`` to the interface ``NotebookModel.IOptions``.
156+
* The method ``NotebookModelFactory.createNew`` receives a parameter ``NotebookModelFactory.IModelOptions``.
145157
- ``@jupyterlab/rendermime`` from 3.x to 4.x
146158
The markdown parser has been extracted to its own plugin ``@jupyterlab/markedparser-extension:plugin``
147159
that provides a new token ``IMarkdownParser`` (defined in ``@jupyterlab/rendermime``).
@@ -151,6 +163,7 @@ bumped their major version (following semver convention). We want to point out p
151163
the constructor if needed by the renderer factory.
152164
- ``@jupyterlab/services`` from 6.x to 7.x
153165
* Remove ``Contents.IDrive.modelDBFactory`` and ``Contents.IManager.getModelDBFactory``.
166+
* Added ``Contents.IDrive.sharedModelFactory`` and ``Contents.IManager.getsharedModelFactory``.
154167
- ``@jupyterlab/shared-models`` from 3.x to 4.x
155168
The ``createCellFromType`` function has been renamed to ``createCellModelFromSharedType``
156169
- ``@jupyterlab/statusbar`` from 3.x to 4.x

examples/cell/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"clean": "rimraf build"
88
},
99
"dependencies": {
10-
"@jupyter/ydoc": "~0.2.2",
10+
"@jupyter/ydoc": "^0.3.0",
1111
"@jupyterlab/application": "^4.0.0-alpha.17",
1212
"@jupyterlab/apputils": "^4.0.0-alpha.17",
1313
"@jupyterlab/cells": "^4.0.0-alpha.17",

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@
105105
"@lumino/disposable": "^2.0.0-alpha.6",
106106
"@lumino/signaling": "^2.0.0-alpha.6",
107107
"@types/react": "^17.0.0",
108-
"react": "^17.0.1"
108+
"react": "^17.0.1",
109+
"yjs": "^13.5.40"
109110
},
110111
"dependencies": {
111112
"@typescript-eslint/eslint-plugin": "~5.28.0",

packages/apputils-extension/src/workspacesplugin.ts

+6-12
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
DocumentWidget,
1515
IDocumentWidget
1616
} from '@jupyterlab/docregistry';
17-
import { FileBrowser, IFileBrowserFactory } from '@jupyterlab/filebrowser';
17+
import { IDefaultFileBrowser } from '@jupyterlab/filebrowser';
1818
import { Contents, Workspace, WorkspaceManager } from '@jupyterlab/services';
1919
import { IStateDB } from '@jupyterlab/statedb';
2020
import { ITranslator, nullTranslator } from '@jupyterlab/translation';
@@ -38,7 +38,7 @@ export const workspacesPlugin: JupyterFrontEndPlugin<void> = {
3838
id: '@jupyterlab/apputils-extension:workspaces',
3939
autoStart: true,
4040
requires: [
41-
IFileBrowserFactory,
41+
IDefaultFileBrowser,
4242
IWindowResolver,
4343
IStateDB,
4444
ITranslator,
@@ -47,7 +47,7 @@ export const workspacesPlugin: JupyterFrontEndPlugin<void> = {
4747
optional: [IRouter],
4848
activate: (
4949
app: JupyterFrontEnd,
50-
fbf: IFileBrowserFactory,
50+
fileBrowser: IDefaultFileBrowser,
5151
resolver: IWindowResolver,
5252
state: IStateDB,
5353
translator: ITranslator,
@@ -79,7 +79,7 @@ export const workspacesPlugin: JupyterFrontEndPlugin<void> = {
7979
execute: async () => {
8080
const data = app.serviceManager.workspaces.fetch(resolver.name);
8181
await Private.saveAs(
82-
fbf.defaultBrowser,
82+
fileBrowser,
8383
app.serviceManager.contents,
8484
data,
8585
state,
@@ -95,13 +95,7 @@ export const workspacesPlugin: JupyterFrontEndPlugin<void> = {
9595
const data = app.serviceManager.workspaces.fetch(resolver.name);
9696
const lastSave = (await state.fetch(LAST_SAVE_ID)) as string;
9797
if (lastSave === undefined) {
98-
await Private.saveAs(
99-
fbf.defaultBrowser,
100-
contents,
101-
data,
102-
state,
103-
translator
104-
);
98+
await Private.saveAs(fileBrowser, contents, data, state, translator);
10599
} else {
106100
await Private.save(lastSave, contents, data, state);
107101
}
@@ -146,7 +140,7 @@ namespace Private {
146140
* Default location is the current directory in the file browser
147141
*/
148142
export async function saveAs(
149-
browser: FileBrowser,
143+
browser: IDefaultFileBrowser,
150144
contents: Contents.IManager,
151145
data: Promise<Workspace.IWorkspace>,
152146
state: IStateDB,

packages/attachments/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"watch": "tsc -b --watch"
3737
},
3838
"dependencies": {
39-
"@jupyter/ydoc": "~0.2.2",
39+
"@jupyter/ydoc": "^0.3.0",
4040
"@jupyterlab/nbformat": "^4.0.0-alpha.17",
4141
"@jupyterlab/observables": "^5.0.0-alpha.17",
4242
"@jupyterlab/rendermime": "^4.0.0-alpha.17",

packages/cells/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"watch": "tsc -b --watch"
4343
},
4444
"dependencies": {
45-
"@jupyter/ydoc": "~0.2.2",
45+
"@jupyter/ydoc": "^0.3.0",
4646
"@jupyterlab/apputils": "^4.0.0-alpha.17",
4747
"@jupyterlab/attachments": "^4.0.0-alpha.17",
4848
"@jupyterlab/codeeditor": "^4.0.0-alpha.17",

packages/cells/src/model.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ export class CodeCellModel extends CellModel implements ICodeCellModel {
689689
*/
690690
private _onSharedModelChanged(
691691
slot: ISharedCodeCell,
692-
change: CellChange<nbformat.ICodeCellMetadata>
692+
change: CellChange
693693
): void {
694694
if (change.outputsChange) {
695695
globalModelDBMutex(() => {

packages/codeeditor/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"watch": "tsc -b --watch"
4242
},
4343
"dependencies": {
44-
"@jupyter/ydoc": "~0.2.2",
44+
"@jupyter/ydoc": "^0.3.0",
4545
"@jupyterlab/coreutils": "^6.0.0-alpha.17",
4646
"@jupyterlab/nbformat": "^4.0.0-alpha.17",
4747
"@jupyterlab/observables": "^5.0.0-alpha.17",

packages/codemirror/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"@codemirror/search": "^6.0.0",
6060
"@codemirror/state": "^6.0.0",
6161
"@codemirror/view": "^6.0.0",
62-
"@jupyter/ydoc": "~0.2.2",
62+
"@jupyter/ydoc": "^0.3.0",
6363
"@jupyterlab/codeeditor": "^4.0.0-alpha.17",
6464
"@jupyterlab/coreutils": "^6.0.0-alpha.17",
6565
"@jupyterlab/documentsearch": "^4.0.0-alpha.17",

packages/completer/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"watch": "tsc -b --watch"
4545
},
4646
"dependencies": {
47-
"@jupyter/ydoc": "~0.2.2",
47+
"@jupyter/ydoc": "^0.3.0",
4848
"@jupyterlab/apputils": "^4.0.0-alpha.17",
4949
"@jupyterlab/codeeditor": "^4.0.0-alpha.17",
5050
"@jupyterlab/coreutils": "^6.0.0-alpha.17",

packages/console-extension/src/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
} from '@jupyterlab/codeeditor';
3131
import { ICompletionProviderManager } from '@jupyterlab/completer';
3232
import { ConsolePanel, IConsoleTracker } from '@jupyterlab/console';
33-
import { IFileBrowserFactory } from '@jupyterlab/filebrowser';
33+
import { IDefaultFileBrowser } from '@jupyterlab/filebrowser';
3434
import { ILauncher } from '@jupyterlab/launcher';
3535
import { IMainMenu } from '@jupyterlab/mainmenu';
3636
import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
@@ -109,7 +109,7 @@ const tracker: JupyterFrontEndPlugin<IConsoleTracker> = {
109109
],
110110
optional: [
111111
ILayoutRestorer,
112-
IFileBrowserFactory,
112+
IDefaultFileBrowser,
113113
IMainMenu,
114114
ICommandPalette,
115115
ILauncher,
@@ -241,7 +241,7 @@ async function activateConsole(
241241
settingRegistry: ISettingRegistry,
242242
translator: ITranslator,
243243
restorer: ILayoutRestorer | null,
244-
browserFactory: IFileBrowserFactory | null,
244+
filebrowser: IDefaultFileBrowser | null,
245245
mainMenu: IMainMenu | null,
246246
palette: ICommandPalette | null,
247247
launcher: ILauncher | null,
@@ -600,7 +600,7 @@ async function activateConsole(
600600
const basePath =
601601
((args['basePath'] as string) ||
602602
(args['cwd'] as string) ||
603-
browserFactory?.defaultBrowser.model.path) ??
603+
filebrowser?.model.path) ??
604604
'';
605605
return createConsole({ basePath, ...args });
606606
}

packages/console/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"watch": "tsc -b --watch"
4343
},
4444
"dependencies": {
45-
"@jupyter/ydoc": "~0.2.2",
45+
"@jupyter/ydoc": "^0.3.0",
4646
"@jupyterlab/apputils": "^4.0.0-alpha.17",
4747
"@jupyterlab/cells": "^4.0.0-alpha.17",
4848
"@jupyterlab/codeeditor": "^4.0.0-alpha.17",

packages/debugger/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"dependencies": {
5151
"@codemirror/state": "^6.0.0",
5252
"@codemirror/view": "^6.0.0",
53-
"@jupyter/ydoc": "~0.2.2",
53+
"@jupyter/ydoc": "^0.3.0",
5454
"@jupyterlab/application": "^4.0.0-alpha.17",
5555
"@jupyterlab/apputils": "^4.0.0-alpha.17",
5656
"@jupyterlab/cells": "^4.0.0-alpha.17",

packages/docmanager-extension/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
"@jupyterlab/apputils": "^4.0.0-alpha.17",
4242
"@jupyterlab/coreutils": "^6.0.0-alpha.17",
4343
"@jupyterlab/docmanager": "^4.0.0-alpha.17",
44-
"@jupyterlab/docprovider": "^4.0.0-alpha.17",
4544
"@jupyterlab/docregistry": "^4.0.0-alpha.17",
4645
"@jupyterlab/services": "^7.0.0-alpha.17",
4746
"@jupyterlab/settingregistry": "^4.0.0-alpha.17",

packages/docmanager-extension/src/index.tsx

+1-10
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import {
3333
renameDialog,
3434
SavingStatus
3535
} from '@jupyterlab/docmanager';
36-
import { IDocumentProviderFactory } from '@jupyterlab/docprovider';
3736
import { DocumentRegistry, IDocumentWidget } from '@jupyterlab/docregistry';
3837
import { Contents, Kernel } from '@jupyterlab/services';
3938
import { ISettingRegistry } from '@jupyterlab/settingregistry';
@@ -164,20 +163,13 @@ const manager: JupyterFrontEndPlugin<IDocumentManager> = {
164163
id: '@jupyterlab/docmanager-extension:manager',
165164
provides: IDocumentManager,
166165
requires: [IDocumentWidgetOpener],
167-
optional: [
168-
ITranslator,
169-
ILabStatus,
170-
ISessionContextDialogs,
171-
IDocumentProviderFactory,
172-
JupyterLab.IInfo
173-
],
166+
optional: [ITranslator, ILabStatus, ISessionContextDialogs, JupyterLab.IInfo],
174167
activate: (
175168
app: JupyterFrontEnd,
176169
widgetOpener: IDocumentWidgetOpener,
177170
translator: ITranslator | null,
178171
status: ILabStatus | null,
179172
sessionDialogs: ISessionContextDialogs | null,
180-
docProviderFactory: IDocumentProviderFactory | null,
181173
info: JupyterLab.IInfo | null
182174
) => {
183175
const { serviceManager: manager, docRegistry: registry } = app;
@@ -191,7 +183,6 @@ const manager: JupyterFrontEndPlugin<IDocumentManager> = {
191183
setBusy: (status && (() => status.setBusy())) ?? undefined,
192184
sessionDialogs: sessionDialogs || undefined,
193185
translator: translator ?? nullTranslator,
194-
docProviderFactory: docProviderFactory ?? undefined,
195186
isConnectedCallback: () => {
196187
if (info) {
197188
return info.isConnected;

packages/docmanager-extension/tsconfig.json

-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
{
1919
"path": "../docmanager"
2020
},
21-
{
22-
"path": "../docprovider"
23-
},
2421
{
2522
"path": "../docregistry"
2623
},

packages/docmanager/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
"dependencies": {
4444
"@jupyterlab/apputils": "^4.0.0-alpha.17",
4545
"@jupyterlab/coreutils": "^6.0.0-alpha.17",
46-
"@jupyterlab/docprovider": "^4.0.0-alpha.17",
4746
"@jupyterlab/docregistry": "^4.0.0-alpha.17",
4847
"@jupyterlab/services": "^7.0.0-alpha.17",
4948
"@jupyterlab/statusbar": "^4.0.0-alpha.17",

0 commit comments

Comments
 (0)