Skip to content

Commit

Permalink
Cap anyio < 3 for python < 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
mwakaba2 committed May 3, 2021
1 parent 02d2e8b commit eff9b0a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
7 changes: 6 additions & 1 deletion jupyter_server/services/contents/filecheckpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
)
from .fileio import AsyncFileManagerMixin, FileManagerMixin

from anyio.to_thread import run_sync
try:
from anyio.to_thread import run_sync
except ImportError:
# fallback on anyio v2 for python version < 3.7
from anyio import run_sync_in_worker_thread as run_sync

from jupyter_core.utils import ensure_dir_exists
from traitlets import Unicode

Expand Down
7 changes: 6 additions & 1 deletion jupyter_server/services/contents/fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
import os
import shutil

from anyio.to_thread import run_sync
try:
from anyio.to_thread import run_sync
except ImportError:
# fallback on anyio v2 for python version < 3.7
from anyio import run_sync_in_worker_thread as run_sync

from tornado.web import HTTPError

from jupyter_server.utils import (
Expand Down
7 changes: 6 additions & 1 deletion jupyter_server/services/contents/filemanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
import mimetypes
import nbformat

from anyio.to_thread import run_sync
try:
from anyio.to_thread import run_sync
except ImportError:
# fallback on anyio v2 for python version < 3.7
from anyio import run_sync_in_worker_thread as run_sync

from send2trash import send2trash
from tornado import web

Expand Down
7 changes: 6 additions & 1 deletion jupyter_server/services/contents/largefilemanager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
from anyio.to_thread import run_sync
try:
from anyio.to_thread import run_sync
except ImportError:
# fallback on anyio v2 for python version < 3.7
from anyio import run_sync_in_worker_thread as run_sync

from tornado import web
import base64
import os, io
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ install_requires =
terminado>=0.8.3
prometheus_client
pywin32>=1.0 ; sys_platform == 'win32'
anyio>=3.0.1,<4
anyio>=2.0.2,<3 ; python_version < '3.7'
anyio>=3.0.1,<4 ; python_version >= '3.7'

[options.extras_require]
test = coverage; pytest; pytest-cov; pytest-mock; requests; pytest-tornasync; pytest-console-scripts; ipykernel
Expand Down

0 comments on commit eff9b0a

Please sign in to comment.