Skip to content

Commit

Permalink
More renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Apr 12, 2024
1 parent 7f16939 commit 6387284
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions docs/source/developer/python_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
Python API
==========

``jupyter_collaboration`` instantiates :any:`YDocExtension` and stores it under ``serverapp.settings`` dictionary, under the ``"jupyter_collaboration"`` key.
``jupyter_server_ydoc`` instantiates :any:`YDocExtension` and stores it under ``serverapp.settings`` dictionary, under the ``"jupyter_server_ydoc"`` key.
This instance can be used in other extensions to access the public API methods.

For example, to access a read-only view of the shared notebook model in your jupyter-server extension, you can use the :any:`get_document` method:

.. code-block::
collaboration = serverapp.settings["jupyter_collaboration"]
collaboration = serverapp.settings["jupyter_server_ydoc"]
document = collaboration.get_document(
path='Untitled.ipynb',
content_type="notebook",
Expand All @@ -23,10 +23,10 @@ For example, to access a read-only view of the shared notebook model in your jup
API Reference
-------------

.. automodule:: jupyter_collaboration.app
.. automodule:: jupyter_server_ydoc.app
:members:
:inherited-members:

.. automodule:: jupyter_collaboration.handlers
.. automodule:: jupyter_server_ydoc.handlers
:members:
:inherited-members:
2 changes: 1 addition & 1 deletion projects/jupyter-server-ydoc/jupyter_server_ydoc/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


class YDocExtension(ExtensionApp):
name = "jupyter_collaboration"
name = "jupyter_server_ydoc"
app_name = "Collaboration"
description = """
Enables Real Time Collaboration in JupyterLab
Expand Down
18 changes: 9 additions & 9 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


def test_default_settings(jp_serverapp):
settings = jp_serverapp.web_app.settings["jupyter_collaboration_config"]
settings = jp_serverapp.web_app.settings["jupyter_server_ydoc_config"]

assert settings["disable_rtc"] is False
assert settings["file_poll_interval"] == 1
Expand All @@ -21,7 +21,7 @@ def test_settings_should_disable_rtc(jp_configurable_serverapp):
argv = ["--YDocExtension.disable_rtc=True"]

app = jp_configurable_serverapp(argv=argv)
settings = app.web_app.settings["jupyter_collaboration_config"]
settings = app.web_app.settings["jupyter_server_ydoc_config"]

assert settings["disable_rtc"] is True

Expand All @@ -30,7 +30,7 @@ def test_settings_should_change_file_poll(jp_configurable_serverapp):
argv = ["--YDocExtension.file_poll_interval=2"]

app = jp_configurable_serverapp(argv=argv)
settings = app.web_app.settings["jupyter_collaboration_config"]
settings = app.web_app.settings["jupyter_server_ydoc_config"]

assert settings["file_poll_interval"] == 2

Expand All @@ -39,7 +39,7 @@ def test_settings_should_change_document_cleanup(jp_configurable_serverapp):
argv = ["--YDocExtension.document_cleanup_delay=10"]

app = jp_configurable_serverapp(argv=argv)
settings = app.web_app.settings["jupyter_collaboration_config"]
settings = app.web_app.settings["jupyter_server_ydoc_config"]

assert settings["document_cleanup_delay"] == 10

Expand All @@ -48,24 +48,24 @@ def test_settings_should_change_save_delay(jp_configurable_serverapp):
argv = ["--YDocExtension.document_save_delay=10"]

app = jp_configurable_serverapp(argv=argv)
settings = app.web_app.settings["jupyter_collaboration_config"]
settings = app.web_app.settings["jupyter_server_ydoc_config"]

assert settings["document_save_delay"] == 10


def test_settings_should_change_ystore_class(jp_configurable_serverapp):
argv = ["--YDocExtension.ystore_class=jupyter_collaboration.stores.TempFileYStore"]
argv = ["--YDocExtension.ystore_class=jupyter_server_ydoc.stores.TempFileYStore"]

app = jp_configurable_serverapp(argv=argv)
settings = app.web_app.settings["jupyter_collaboration_config"]
settings = app.web_app.settings["jupyter_server_ydoc_config"]

assert settings["ystore_class"] == TempFileYStore


@pytest.mark.parametrize("copy", [True, False])
async def test_get_document_file(rtc_create_file, jp_serverapp, copy):
path, content = await rtc_create_file("test.txt", "test", store=True)
collaboration = jp_serverapp.web_app.settings["jupyter_collaboration"]
collaboration = jp_serverapp.web_app.settings["jupyter_server_ydoc_config"]
document = await collaboration.get_document(
path=path, content_type="file", file_format="text", copy=copy
)
Expand All @@ -77,7 +77,7 @@ async def test_get_document_file_copy_is_independent(
rtc_create_file, jp_serverapp, rtc_fetch_session
):
path, content = await rtc_create_file("test.txt", "test", store=True)
collaboration = jp_serverapp.web_app.settings["jupyter_collaboration"]
collaboration = jp_serverapp.web_app.settings["jupyter_server_ydoc_config"]
document = await collaboration.get_document(
path=path, content_type="file", file_format="text", copy=True
)
Expand Down

0 comments on commit 6387284

Please sign in to comment.