Description
Reproduce
Use a fresh installation on conda:
conda create --name py312 python=3.12
conda activate py312
# install as described in the package:
pip install jupyter-kernel-client # missing in instructions
pip install jupyter_nbmodel_client
# not sure if this is actually necessary
pip uninstall -y pycrdt datalayer_pycrdt
pip install datalayer_pycrdt
# start as described
jupyter lab --port 8888 --ServerApp.port_retries 0 --IdentityProvider.token MY_TOKEN --ServerApp.root_dir .
create test.ipynb notebook
run command to add and execute cell:
from jupyter_kernel_client import KernelClient
from jupyter_nbmodel_client import NbModelClient, get_jupyter_notebook_websocket_url
with KernelClient(server_url="http://localhost:8888", token="MY_TOKEN") as kernel:
ws_url = get_jupyter_notebook_websocket_url(
server_url="http://localhost:8888",
token="MY_TOKEN",
path="test.ipynb"
)
async with NbModelClient(ws_url) as notebook:
cell_index = notebook.add_code_cell("print('hello world')")
results = notebook.execute_cell(cell_index, kernel)
print(results)
assert results["status"] == "ok"
assert len(results["outputs"]) > 0
observe cell is updated in realtime.
Run a command to update nonexistent notebook:
from jupyter_kernel_client import KernelClient
from jupyter_nbmodel_client import NbModelClient, get_jupyter_notebook_websocket_url
with KernelClient(server_url="http://localhost:8888", token="MY_TOKEN") as kernel:
ws_url = get_jupyter_notebook_websocket_url(
server_url="http://localhost:8888",
token="MY_TOKEN",
path="nonexistent.ipynb"
)
async with NbModelClient(ws_url) as notebook:
cell_index = notebook.add_code_cell("print('hello world')")
results = notebook.execute_cell(cell_index, kernel)
print(results)
assert results["status"] == "ok"
assert len(results["outputs"]) > 0
error happens which is expected.
But now when I run snippet to update test.ipynb notebook, it wont reflect changes in realtime.
If I close and reopen notebook I see that changes are applied, but I don't see that is happening as I call the API.
Only way to make updates to happen in realtime again would be restarting jupyter.
This used to work fine in 0.6.0, but it is pretty old and is not compatible with recent version of jupyter-collaboration.
Expected behavior
Realtime updates should keep working.
Context
- Datalayer version:
jupyter_nbmodel_client 0.14.0
jupyter_kernel_client 0.8.0
- Operating System and version:
macos
- Browser and version:
chrome
Description
Reproduce
Use a fresh installation on conda:
create test.ipynb notebook
run command to add and execute cell:
observe cell is updated in realtime.
Run a command to update nonexistent notebook:
error happens which is expected.
But now when I run snippet to update test.ipynb notebook, it wont reflect changes in realtime.
If I close and reopen notebook I see that changes are applied, but I don't see that is happening as I call the API.
Only way to make updates to happen in realtime again would be restarting jupyter.
This used to work fine in 0.6.0, but it is pretty old and is not compatible with recent version of jupyter-collaboration.
Expected behavior
Realtime updates should keep working.
Context
jupyter_nbmodel_client 0.14.0
jupyter_kernel_client 0.8.0
macos
chrome