jupyter-server-ydoc 1.0.0rc1__py3-none-any.whl → 1.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jupyter_server_ydoc/_version.py +1 -1
- jupyter_server_ydoc/pytest_plugin.py +17 -9
- jupyter_server_ydoc/test_utils.py +30 -0
- {jupyter_server_ydoc-1.0.0rc1.dist-info → jupyter_server_ydoc-1.0.1.dist-info}/METADATA +3 -3
- {jupyter_server_ydoc-1.0.0rc1.dist-info → jupyter_server_ydoc-1.0.1.dist-info}/RECORD +8 -8
- {jupyter_server_ydoc-1.0.0rc1.dist-info → jupyter_server_ydoc-1.0.1.dist-info}/WHEEL +1 -1
- {jupyter_server_ydoc-1.0.0rc1.data → jupyter_server_ydoc-1.0.1.data}/data/etc/jupyter/jupyter_server_config.d/jupyter_collaboration.json +0 -0
- {jupyter_server_ydoc-1.0.0rc1.dist-info → jupyter_server_ydoc-1.0.1.dist-info}/licenses/LICENSE +0 -0
jupyter_server_ydoc/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.0.
|
|
1
|
+
__version__ = "1.0.1"
|
|
@@ -9,14 +9,19 @@ from typing import Any
|
|
|
9
9
|
|
|
10
10
|
import nbformat
|
|
11
11
|
import pytest
|
|
12
|
+
from httpx_ws import aconnect_ws
|
|
12
13
|
from jupyter_server_ydoc.loaders import FileLoader
|
|
13
14
|
from jupyter_server_ydoc.rooms import DocumentRoom
|
|
14
15
|
from jupyter_server_ydoc.stores import SQLiteYStore
|
|
15
16
|
from jupyter_ydoc import YNotebook, YUnicode
|
|
16
17
|
from pycrdt_websocket import WebsocketProvider
|
|
17
|
-
from websockets import connect
|
|
18
18
|
|
|
19
|
-
from .test_utils import
|
|
19
|
+
from .test_utils import (
|
|
20
|
+
FakeContentsManager,
|
|
21
|
+
FakeEventLogger,
|
|
22
|
+
FakeFileIDManager,
|
|
23
|
+
Websocket,
|
|
24
|
+
)
|
|
20
25
|
|
|
21
26
|
|
|
22
27
|
@pytest.fixture
|
|
@@ -126,8 +131,8 @@ def rtc_fetch_session(jp_fetch):
|
|
|
126
131
|
@pytest.fixture
|
|
127
132
|
def rtc_connect_awareness_client(jp_http_port, jp_base_url):
|
|
128
133
|
async def _inner(room_id: str) -> Any:
|
|
129
|
-
return
|
|
130
|
-
f"
|
|
134
|
+
return aconnect_ws(
|
|
135
|
+
f"http://127.0.0.1:{jp_http_port}{jp_base_url}api/collaboration/room/{room_id}"
|
|
131
136
|
)
|
|
132
137
|
|
|
133
138
|
return _inner
|
|
@@ -138,8 +143,12 @@ def rtc_connect_doc_client(jp_http_port, jp_base_url, rtc_fetch_session):
|
|
|
138
143
|
async def _inner(format: str, type: str, path: str) -> Any:
|
|
139
144
|
resp = await rtc_fetch_session(format, type, path)
|
|
140
145
|
data = json.loads(resp.body.decode("utf-8"))
|
|
141
|
-
|
|
142
|
-
|
|
146
|
+
room_name = f"{data['format']}:{data['type']}:{data['fileId']}"
|
|
147
|
+
return (
|
|
148
|
+
aconnect_ws(
|
|
149
|
+
f"http://127.0.0.1:{jp_http_port}{jp_base_url}api/collaboration/room/{room_name}?sessionId={data['sessionId']}"
|
|
150
|
+
),
|
|
151
|
+
room_name,
|
|
143
152
|
)
|
|
144
153
|
|
|
145
154
|
return _inner
|
|
@@ -162,9 +171,8 @@ def rtc_add_doc_to_store(rtc_connect_doc_client):
|
|
|
162
171
|
|
|
163
172
|
doc.observe(_on_document_change)
|
|
164
173
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
):
|
|
174
|
+
websocket, room_name = await rtc_connect_doc_client(format, type, path)
|
|
175
|
+
async with websocket as ws, WebsocketProvider(doc.ydoc, Websocket(ws, room_name)):
|
|
168
176
|
await event.wait()
|
|
169
177
|
await sleep(0.1)
|
|
170
178
|
|
|
@@ -6,6 +6,7 @@ from __future__ import annotations
|
|
|
6
6
|
from datetime import datetime
|
|
7
7
|
from typing import Any
|
|
8
8
|
|
|
9
|
+
from anyio import Lock
|
|
9
10
|
from jupyter_server import _tz as tz
|
|
10
11
|
|
|
11
12
|
|
|
@@ -55,3 +56,32 @@ class FakeContentsManager:
|
|
|
55
56
|
class FakeEventLogger:
|
|
56
57
|
def emit(self, schema_id: str, data: dict) -> None:
|
|
57
58
|
print(data)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class Websocket:
|
|
62
|
+
def __init__(self, websocket: Any, path: str):
|
|
63
|
+
self._websocket = websocket
|
|
64
|
+
self._path = path
|
|
65
|
+
self._send_lock = Lock()
|
|
66
|
+
|
|
67
|
+
@property
|
|
68
|
+
def path(self) -> str:
|
|
69
|
+
return self._path
|
|
70
|
+
|
|
71
|
+
def __aiter__(self):
|
|
72
|
+
return self
|
|
73
|
+
|
|
74
|
+
async def __anext__(self) -> bytes:
|
|
75
|
+
try:
|
|
76
|
+
message = await self.recv()
|
|
77
|
+
except Exception:
|
|
78
|
+
raise StopAsyncIteration()
|
|
79
|
+
return message
|
|
80
|
+
|
|
81
|
+
async def send(self, message: bytes) -> None:
|
|
82
|
+
async with self._send_lock:
|
|
83
|
+
await self._websocket.send_bytes(message)
|
|
84
|
+
|
|
85
|
+
async def recv(self) -> bytes:
|
|
86
|
+
b = await self._websocket.receive_bytes()
|
|
87
|
+
return bytes(b)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: jupyter-server-ydoc
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.1
|
|
4
4
|
Summary: jupyter-server extension integrating collaborative shared models.
|
|
5
5
|
Author-email: Jupyter Development Team <jupyter@googlegroups.com>
|
|
6
6
|
License: # Licensing terms
|
|
@@ -62,7 +62,6 @@ License: # Licensing terms
|
|
|
62
62
|
|
|
63
63
|
# Copyright (c) Jupyter Development Team.
|
|
64
64
|
# Distributed under the terms of the Modified BSD License.
|
|
65
|
-
License-File: LICENSE
|
|
66
65
|
Classifier: Framework :: Jupyter
|
|
67
66
|
Classifier: Intended Audience :: Developers
|
|
68
67
|
Classifier: Intended Audience :: Science/Research
|
|
@@ -83,13 +82,14 @@ Requires-Dist: jupyter-ydoc<4.0.0,>=2.1.2
|
|
|
83
82
|
Requires-Dist: pycrdt
|
|
84
83
|
Requires-Dist: pycrdt-websocket<0.16.0,>=0.15.0
|
|
85
84
|
Provides-Extra: test
|
|
85
|
+
Requires-Dist: anyio; extra == 'test'
|
|
86
86
|
Requires-Dist: coverage; extra == 'test'
|
|
87
|
+
Requires-Dist: httpx-ws>=0.5.2; extra == 'test'
|
|
87
88
|
Requires-Dist: importlib-metadata>=4.8.3; (python_version < '3.10') and extra == 'test'
|
|
88
89
|
Requires-Dist: jupyter-server-fileid[test]; extra == 'test'
|
|
89
90
|
Requires-Dist: jupyter-server[test]>=2.4.0; extra == 'test'
|
|
90
91
|
Requires-Dist: pytest-cov; extra == 'test'
|
|
91
92
|
Requires-Dist: pytest>=7.0; extra == 'test'
|
|
92
|
-
Requires-Dist: websockets; extra == 'test'
|
|
93
93
|
Description-Content-Type: text/markdown
|
|
94
94
|
|
|
95
95
|
# jupyter-server-ydoc
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
jupyter_server_ydoc/__init__.py,sha256=B8H7XLhzgrTCQD8304Lx91FYXslwabsnV9OuYu4M4Hw,346
|
|
2
|
-
jupyter_server_ydoc/_version.py,sha256=
|
|
2
|
+
jupyter_server_ydoc/_version.py,sha256=d4QHYmS_30j0hPN8NmNPnQ_Z0TphDRbu4MtQj9cT9e8,22
|
|
3
3
|
jupyter_server_ydoc/app.py,sha256=8vOKWLYa4OKu8Pw24TLWtbgs2SfH0_R64dPrErdWyQM,7739
|
|
4
4
|
jupyter_server_ydoc/handlers.py,sha256=xfcTzrOV08wJVIwxHhp9DdVH3ogEY5E_ktLpzBXV5qE,24016
|
|
5
5
|
jupyter_server_ydoc/loaders.py,sha256=TijilImdgYk9K91cXEIP_DzkOr6phSddwQFpLI5l_RA,10564
|
|
6
|
-
jupyter_server_ydoc/pytest_plugin.py,sha256=
|
|
6
|
+
jupyter_server_ydoc/pytest_plugin.py,sha256=eWAleH6Plh7Aiqv_Res8b0aFmd6C0n-D1j4p1KuE0PA,6983
|
|
7
7
|
jupyter_server_ydoc/rooms.py,sha256=szOAfMldhQIrmVpqoF75O0_KXY54X_TrzJz6vpjR6kE,12254
|
|
8
8
|
jupyter_server_ydoc/stores.py,sha256=_5J6eNs3R5Tv88PCc-GGuszxQstfvNoBCYABqzBzJXA,1004
|
|
9
|
-
jupyter_server_ydoc/test_utils.py,sha256=
|
|
9
|
+
jupyter_server_ydoc/test_utils.py,sha256=utUwB5FThc_SCQshhUbLNih9GUa5qBcmMgU6-jx0ZnA,2275
|
|
10
10
|
jupyter_server_ydoc/utils.py,sha256=yQC-uRdLyFDYbt2Zms_hA1HyjlwznMK4yQ3_FUwTlnQ,2013
|
|
11
11
|
jupyter_server_ydoc/websocketserver.py,sha256=7fLPJcWczD-4R_-LXtfvNxM_pUXFasZWDmT4RIrOQHE,5150
|
|
12
12
|
jupyter_server_ydoc/events/awareness.yaml,sha256=9isoK58uue7lqMnlHqyfQt29z16Otkh14oRe1k5vbKM,753
|
|
13
13
|
jupyter_server_ydoc/events/session.yaml,sha256=A7Wt7czyx38MXp5fpDbH7HLS0QNkeOqaEhHdP2x-0Mo,1594
|
|
14
|
-
jupyter_server_ydoc-1.0.
|
|
15
|
-
jupyter_server_ydoc-1.0.
|
|
16
|
-
jupyter_server_ydoc-1.0.
|
|
17
|
-
jupyter_server_ydoc-1.0.
|
|
18
|
-
jupyter_server_ydoc-1.0.
|
|
14
|
+
jupyter_server_ydoc-1.0.1.data/data/etc/jupyter/jupyter_server_config.d/jupyter_collaboration.json,sha256=0thh2hJUxAKkZSmneJMG0U6QJRjdM6zGlwrTedEt-Jk,94
|
|
15
|
+
jupyter_server_ydoc-1.0.1.dist-info/METADATA,sha256=cKECBcDzWlzL8RGeLp405E61wVBiW4UfxWEb6zwp_i0,5031
|
|
16
|
+
jupyter_server_ydoc-1.0.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
17
|
+
jupyter_server_ydoc-1.0.1.dist-info/licenses/LICENSE,sha256=mhO0ZW9EiWOPg0dUgB-lNbJ0CGwRmTdbeAg_se1SOnY,2833
|
|
18
|
+
jupyter_server_ydoc-1.0.1.dist-info/RECORD,,
|
|
File without changes
|
{jupyter_server_ydoc-1.0.0rc1.dist-info → jupyter_server_ydoc-1.0.1.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|