From 4624a6d880ee8959ff2ced80c0694549c12e076d Mon Sep 17 00:00:00 2001 From: David Brochart Date: Wed, 15 Mar 2023 17:59:21 +0100 Subject: [PATCH] Add asphalt dependencies --- config.yaml | 4 ++-- jupyverse_api/jupyverse_api/app/__init__.py | 3 ++- plugins/auth/fps_auth/backends.py | 9 +++++---- plugins/auth/fps_auth/routes.py | 3 ++- plugins/yjs/fps_yjs/routes.py | 7 ++++--- pyproject.toml | 6 ++++-- 6 files changed, 19 insertions(+), 13 deletions(-) diff --git a/config.yaml b/config.yaml index afafedcf..20901ee3 100644 --- a/config.yaml +++ b/config.yaml @@ -6,9 +6,9 @@ component: type: app auth: type: auth - #auth_fief: + #auth: # type: auth_fief - #noauth: + #auth: # type: noauth contents: type: contents diff --git a/jupyverse_api/jupyverse_api/app/__init__.py b/jupyverse_api/jupyverse_api/app/__init__.py index b11925fd..49674e76 100644 --- a/jupyverse_api/jupyverse_api/app/__init__.py +++ b/jupyverse_api/jupyverse_api/app/__init__.py @@ -32,7 +32,8 @@ def _include_router(self, router, _type, **kwargs) -> None: for _router, _paths in self._router_paths.items(): if path in _paths: raise RuntimeError( - f"{_type} adds a handler for a path that is already defined in {_router}: {path}" + f"{_type} adds a handler for a path that is already defined in " + f"{_router}: {path}" ) logger.debug("%s added handler for path: %s", _type, path) new_paths.append(path) diff --git a/plugins/auth/fps_auth/backends.py b/plugins/auth/fps_auth/backends.py index 5da1b865..830700f0 100644 --- a/plugins/auth/fps_auth/backends.py +++ b/plugins/auth/fps_auth/backends.py @@ -204,10 +204,11 @@ def websocket_auth(self, permissions: Optional[Dict[str, List[str]]] = None): """ A function returning a dependency for the WebSocket connection. - :param permissions: the permissions the user should be granted access to. The user should have - access to at least one of them for the WebSocket to be opened. - :returns: a dependency for the WebSocket connection. The dependency returns a tuple consisting - of the websocket and the checked user permissions if the websocket is accepted, None otherwise. + :param permissions: the permissions the user should be granted access to. The user should + have access to at least one of them for the WebSocket to be opened. + :returns: a dependency for the WebSocket connection. The dependency returns a tuple + consisting of the websocket and the checked user permissions if the websocket is accepted, + None otherwise. """ async def _( diff --git a/plugins/auth/fps_auth/routes.py b/plugins/auth/fps_auth/routes.py index 067fc23d..609ea3fd 100644 --- a/plugins/auth/fps_auth/routes.py +++ b/plugins/auth/fps_auth/routes.py @@ -102,7 +102,8 @@ async def get_api_me( } # redefine GET /me because we want our current_user dependency - # it is first defined in users_router and so it wins over the one in fapi_users.get_users_router + # it is first defined in users_router and so it wins over the one in + # fapi_users.get_users_router users_router = APIRouter() @users_router.get("/me") diff --git a/plugins/yjs/fps_yjs/routes.py b/plugins/yjs/fps_yjs/routes.py index 0552b501..6c12ede4 100644 --- a/plugins/yjs/fps_yjs/routes.py +++ b/plugins/yjs/fps_yjs/routes.py @@ -92,7 +92,8 @@ async def serve(self): # the source file (no change history) read_from_source = True if not read_from_source: - # if YStore updates and source file are out-of-sync, resync updates with source + # if YStore updates and source file are out-of-sync, resync updates + # with source if self.room.document.source != model.content: read_from_source = True if read_from_source: @@ -122,8 +123,8 @@ async def on_message(self, message: bytes) -> bool: byte = message[0] msg = message[1:] if byte == RENAME_SESSION: - # The client moved the document to a different location. After receiving this message, - # we make the current document available under a different url. + # The client moved the document to a different location. After receiving this + # message, we make the current document available under a different url. # The other clients are automatically notified of this change because # the path is shared through the Yjs document as well. new_room_name = msg.decode("utf-8") diff --git a/pyproject.toml b/pyproject.toml index c644a49b..91d259e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,6 +9,8 @@ keywords = ["jupyter", "server", "fastapi", "plugins"] dynamic = ["version"] requires-python = ">=3.8" dependencies = [ + "asphalt >=4.11.0,<5", + "asphalt-web[fastapi] >=1.1.0,<2", "jupyverse-api", "fps-contents", "fps-kernels", @@ -41,7 +43,7 @@ test = [ "mypy", "types-setuptools", "pytest", "pytest-asyncio", "pytest-env", " docs = [ "mkdocs", "mkdocs-material",] [tool.hatch.envs.dev] -# TODO: if/when hatch gets support for defining editable dependencies, the +# TODO: if/when hatch gets support for defining editable dependencies, the # pre-install commands here and post-install commands in the matrix can be moved # to the dependencies section pre-install-commands = [ @@ -61,7 +63,7 @@ features = ["test"] [tool.hatch.envs.dev.overrides] matrix.auth.post-install-commands = [ { value = "pip install -e ./plugins/noauth", if = ["noauth"] }, - { value = "pip install -e ./plugins/auth", if = ["auth"] }, + { value = "pip install -e ./plugins/auth -e ./plugins/login", if = ["auth"] }, { value = "pip install -e ./plugins/auth_fief", if = ["auth_fief"] }, ] matrix.frontend.post-install-commands = [