class ClassicApp(NBClassicConfigShimMixin, LabServerApp): name = "classic" app_name = "JupyterLab Classic" app_version = version extension_url = "/classic" load_other_extensions = True app_dir = app_dir app_settings_dir = pjoin(app_dir, "settings") schemas_dir = pjoin(app_dir, "schemas") themes_dir = pjoin(app_dir, "themes") user_settings_dir = get_user_settings_dir() workspaces_dir = get_workspaces_dir() def initialize_handlers(self): super().initialize_handlers() self.handlers.append(("/classic/tree(.*)", ClassicTreeHandler)) self.handlers.append( ("/classic/notebooks(.*)", ClassicNotebookHandler)) self.handlers.append(("/classic/edit(.*)", ClassicFileHandler)) self.handlers.append( ("/classic/terminals/(.*)", ClassicTerminalHandler)) def initialize_templates(self): super().initialize_templates() self.static_dir = os.path.join(HERE, "static") self.templates_dir = os.path.join(HERE, "templates") self.static_paths = [self.static_dir] self.template_paths = [self.templates_dir]
def load_config(nbapp): config = LabConfig(app_url='/phoila', tree_url='/voila/tree') app_dir = getattr(nbapp, 'app_dir', get_app_dir()) info = get_app_info(app_dir) static_url = info['staticUrl'] user_settings_dir = getattr(nbapp, 'user_settings_dir', get_user_settings_dir()) workspaces_dir = getattr(nbapp, 'workspaces_dir', get_workspaces_dir()) config.app_dir = app_dir config.app_name = 'Phoila' config.app_namespace = 'phoila' config.app_settings_dir = os.path.join(app_dir, 'settings') config.cache_files = True config.schemas_dir = os.path.join(app_dir, 'schemas') config.templates_dir = os.path.join(app_dir, 'static') config.themes_dir = os.path.join(app_dir, 'themes') config.user_settings_dir = user_settings_dir config.workspaces_dir = os.path.join(app_dir, 'workspaces') if getattr(nbapp, 'override_static_url', ''): static_url = nbapp.override_static_url if getattr(nbapp, 'override_theme_url', ''): config.themes_url = nbapp.override_theme_url config.themes_dir = '' if static_url: config.static_url = static_url else: config.static_dir = os.path.join(app_dir, 'static') return config
class ClassicApp(NBClassicConfigShimMixin, LabServerApp): name = "classic" app_name = "JupyterLab Classic" description = "JupyterLab Classic - A JupyterLab Distribution with the Classic Notebook look and feel" app_version = version extension_url = "/classic" default_url = "/classic/tree" file_url_prefix = "/classic/notebooks" load_other_extensions = True app_dir = app_dir app_settings_dir = pjoin(app_dir, "settings") schemas_dir = pjoin(app_dir, "schemas") themes_dir = pjoin(app_dir, "themes") user_settings_dir = get_user_settings_dir() workspaces_dir = get_workspaces_dir() subcommands = {} def initialize_handlers(self): self.handlers.append( (rf"/{self.file_url_prefix}/((?!.*\.ipynb($|\?)).*)", web.RedirectHandler, { "url": "/classic/edit/{0}" })) self.handlers.append(("/classic/tree(.*)", ClassicTreeHandler)) self.handlers.append( ("/classic/notebooks(.*)", ClassicNotebookHandler)) self.handlers.append(("/classic/edit(.*)", ClassicFileHandler)) self.handlers.append( ("/classic/terminals/(.*)", ClassicTerminalHandler)) super().initialize_handlers() def initialize_templates(self): super().initialize_templates() self.static_dir = os.path.join(HERE, "static") self.templates_dir = os.path.join(HERE, "templates") self.static_paths = [self.static_dir] self.template_paths = [self.templates_dir] def initialize_settings(self): super().initialize_settings() def initialize(self, argv=None): """Subclass because the ExtensionApp.initialize() method does not take arguments""" super().initialize()
class JupyterNotebookApp(NotebookConfigShimMixin, LabServerApp): name = "notebook" app_name = "Jupyter Notebook" description = "Jupyter Notebook - A web-based notebook environment for interactive computing" version = version app_version = version extension_url = "/" default_url = "/tree" file_url_prefix = "/notebooks" load_other_extensions = True app_dir = app_dir app_settings_dir = pjoin(app_dir, "settings") schemas_dir = pjoin(app_dir, "schemas") themes_dir = pjoin(app_dir, "themes") user_settings_dir = get_user_settings_dir() workspaces_dir = get_workspaces_dir() subcommands = {} expose_app_in_browser = Bool( False, config=True, help= "Whether to expose the global app instance to browser via window.jupyterapp" ) collaborative = Bool(False, config=True, help="Whether to enable collaborative mode.") flags = flags flags['expose-app-in-browser'] = ({ 'JupyterNotebookApp': { 'expose_app_in_browser': True } }, "Expose the global app instance to browser via window.jupyterlab.") flags["collaborative"] = ( { "JupyterNotebookApp": { "collaborative": True } }, "Whether to enable collaborative mode.", ) def initialize_handlers(self): self.handlers.append(( rf"/{self.file_url_prefix}/((?!.*\.ipynb($|\?)).*)", web.RedirectHandler, { "url": "/edit/{0}" }, )) self.handlers.append(("/?", RedirectHandler)) self.handlers.append(("/tree(.*)", TreeHandler)) self.handlers.append(("/notebooks(.*)", NotebookHandler)) self.handlers.append(("/edit(.*)", FileHandler)) self.handlers.append(("/consoles/(.*)", ConsoleHandler)) self.handlers.append(("/terminals/(.*)", TerminalHandler)) super().initialize_handlers() def initialize_templates(self): super().initialize_templates() self.static_dir = os.path.join(HERE, "static") self.templates_dir = os.path.join(HERE, "templates") self.static_paths = [self.static_dir] self.template_paths = [self.templates_dir] def initialize_settings(self): super().initialize_settings() def initialize(self, argv=None): """Subclass because the ExtensionApp.initialize() method does not take arguments""" super().initialize()
def _default_workspaces_dir(self): return get_workspaces_dir()