Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Async Contents Manager detection #1261

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Jupytext ChangeLog
==================

1.16.4 (2024-07-12)
-------------------

**Fixed**
- We use `asyncio.iscoroutinefunction` to determine whether the current contents manager is sync or async ([#1260](https://github.com/mwouts/jupytext/issues/1260))


1.16.3 (2024-07-09)
-------------------

Expand Down
38 changes: 14 additions & 24 deletions jupyterlab/jupyterlab_jupytext/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""Jupyter server and lab extension entry points"""

import inspect

import jupyter_server
import asyncio

from jupytext.reraise import reraise

Expand All @@ -24,28 +22,20 @@ def load_jupyter_server_extension(app): # pragma: no cover
# The server extension call is too late!
# The contents manager was set at NotebookApp.init_configurables

# Get a list of all base classes and check if they contain AsyncContentsManager
# If possible, we derive a Jupytext CM from the current CM
base_class = app.contents_manager_class
parent_classes = inspect.getmro(base_class)
for parent_class in parent_classes:
if (
parent_class
== jupyter_server.services.contents.manager.AsyncContentsManager
):
app.log.warning(
"[Jupytext Server Extension] Async contents managers like {} "
"are not supported at the moment "
"(https://github.com/mwouts/jupytext/issues/1020). "
"We will derive a contents manager from LargeFileManager instead.".format(
parent_class.__name__
)
)
from jupyter_server.services.contents.largefilemanager import ( # noqa
LargeFileManager,
)

base_class = LargeFileManager
break
if asyncio.iscoroutinefunction(base_class.get):
app.log.warning(
"[Jupytext Server Extension] Async contents managers like {base_class.__name__} "
"are not supported at the moment "
"(https://github.com/mwouts/jupytext/issues/1020). "
"We will derive a contents manager from LargeFileManager instead."
)
from jupyter_server.services.contents.largefilemanager import ( # noqa
LargeFileManager,
)

base_class = LargeFileManager

app.log.info(
"[Jupytext Server Extension] Deriving a JupytextContentsManager "
Expand Down
2 changes: 1 addition & 1 deletion src/jupytext/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Jupytext's version number"""

__version__ = "1.16.3"
__version__ = "1.16.4"
Loading