Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-jupyter-ydoc for openSUSE:Factory checked in at 2025-01-31 16:02:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-jupyter-ydoc (Old) and /work/SRC/openSUSE:Factory/.python-jupyter-ydoc.new.2316 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-jupyter-ydoc" Fri Jan 31 16:02:24 2025 rev:12 rq:1241240 version:3.0.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-jupyter-ydoc/python-jupyter-ydoc.changes 2024-12-06 14:25:52.375201018 +0100 +++ /work/SRC/openSUSE:Factory/.python-jupyter-ydoc.new.2316/python-jupyter-ydoc.changes 2025-01-31 16:02:47.279982958 +0100 @@ -1,0 +2,9 @@ +Wed Jan 29 15:57:14 UTC 2025 - Ben Greiner <c...@bnavigator.de> + +- Update to 3.0.3 + * Fix missing nbformat version #304 (@fcollonval) + * Increase pycrdt compatible version range #307 (@davidbrochart) + * Fix stream output #294 (@davidbrochart) + * Fix tests #288 (@davidbrochart) + +------------------------------------------------------------------- Old: ---- jupyter_ydoc-3.0.0-gh.tar.gz jupyter_ydoc-3.0.0.tar.gz New: ---- jupyter_ydoc-3.0.3-gh.tar.gz jupyter_ydoc-3.0.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-jupyter-ydoc.spec ++++++ --- /var/tmp/diff_new_pack.aOnuBa/_old 2025-01-31 16:02:47.812004301 +0100 +++ /var/tmp/diff_new_pack.aOnuBa/_new 2025-01-31 16:02:47.812004301 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-jupyter-ydoc # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: python-jupyter-ydoc -Version: 3.0.0 +Version: 3.0.3 Release: 0 Summary: Document structures for collaborative editing using Ypy License: BSD-3-Clause @@ -36,16 +36,17 @@ BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: (python-importlib-metadata >= 3.6 if python-base < 3.10) -Requires: (python-pycrdt >= 0.10.1 with python-pycrdt < 0.11) +Requires: (python-pycrdt >= 0.10.1 with python-pycrdt < 0.13) Provides: python-jupyter_ydoc = %{version}-%{release} BuildArch: noarch # SECTION test BuildRequires: %{python_module importlib-metadata >= 3.6 if %python-base < 3.10} -BuildRequires: %{python_module pycrdt >= 0.10.1 with %python-pycrdt < 0.11} +BuildRequires: %{python_module httpx-ws >= 0.5.2} +BuildRequires: %{python_module hypercorn >= 0.16} +BuildRequires: %{python_module pycrdt >= 0.10.1 with %python-pycrdt < 0.13} BuildRequires: %{python_module pycrdt-websocket >= 0.15.0 with %python-pycrdt-websocket < 0.16} BuildRequires: %{python_module pytest-asyncio} BuildRequires: %{python_module pytest} -BuildRequires: %{python_module websockets >= 10.0} BuildRequires: nodejs BuildRequires: procps BuildRequires: yarn ++++++ jupyter_ydoc-3.0.0-gh.tar.gz -> jupyter_ydoc-3.0.3-gh.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_ydoc-3.0.0/.github/workflows/test.yml new/jupyter_ydoc-3.0.3/.github/workflows/test.yml --- old/jupyter_ydoc-3.0.0/.github/workflows/test.yml 2024-10-29 14:28:59.000000000 +0100 +++ new/jupyter_ydoc-3.0.3/.github/workflows/test.yml 2025-01-28 09:43:10.000000000 +0100 @@ -41,30 +41,24 @@ steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Install Miniconda - uses: conda-incubator/setup-miniconda@v3 + - name: Install mamba + uses: mamba-org/setup-micromamba@v2 with: - miniforge-variant: Mambaforge - miniforge-version: latest - python-version: "3.11" - + environment-name: jupyter_ydoc - name: Install dependencies run: | - mamba install pip nodejs=18 + micromamba install pip nodejs=18 pip install ".[test]" - - name: Build JavaScript assets working-directory: javascript run: | yarn yarn build - - name: Linter check if: ${{ !contains(matrix.os, 'windows') }} working-directory: javascript run: | yarn lint:check - - name: Integrity check if: ${{ !contains(matrix.os, 'windows') }} working-directory: javascript @@ -76,13 +70,11 @@ echo "Integrity test failed; please run locally 'yarn integrity' and commit the changes" exit 1 fi - - name: Run JS tests working-directory: javascript run: | yarn build:test yarn test:cov - - name: Run Python tests run: | python -m pytest -v diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_ydoc-3.0.0/.pre-commit-config.yaml new/jupyter_ydoc-3.0.3/.pre-commit-config.yaml --- old/jupyter_ydoc-3.0.0/.pre-commit-config.yaml 2024-10-29 14:28:59.000000000 +0100 +++ new/jupyter_ydoc-3.0.3/.pre-commit-config.yaml 2025-01-28 09:43:10.000000000 +0100 @@ -17,7 +17,7 @@ exclude: ^\.yarn - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.1 + rev: v0.9.3 hooks: - id: ruff args: [--fix, --show-fixes] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_ydoc-3.0.0/CHANGELOG.md new/jupyter_ydoc-3.0.3/CHANGELOG.md --- old/jupyter_ydoc-3.0.0/CHANGELOG.md 2024-10-29 14:28:59.000000000 +0100 +++ new/jupyter_ydoc-3.0.3/CHANGELOG.md 2025-01-28 09:43:10.000000000 +0100 @@ -2,6 +2,57 @@ <!-- <START NEW CHANGELOG ENTRY> --> +## 3.0.3 + +([Full Changelog](https://github.com/jupyter-server/jupyter_ydoc/compare/@jupyter/ydoc@3.0.2...678a0a483421cbcb10cd56f4948dc944ac976555)) + +### Bugs fixed + +- Fix missing nbformat version [#304](https://github.com/jupyter-server/jupyter_ydoc/pull/304) ([@fcollonval](https://github.com/fcollonval)) + +### Maintenance and upkeep improvements + +- Increase pycrdt compatible version range [#307](https://github.com/jupyter-server/jupyter_ydoc/pull/307) ([@davidbrochart](https://github.com/davidbrochart)) +- Use micromamba in CI [#301](https://github.com/jupyter-server/jupyter_ydoc/pull/301) ([@davidbrochart](https://github.com/davidbrochart)) + +### Contributors to this release + +([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_ydoc/graphs/contributors?from=2024-12-02&to=2025-01-28&type=c)) + +[@davidbrochart](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Adavidbrochart+updated%3A2024-12-02..2025-01-28&type=Issues) | [@fcollonval](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Afcollonval+updated%3A2024-12-02..2025-01-28&type=Issues) | [@pre-commit-ci](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Apre-commit-ci+updated%3A2024-12-02..2025-01-28&type=Issues) + +<!-- <END NEW CHANGELOG ENTRY> --> + +## 3.0.2 + +([Full Changelog](https://github.com/jupyter-server/jupyter_ydoc/compare/@jupyter/ydoc@3.0.1...db70566443ffc92e9bf62e2064e9b928ca2e96d7)) + +### Bugs fixed + +- Fix stream output [#294](https://github.com/jupyter-server/jupyter_ydoc/pull/294) ([@davidbrochart](https://github.com/davidbrochart)) + +### Maintenance and upkeep improvements + +### Contributors to this release + +([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_ydoc/graphs/contributors?from=2024-11-18&to=2024-12-02&type=c)) + +[@davidbrochart](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Adavidbrochart+updated%3A2024-11-18..2024-12-02&type=Issues) | [@pre-commit-ci](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Apre-commit-ci+updated%3A2024-11-18..2024-12-02&type=Issues) + +## 3.0.1 + +([Full Changelog](https://github.com/jupyter-server/jupyter_ydoc/compare/@jupyter/ydoc@3.0.0...2ed6216e488db36c2757390c96195db9909e7908)) + +### Maintenance and upkeep improvements + +- Fix tests [#288](https://github.com/jupyter-server/jupyter_ydoc/pull/288) ([@davidbrochart](https://github.com/davidbrochart)) + +### Contributors to this release + +([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_ydoc/graphs/contributors?from=2024-10-29&to=2024-11-18&type=c)) + +[@davidbrochart](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Adavidbrochart+updated%3A2024-10-29..2024-11-18&type=Issues) | [@pre-commit-ci](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Apre-commit-ci+updated%3A2024-10-29..2024-11-18&type=Issues) + ## 3.0.0 ([Full Changelog](https://github.com/jupyter-server/jupyter_ydoc/compare/@jupyter/ydoc@2.0.1...8cf3b0f53bf763edf254e91fed65aaa7062e3250)) @@ -54,8 +105,6 @@ [@brichet](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Abrichet+updated%3A2023-12-26..2024-10-29&type=Issues) | [@davidbrochart](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Adavidbrochart+updated%3A2023-12-26..2024-10-29&type=Issues) | [@dependabot](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Adependabot+updated%3A2023-12-26..2024-10-29&type=Issues) | [@jtpio](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Ajtpio+updated%3A2023-12-26..2024-10-29&type=Issues) | [@krassowski](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Akrassowski+updated%3A2023-12-26..2024-10-29&type=Issues) | [@lumberbot-app](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Alumberbot-app+updated%3A2023-12-26..2024-10-29&type=Issues) | [@martinRenou](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3AmartinRenou+upda ted%3A2023-12-26..2024-10-29&type=Issues) | [@pre-commit-ci](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Apre-commit-ci+updated%3A2023-12-26..2024-10-29&type=Issues) | [@welcome](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Awelcome+updated%3A2023-12-26..2024-10-29&type=Issues) | [@Zsailer](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3AZsailer+updated%3A2023-12-26..2024-10-29&type=Issues) -<!-- <END NEW CHANGELOG ENTRY> --> - ## 3.0.0b0 ([Full Changelog](https://github.com/jupyter-server/jupyter_ydoc/compare/@jupyter/ydoc@3.0.0-a10...5a205d912bb399684a2886d4d323b77669f63eb8)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_ydoc-3.0.0/javascript/package.json new/jupyter_ydoc-3.0.3/javascript/package.json --- old/jupyter_ydoc-3.0.0/javascript/package.json 2024-10-29 14:28:59.000000000 +0100 +++ new/jupyter_ydoc-3.0.3/javascript/package.json 2025-01-28 09:43:10.000000000 +0100 @@ -1,6 +1,6 @@ { "name": "@jupyter/ydoc", - "version": "3.0.0", + "version": "3.0.3", "type": "module", "description": "Jupyter document structures for collaborative editing using YJS", "homepage": "https://github.com/jupyter-server/jupyter_ydoc", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_ydoc-3.0.0/jupyter_ydoc/ynotebook.py new/jupyter_ydoc-3.0.3/jupyter_ydoc/ynotebook.py --- old/jupyter_ydoc-3.0.0/jupyter_ydoc/ynotebook.py 2024-10-29 14:28:59.000000000 +0100 +++ new/jupyter_ydoc-3.0.3/jupyter_ydoc/ynotebook.py 2025-01-28 09:43:10.000000000 +0100 @@ -166,7 +166,12 @@ outputs = cell.get("outputs", []) for idx, output in enumerate(outputs): if output.get("output_type") == "stream": - output["text"] = Array(output.get("text", [])) + text = output.get("text", "") + if isinstance(text, str): + ytext = Text(text) + else: + ytext = Text("".join(text)) + output["text"] = ytext outputs[idx] = Map(output) cell["outputs"] = Array(outputs) cell["execution_state"] = "idle" @@ -197,7 +202,11 @@ cells = [] for i in range(len(self._ycells)): cell = self.get_cell(i) - if "id" in cell and meta["nbformat"] == 4 and meta["nbformat_minor"] <= 4: + if ( + "id" in cell + and int(meta.get("nbformat", 0)) == 4 + and int(meta.get("nbformat_minor", 0)) <= 4 + ): # strip cell IDs if we have notebook format 4.0-4.4 del cell["id"] if ( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_ydoc-3.0.0/pyproject.toml new/jupyter_ydoc-3.0.3/pyproject.toml --- old/jupyter_ydoc-3.0.0/pyproject.toml 2024-10-29 14:28:59.000000000 +0100 +++ new/jupyter_ydoc-3.0.3/pyproject.toml 2025-01-28 09:43:10.000000000 +0100 @@ -13,7 +13,7 @@ keywords = ["jupyter", "pycrdt", "yjs"] dependencies = [ "importlib_metadata >=3.6; python_version<'3.10'", - "pycrdt >=0.10.1,<0.11.0", + "pycrdt >=0.10.1,<0.13.0", ] [[project.authors]] @@ -30,7 +30,8 @@ "pre-commit", "pytest", "pytest-asyncio", - "websockets >=10.0", + "httpx-ws >=0.5.2", + "hypercorn >=0.16.0", "pycrdt-websocket >=0.15.0,<0.16.0", ] docs = [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_ydoc-3.0.0/tests/conftest.py new/jupyter_ydoc-3.0.3/tests/conftest.py --- old/jupyter_ydoc-3.0.0/tests/conftest.py 2024-10-29 14:28:59.000000000 +0100 +++ new/jupyter_ydoc-3.0.3/tests/conftest.py 2025-01-28 09:43:10.000000000 +0100 @@ -3,11 +3,15 @@ import json import subprocess +from functools import partial from pathlib import Path import pytest -from pycrdt_websocket import WebsocketServer -from websockets import serve +from anyio import Event, create_task_group +from hypercorn import Config +from hypercorn.asyncio import serve +from pycrdt_websocket import ASGIServer, WebsocketServer +from utils import ensure_server_running # workaround until these PRs are merged: # - https://github.com/yjs/y-websocket/pull/104 @@ -27,15 +31,26 @@ @pytest.fixture -async def yws_server(request): +async def yws_server(request, unused_tcp_port): try: - kwargs = request.param - except Exception: - kwargs = {} - websocket_server = WebsocketServer(**kwargs) - try: - async with websocket_server, serve(websocket_server.serve, "localhost", 1234): - yield websocket_server + async with create_task_group() as tg: + try: + kwargs = request.param + except Exception: + kwargs = {} + websocket_server = WebsocketServer(**kwargs) + app = ASGIServer(websocket_server) + config = Config() + config.bind = [f"localhost:{unused_tcp_port}"] + shutdown_event = Event() + async with websocket_server as websocket_server: + tg.start_soon( + partial(serve, app, config, shutdown_trigger=shutdown_event.wait, mode="asgi") + ) + await ensure_server_running("localhost", unused_tcp_port) + pytest.port = unused_tcp_port + yield unused_tcp_port, websocket_server + shutdown_event.set() except Exception: pass @@ -43,7 +58,7 @@ @pytest.fixture def yjs_client(request): client_id = request.param - p = subprocess.Popen(["node", f"{here / 'yjs_client_'}{client_id}.js"]) + p = subprocess.Popen(["node", f"{here / 'yjs_client_'}{client_id}.js", str(pytest.port)]) yield p p.terminate() try: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_ydoc-3.0.0/tests/test_pycrdt_yjs.py new/jupyter_ydoc-3.0.3/tests/test_pycrdt_yjs.py --- old/jupyter_ydoc-3.0.0/tests/test_pycrdt_yjs.py 2024-10-29 14:28:59.000000000 +0100 +++ new/jupyter_ydoc-3.0.3/tests/test_pycrdt_yjs.py 2025-01-28 09:43:10.000000000 +0100 @@ -6,9 +6,10 @@ import pytest from anyio import Event, create_task_group, move_on_after +from httpx_ws import aconnect_ws from pycrdt import Doc, Map from pycrdt_websocket import WebsocketProvider -from websockets import connect +from utils import Websocket from jupyter_ydoc import YNotebook from jupyter_ydoc.utils import cast_all @@ -61,10 +62,12 @@ @pytest.mark.asyncio @pytest.mark.parametrize("yjs_client", "0", indirect=True) async def test_ypy_yjs_0(yws_server, yjs_client): + port, _ = yws_server ydoc = Doc() ynotebook = YNotebook(ydoc) - async with connect("ws://localhost:1234/my-roomname") as websocket, WebsocketProvider( - ydoc, websocket + room_name = "my-roomname" + async with aconnect_ws(f"http://localhost:{port}/{room_name}") as websocket, WebsocketProvider( + ydoc, Websocket(websocket, room_name) ): nb = stringify_source(json.loads((files_dir / "nb0.ipynb").read_text())) ynotebook.source = nb @@ -77,15 +80,17 @@ @pytest.mark.asyncio @pytest.mark.parametrize("yjs_client", "1", indirect=True) async def test_ypy_yjs_1(yws_server, yjs_client): + port, _ = yws_server ydoc = Doc() ynotebook = YNotebook(ydoc) nb = stringify_source(json.loads((files_dir / "nb1.ipynb").read_text())) ynotebook.source = nb - async with connect("ws://localhost:1234/my-roomname") as websocket, WebsocketProvider( - ydoc, websocket + room_name = "my-roomname" + async with aconnect_ws(f"http://localhost:{port}/{room_name}") as websocket, WebsocketProvider( + ydoc, Websocket(websocket, room_name) ): output_text = ynotebook.ycells[0]["outputs"][0]["text"] - assert output_text.to_py() == ["Hello,"] + assert output_text.to_py() == "Hello," event = Event() def callback(_event): @@ -96,7 +101,7 @@ with move_on_after(10): await event.wait() - assert output_text.to_py() == ["Hello,", " World!"] + assert output_text.to_py() == "Hello,", " World!" def test_plotly_renderer(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_ydoc-3.0.0/tests/test_ydocs.py new/jupyter_ydoc-3.0.3/tests/test_ydocs.py --- old/jupyter_ydoc-3.0.0/tests/test_ydocs.py 2024-10-29 14:28:59.000000000 +0100 +++ new/jupyter_ydoc-3.0.3/tests/test_ydocs.py 2025-01-28 09:43:10.000000000 +0100 @@ -14,7 +14,6 @@ changes = [] def callback(topic, event): - print(topic, event) changes.append((topic, event)) yblob.observe(callback) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_ydoc-3.0.0/tests/utils.py new/jupyter_ydoc-3.0.3/tests/utils.py --- old/jupyter_ydoc-3.0.0/tests/utils.py 1970-01-01 01:00:00.000000000 +0100 +++ new/jupyter_ydoc-3.0.3/tests/utils.py 2025-01-28 09:43:10.000000000 +0100 @@ -0,0 +1,43 @@ +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. + +from anyio import Lock, connect_tcp + + +class Websocket: + def __init__(self, websocket, path: str): + self._websocket = websocket + self._path = path + self._send_lock = Lock() + + @property + def path(self) -> str: + return self._path + + def __aiter__(self): + return self + + async def __anext__(self) -> bytes: + try: + message = await self.recv() + except Exception: + raise StopAsyncIteration() + return message + + async def send(self, message: bytes): + async with self._send_lock: + await self._websocket.send_bytes(message) + + async def recv(self) -> bytes: + b = await self._websocket.receive_bytes() + return bytes(b) + + +async def ensure_server_running(host: str, port: int) -> None: + while True: + try: + await connect_tcp(host, port) + except OSError: + pass + else: + break diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_ydoc-3.0.0/tests/yjs_client_0.js new/jupyter_ydoc-3.0.3/tests/yjs_client_0.js --- old/jupyter_ydoc-3.0.0/tests/yjs_client_0.js 2024-10-29 14:28:59.000000000 +0100 +++ new/jupyter_ydoc-3.0.3/tests/yjs_client_0.js 2025-01-28 09:43:10.000000000 +0100 @@ -6,12 +6,13 @@ import { YNotebook } from '@jupyter/ydoc' import { WebsocketProvider } from 'y-websocket' +const port = process.argv[2] const notebook = new YNotebook() const ytest = notebook.ydoc.getMap('_test') import ws from 'ws' const wsProvider = new WebsocketProvider( - 'ws://localhost:1234', 'my-roomname', + `ws://127.0.0.1:${port}`, 'my-roomname', notebook.ydoc, { WebSocketPolyfill: ws } ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_ydoc-3.0.0/tests/yjs_client_1.js new/jupyter_ydoc-3.0.3/tests/yjs_client_1.js --- old/jupyter_ydoc-3.0.0/tests/yjs_client_1.js 2024-10-29 14:28:59.000000000 +0100 +++ new/jupyter_ydoc-3.0.3/tests/yjs_client_1.js 2025-01-28 09:43:10.000000000 +0100 @@ -7,17 +7,26 @@ import { WebsocketProvider } from 'y-websocket' import ws from 'ws' +const port = process.argv[2] const notebook = new YNotebook() const wsProvider = new WebsocketProvider( - 'ws://localhost:1234', 'my-roomname', + `ws://127.0.0.1:${port}`, 'my-roomname', notebook.ydoc, { WebSocketPolyfill: ws } ) -wsProvider.on('sync', (isSynced) => { +wsProvider.on('status', event => { + console.log(event.status) +}) + +notebook.changed.connect(() => { const cell = notebook.getCell(0) - const youtput = cell.youtputs.get(0) - const text = youtput.get('text') - text.insert(1, [' World!']) + if (cell) { + const youtput = cell.youtputs.get(0) + const text = youtput.get('text') + if (text.length === 1) { + text.insert(1, [' World!']) + } + } }) ++++++ jupyter_ydoc-3.0.0-gh.tar.gz -> jupyter_ydoc-3.0.3.tar.gz ++++++ ++++ 6003 lines of diff (skipped)