diff --git a/README.md b/README.md index 3030033..9ce2b3e 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,11 @@ The gallery application backend can be run as a standalone server app by executi jupyterlab-gallery ``` -When run in JupyterHub context (with `jupyterhub` package installed), the standalone app will adopt the JupyterHub modifications to the single-user server. +To run it as a single-user server in the JupyterHub context use: + +```bash +jupyterhub-gallery +``` ## Requirements diff --git a/jupyterlab_gallery/app.py b/jupyterlab_gallery/app.py index 3549dc6..e5e3850 100644 --- a/jupyterlab_gallery/app.py +++ b/jupyterlab_gallery/app.py @@ -4,19 +4,6 @@ from .manager import GalleryManager -try: - from jupyterhub.singleuser.mixins import make_singleuser_app -except ImportError: - - def make_singleuser_app(cls): - return cls - - -class classproperty(property): - def __get__(self, owner_self, owner_cls): - return self.fget(owner_cls) - - class GalleryApp(ExtensionApp): name = "gallery" @@ -39,22 +26,8 @@ def initialize_settings(self): def initialize_handlers(self): # setting nbapp is needed for nbgitpuller self.serverapp.web_app.settings["nbapp"] = self.serverapp - self.log.info(f"Registered {self.name} server extension") - @classproperty - def serverapp_class(cls): - """If jupyterhub is installed, apply the jupyterhub patches, - - but only do this when this property is accessed, which is when - the gallery is used as a standalone app. - """ - if cls._server_cls is None: - cls._server_cls = make_singleuser_app(ServerApp) - return cls._server_cls - - _server_cls = None - @classmethod def make_serverapp(cls, **kwargs) -> ServerApp: """Instantiate the ServerApp diff --git a/package.json b/package.json index 2d07c8f..4570449 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jupyterlab-gallery", - "version": "0.6.1", + "version": "0.6.2", "description": "A JupyterLab gallery extension for presenting and downloading examples from remote repositories", "keywords": [ "jupyter", diff --git a/pyproject.toml b/pyproject.toml index d6b180e..943e55a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,6 +41,7 @@ dev = ["ruff==0.4.4"] [project.scripts] jupyterlab-gallery = "jupyterlab_gallery:GalleryApp.launch_instance" +jupyterhub-gallery = "jupyterlab_gallery.hub:HubGalleryApp.launch_instance" [tool.hatch.version] source = "nodejs"