|
6 | 6 | import gettext
|
7 | 7 | import hashlib
|
8 | 8 | import hmac
|
9 |
| -import inspect |
10 | 9 | import ipaddress
|
11 | 10 | import json
|
12 | 11 | import logging
|
|
57 | 56 | if not sys.platform.startswith("win"):
|
58 | 57 | from tornado.netutil import bind_unix_socket
|
59 | 58 |
|
60 |
| -from jupyter_client import KernelManager |
61 | 59 | from jupyter_client.kernelspec import KernelSpecManager
|
| 60 | +from jupyter_client.manager import KernelManager |
62 | 61 | from jupyter_client.session import Session
|
63 | 62 | from jupyter_core.application import JupyterApp, base_aliases, base_flags
|
64 | 63 | from jupyter_core.paths import jupyter_runtime_dir
|
|
123 | 122 | AsyncFileContentsManager,
|
124 | 123 | FileContentsManager,
|
125 | 124 | )
|
126 |
| -from jupyter_server.services.contents.largefilemanager import LargeFileManager |
| 125 | +from jupyter_server.services.contents.largefilemanager import AsyncLargeFileManager |
127 | 126 | from jupyter_server.services.contents.manager import (
|
128 | 127 | AsyncContentsManager,
|
129 | 128 | ContentsManager,
|
|
133 | 132 | MappingKernelManager,
|
134 | 133 | )
|
135 | 134 | from jupyter_server.services.sessions.sessionmanager import SessionManager
|
136 |
| -from jupyter_server.traittypes import TypeFromClasses |
137 | 135 | from jupyter_server.utils import (
|
138 | 136 | check_pid,
|
139 | 137 | fetch,
|
@@ -1164,7 +1162,7 @@ def _deprecated_password_config(self, change):
|
1164 | 1162 | config=True,
|
1165 | 1163 | help="""Disable cross-site-request-forgery protection
|
1166 | 1164 |
|
1167 |
| - Jupyter notebook 4.3.1 introduces protection from cross-site request forgeries, |
| 1165 | + Jupyter server includes protection from cross-site request forgeries, |
1168 | 1166 | requiring API requests to either:
|
1169 | 1167 |
|
1170 | 1168 | - originate from pages served by this server (validated with XSRF cookie and token), or
|
@@ -1435,38 +1433,13 @@ def template_file_path(self):
|
1435 | 1433 | help="""If True, display controls to shut down the Jupyter server, such as menu items or buttons.""",
|
1436 | 1434 | )
|
1437 | 1435 |
|
1438 |
| - # REMOVE in VERSION 2.0 |
1439 |
| - # Temporarily allow content managers to inherit from the 'notebook' |
1440 |
| - # package. We will deprecate this in the next major release. |
1441 |
| - contents_manager_class = TypeFromClasses( |
1442 |
| - default_value=LargeFileManager, |
1443 |
| - klasses=[ |
1444 |
| - "jupyter_server.services.contents.manager.ContentsManager", |
1445 |
| - "notebook.services.contents.manager.ContentsManager", |
1446 |
| - ], |
| 1436 | + contents_manager_class = Type( |
| 1437 | + default_value=AsyncLargeFileManager, |
| 1438 | + klass=ContentsManager, |
1447 | 1439 | config=True,
|
1448 | 1440 | help=_i18n("The content manager class to use."),
|
1449 | 1441 | )
|
1450 | 1442 |
|
1451 |
| - # Throws a deprecation warning to notebook based contents managers. |
1452 |
| - @observe("contents_manager_class") |
1453 |
| - def _observe_contents_manager_class(self, change): |
1454 |
| - new = change["new"] |
1455 |
| - # If 'new' is a class, get a string representing the import |
1456 |
| - # module path. |
1457 |
| - if inspect.isclass(new): |
1458 |
| - new = new.__module__ |
1459 |
| - |
1460 |
| - if new.startswith("notebook"): |
1461 |
| - self.log.warning( |
1462 |
| - "The specified 'contents_manager_class' class inherits a manager from the " |
1463 |
| - "'notebook' package. This is not guaranteed to work in future " |
1464 |
| - "releases of Jupyter Server. Instead, consider switching the " |
1465 |
| - "manager to inherit from the 'jupyter_server' managers. " |
1466 |
| - "Jupyter Server will temporarily allow 'notebook' managers " |
1467 |
| - "until its next major release (2.x)." |
1468 |
| - ) |
1469 |
| - |
1470 | 1443 | kernel_manager_class = Type(
|
1471 | 1444 | klass=MappingKernelManager,
|
1472 | 1445 | config=True,
|
@@ -1865,6 +1838,20 @@ def init_configurables(self):
|
1865 | 1838 | # this determination, instantiate the GatewayClient config singleton.
|
1866 | 1839 | self.gateway_config = GatewayClient.instance(parent=self)
|
1867 | 1840 |
|
| 1841 | + if not issubclass(self.kernel_manager_class, AsyncMappingKernelManager): |
| 1842 | + warnings.warn( |
| 1843 | + "The synchronous MappingKernelManager class is deprecated and will not be supported in Jupyter Server 3.0", |
| 1844 | + DeprecationWarning, |
| 1845 | + stacklevel=2, |
| 1846 | + ) |
| 1847 | + |
| 1848 | + if not issubclass(self.contents_manager_class, AsyncContentsManager): |
| 1849 | + warnings.warn( |
| 1850 | + "The synchronous ContentsManager classes are deprecated and will not be supported in Jupyter Server 3.0", |
| 1851 | + DeprecationWarning, |
| 1852 | + stacklevel=2, |
| 1853 | + ) |
| 1854 | + |
1868 | 1855 | self.kernel_spec_manager = self.kernel_spec_manager_class(
|
1869 | 1856 | parent=self,
|
1870 | 1857 | )
|
|
0 commit comments