Skip to content

Commit

Permalink
Switch class hierarchy to not use mixin base
Browse files Browse the repository at this point in the history
This commit uses the approach used in jupyter_server jupyter#191 first proposed
by David Brochart.  This reduces code duplication and alleviates redundancy
relative to configurable options.

Also, the startup message now includes the version information.

Co-authored-by: David Brochart <david.brochart@gmail.com>
  • Loading branch information
2 people authored and toonijn committed Apr 9, 2020
1 parent 638ee81 commit c927a3a
Show file tree
Hide file tree
Showing 5 changed files with 242 additions and 458 deletions.
11 changes: 6 additions & 5 deletions notebook/notebookapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

from .base.handlers import Template404, RedirectWithParams
from .log import log_request
from .services.kernels.kernelmanager import MappingKernelManager, AsyncMappingKernelManager, MappingKernelManagerBase
from .services.kernels.kernelmanager import MappingKernelManager, AsyncMappingKernelManager
from .services.config import ConfigManager
from .services.contents.manager import ContentsManager
from .services.contents.filemanager import FileContentsManager
Expand Down Expand Up @@ -109,7 +109,7 @@
from ._tz import utcnow, utcfromtimestamp
from .utils import url_path_join, check_pid, url_escape, urljoin, pathname2url

# Check if we can user async kernel management
# Check if we can use async kernel management
try:
from jupyter_client import AsyncMultiKernelManager
async_kernel_mgmt_available = True
Expand Down Expand Up @@ -584,7 +584,7 @@ class NotebookApp(JupyterApp):
flags = flags

classes = [
KernelManager, Session, MappingKernelManager, AsyncMappingKernelManager, KernelSpecManager,
KernelManager, Session, MappingKernelManager, KernelSpecManager,
ContentsManager, FileContentsManager, NotebookNotary,
GatewayKernelManager, GatewayKernelSpecManager, GatewaySessionManager, GatewayClient,
]
Expand Down Expand Up @@ -1185,7 +1185,7 @@ def _update_mathjax_config(self, change):

kernel_manager_class = Type(
default_value=MappingKernelManager,
klass=MappingKernelManagerBase,
klass=MappingKernelManager,
config=True,
help=_('The kernel manager class to use.')
)
Expand Down Expand Up @@ -1816,7 +1816,8 @@ def notebook_info(self, kernel_count=True):
info += kernel_msg % n_kernels
info += "\n"
# Format the info so that the URL fits on a single line in 80 char display
info += _("The Jupyter Notebook is running at:\n%s") % self.display_url
info += _("Jupyter Notebook {version} is running at:\n{url}".
format(version=NotebookApp.version, url=self.display_url))
if self.gateway_config.gateway_enabled:
info += _("\nKernels will be managed by the Gateway server running at:\n%s") % self.gateway_config.url
return info
Expand Down
Loading

0 comments on commit c927a3a

Please sign in to comment.