From 2979400ae8d75cb1f6e4c9a937062356acdaaae0 Mon Sep 17 00:00:00 2001 From: David Brochart Date: Mon, 3 Feb 2025 08:57:07 +0100 Subject: [PATCH] Use FastAIO v0.4 --- jupyverse_api/jupyverse_api/cli.py | 22 ++++++++-------- jupyverse_api/jupyverse_api/main/__init__.py | 21 +++++++-------- jupyverse_api/pyproject.toml | 12 ++++----- plugins/auth/MANIFEST.in | 1 - plugins/auth/fps_auth/main.py | 14 +++++----- plugins/auth/pyproject.toml | 4 +-- plugins/auth_fief/MANIFEST.in | 1 - plugins/auth_fief/fps_auth_fief/main.py | 12 ++++----- .../fps_auth_jupyterhub/main.py | 10 +++---- plugins/auth_jupyterhub/pyproject.toml | 2 +- plugins/contents/MANIFEST.in | 1 - plugins/contents/fps_contents/main.py | 10 +++---- plugins/contents/pyproject.toml | 4 +-- plugins/frontend/MANIFEST.in | 1 - plugins/frontend/fps_frontend/main.py | 6 ++--- plugins/frontend/pyproject.toml | 4 +-- plugins/jupyterlab/MANIFEST.in | 1 - plugins/jupyterlab/fps_jupyterlab/main.py | 18 ++++++------- plugins/jupyterlab/pyproject.toml | 4 +-- plugins/kernels/MANIFEST.in | 1 - plugins/kernels/fps_kernels/main.py | 18 ++++++------- plugins/kernels/pyproject.toml | 4 +-- plugins/lab/MANIFEST.in | 1 - plugins/lab/fps_lab/main.py | 16 +++++------- plugins/lab/pyproject.toml | 4 +-- plugins/login/MANIFEST.in | 2 -- plugins/login/fps_login/main.py | 12 ++++----- plugins/login/pyproject.toml | 4 +-- plugins/nbconvert/MANIFEST.in | 1 - plugins/nbconvert/fps_nbconvert/main.py | 11 ++++---- plugins/nbconvert/pyproject.toml | 4 +-- plugins/noauth/MANIFEST.in | 1 - plugins/noauth/fps_noauth/main.py | 6 ++--- plugins/noauth/pyproject.toml | 4 +-- plugins/notebook/MANIFEST.in | 1 - plugins/notebook/fps_notebook/main.py | 16 +++++------- plugins/notebook/pyproject.toml | 2 +- .../resource_usage/fps_resource_usage/main.py | 10 +++---- plugins/resource_usage/pyproject.toml | 4 +-- plugins/terminals/MANIFEST.in | 1 - plugins/terminals/fps_terminals/main.py | 10 +++---- plugins/terminals/pyproject.toml | 4 +-- plugins/webdav/fps_webdav/main.py | 8 +++--- plugins/webdav/pyproject.toml | 4 +-- plugins/webdav/tests/test_webdav.py | 12 ++++----- plugins/yjs/MANIFEST.in | 1 - plugins/yjs/fps_yjs/main.py | 16 ++++++------ plugins/yjs/pyproject.toml | 4 +-- tests/test_app.py | 8 +++--- tests/test_auth.py | 26 +++++++++---------- tests/test_contents.py | 8 +++--- tests/test_execute.py | 8 +++--- tests/test_kernels.py | 8 +++--- tests/test_settings.py | 8 +++--- 54 files changed, 186 insertions(+), 210 deletions(-) delete mode 100644 plugins/auth/MANIFEST.in delete mode 100644 plugins/auth_fief/MANIFEST.in delete mode 100644 plugins/contents/MANIFEST.in delete mode 100644 plugins/frontend/MANIFEST.in delete mode 100644 plugins/jupyterlab/MANIFEST.in delete mode 100644 plugins/kernels/MANIFEST.in delete mode 100644 plugins/lab/MANIFEST.in delete mode 100644 plugins/login/MANIFEST.in delete mode 100644 plugins/nbconvert/MANIFEST.in delete mode 100644 plugins/noauth/MANIFEST.in delete mode 100644 plugins/notebook/MANIFEST.in delete mode 100644 plugins/terminals/MANIFEST.in delete mode 100644 plugins/yjs/MANIFEST.in diff --git a/jupyverse_api/jupyverse_api/cli.py b/jupyverse_api/jupyverse_api/cli.py index adbe9c13..e034a71e 100644 --- a/jupyverse_api/jupyverse_api/cli.py +++ b/jupyverse_api/jupyverse_api/cli.py @@ -3,7 +3,7 @@ from typing import Any, List, Tuple import rich_click as click -from fastaio import get_config, get_root_component, merge_config +from fastaio import get_config, get_root_module, merge_config from fastaio import main as fastaio_main if sys.version_info < (3, 10): @@ -88,29 +88,29 @@ def main( set_list.append(f"allow_origins={allow_origins_str}") set_list.append(f"query_params={query_params_str}") fastaio_main.callback( - "jupyverse_api.main:JupyverseComponent", + "jupyverse_api.main:JupyverseModule", set_=set_list, ) # type: ignore cli_config = get_config() pluggin_config = get_pluggin_config(disable) config = merge_config(cli_config, pluggin_config) - root_component = get_root_component(config) - root_component.run() + root_module = get_root_module(config) + root_module.run() def get_pluggin_config(disable: Tuple[str, ...]) -> dict[str, Any]: - jupyverse_components = [ + jupyverse_modules = [ ep.name - for ep in entry_points(group="jupyverse.components") + for ep in entry_points(group="jupyverse.modules") if ep.name not in disable ] config = { - "root_component": { - "components": { - component: { - "type": component + "root_module": { + "modules": { + module: { + "type": module } - for component in jupyverse_components + for module in jupyverse_modules } } } diff --git a/jupyverse_api/jupyverse_api/main/__init__.py b/jupyverse_api/jupyverse_api/main/__init__.py index 70c07aaa..8d4d92b1 100644 --- a/jupyverse_api/jupyverse_api/main/__init__.py +++ b/jupyverse_api/jupyverse_api/main/__init__.py @@ -6,8 +6,8 @@ import structlog from anyio import Event, create_task_group -from fastaio import Component -from fastaio.web.fastapi import FastAPIComponent +from fastaio import Module +from fastaio.web.fastapi import FastAPIModule from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from pydantic import BaseModel, Json @@ -19,7 +19,7 @@ logger = structlog.get_logger() -class AppComponent(Component): +class AppModule(Module): def __init__( self, name: str, @@ -30,13 +30,12 @@ def __init__( self.mount_path = mount_path async def prepare(self) -> None: - app = await self.get_resource(FastAPI) + app = await self.get(FastAPI) _app = App(app, mount_path=self.mount_path) - self.add_resource(_app) - self.done() + self.put(_app) -class JupyverseComponent(FastAPIComponent): +class JupyverseModule(FastAPIModule): def __init__(self, name: str, **kwargs) -> None: self.jupyverse_config = JupyverseConfig(**kwargs) if self.jupyverse_config.debug: @@ -51,7 +50,7 @@ def __init__(self, name: str, **kwargs) -> None: async def prepare(self) -> None: await super().prepare() - app = await self.get_resource(App) + app = await self.get(App) if self.jupyverse_config.allow_origins: app.add_middleware( CORSMiddleware, @@ -66,9 +65,9 @@ async def prepare(self) -> None: self._host = f"http://{self._host}" self._port = self.jupyverse_config.port host_url = Host(url=f"{self._host}:{self._port}/") - self.add_resource(self._query_params) - self.add_resource(host_url) - self.add_resource(self.lifespan) + self.put(self._query_params) + self.put(host_url) + self.put(self.lifespan) async def start(self) -> None: async with create_task_group() as tg: diff --git a/jupyverse_api/pyproject.toml b/jupyverse_api/pyproject.toml index 82c44dd2..d9fba790 100644 --- a/jupyverse_api/pyproject.toml +++ b/jupyverse_api/pyproject.toml @@ -29,7 +29,7 @@ dependencies = [ "pydantic >=2,<3", "fastapi >=0.95.0,<1", "rich-click >=1.6.1,<2", - "fastaio[web] >=0.3.0,<0.4.0", + "fastaio[web] >=0.4.0,<0.5.0", ] dynamic = ["version"] @@ -42,12 +42,12 @@ Source = "https://github.com/jupyter-server/jupyverse/jupyverse_api" [project.scripts] jupyverse = "jupyverse_api.cli:main" -[project.entry-points."fastaio.components"] -app = "jupyverse_api.main:AppComponent" -jupyverse = "jupyverse_api.main:JupyverseComponent" +[project.entry-points."fastaio.modules"] +app = "jupyverse_api.main:AppModule" +jupyverse = "jupyverse_api.main:JupyverseModule" -[project.entry-points."jupyverse.components"] -app = "jupyverse_api.main:AppComponent" +[project.entry-points."jupyverse.modules"] +app = "jupyverse_api.main:AppModule" [tool.hatch.version] path = "jupyverse_api/__init__.py" diff --git a/plugins/auth/MANIFEST.in b/plugins/auth/MANIFEST.in deleted file mode 100644 index efa752ea..00000000 --- a/plugins/auth/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include *.md diff --git a/plugins/auth/fps_auth/main.py b/plugins/auth/fps_auth/main.py index ca707c4f..32264f7b 100644 --- a/plugins/auth/fps_auth/main.py +++ b/plugins/auth/fps_auth/main.py @@ -1,5 +1,5 @@ import structlog -from fastaio import Component +from fastaio import Module from fastapi_users.exceptions import UserAlreadyExists from jupyverse_api.app import App @@ -13,19 +13,19 @@ log = structlog.get_logger() -class AuthComponent(Component): +class AuthModule(Module): def __init__(self, name: str, **kwargs): super().__init__(name) self.auth_config = _AuthConfig(**kwargs) async def prepare(self) -> None: - self.add_resource(self.auth_config, types=AuthConfig) + self.put(self.auth_config, types=AuthConfig) - app = await self.get_resource(App) - frontend_config = await self.get_resource(FrontendConfig) + app = await self.get(App) + frontend_config = await self.get(FrontendConfig) auth = auth_factory(app, self.auth_config, frontend_config) - self.add_resource(auth, types=Auth) + self.put(auth, types=Auth) await auth.db.create_db_and_tables() @@ -56,5 +56,5 @@ async def prepare(self) -> None: ) if self.auth_config.mode == "token": - query_params = await self.get_resource(QueryParams) + query_params = await self.get(QueryParams) query_params.d["token"] = self.auth_config.token diff --git a/plugins/auth/pyproject.toml b/plugins/auth/pyproject.toml index f564f28d..ad3da42a 100644 --- a/plugins/auth/pyproject.toml +++ b/plugins/auth/pyproject.toml @@ -35,8 +35,8 @@ ignore = [ ".*",] skip = [ "check-links",] [project.entry-points] -"fastaio.components" = {auth = "fps_auth.main:AuthComponent"} -"jupyverse.components" = {auth = "fps_auth.main:AuthComponent"} +"fastaio.modules" = {auth = "fps_auth.main:AuthModule"} +"jupyverse.modules" = {auth = "fps_auth.main:AuthModule"} [tool.hatch.version] path = "fps_auth/__init__.py" diff --git a/plugins/auth_fief/MANIFEST.in b/plugins/auth_fief/MANIFEST.in deleted file mode 100644 index efa752ea..00000000 --- a/plugins/auth_fief/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include *.md diff --git a/plugins/auth_fief/fps_auth_fief/main.py b/plugins/auth_fief/fps_auth_fief/main.py index 737cc4c3..64405be2 100644 --- a/plugins/auth_fief/fps_auth_fief/main.py +++ b/plugins/auth_fief/fps_auth_fief/main.py @@ -1,4 +1,4 @@ -from fastaio import Component +from fastaio import Module from jupyverse_api.app import App from jupyverse_api.auth import Auth, AuthConfig @@ -7,14 +7,14 @@ from .routes import auth_factory -class AuthFiefComponent(Component): +class AuthFiefModule(Module): def __init__(self, name: str, **kwargs): self.auth_fief_config = _AuthFiefConfig(**kwargs) - async def start(self) -> None: - self.add_resource(self.auth_fief_config, types=AuthConfig) + async def prepare(self) -> None: + self.put(self.auth_fief_config, types=AuthConfig) - app = await self.request_resource(App) + app = await self.get(App) auth_fief = auth_factory(app, self.auth_fief_config) - self.add_resource(auth_fief, types=Auth) + self.put(auth_fief, types=Auth) diff --git a/plugins/auth_jupyterhub/fps_auth_jupyterhub/main.py b/plugins/auth_jupyterhub/fps_auth_jupyterhub/main.py index 22651502..43b2b3b9 100644 --- a/plugins/auth_jupyterhub/fps_auth_jupyterhub/main.py +++ b/plugins/auth_jupyterhub/fps_auth_jupyterhub/main.py @@ -1,4 +1,4 @@ -from fastaio import Component +from fastaio import Module from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine from jupyverse_api.app import App @@ -9,19 +9,19 @@ from .routes import auth_factory -class AuthJupyterHubComponent(Component): +class AuthJupyterHubModule(Module): def __init__(self, name: str, **kwargs): super().__init__(name) self.auth_jupyterhub_config = AuthJupyterHubConfig(**kwargs) async def prepare(self) -> None: - self.add_resource(self.auth_jupyterhub_config, types=AuthConfig) - app = await self.get_resource(App) + self.put(self.auth_jupyterhub_config, types=AuthConfig) + app = await self.get(App) self.db_engine = create_async_engine(self.auth_jupyterhub_config.db_url) self.db_session = AsyncSession(self.db_engine) auth_jupyterhub = auth_factory(app, self.db_session) - self.add_resource(auth_jupyterhub, types=Auth) + self.put(auth_jupyterhub, types=Auth) async with self.db_engine.begin() as conn: await conn.run_sync(Base.metadata.create_all) diff --git a/plugins/auth_jupyterhub/pyproject.toml b/plugins/auth_jupyterhub/pyproject.toml index 5a6c7949..c9848b9b 100644 --- a/plugins/auth_jupyterhub/pyproject.toml +++ b/plugins/auth_jupyterhub/pyproject.toml @@ -37,7 +37,7 @@ ignore = [ ".*",] skip = [ "check-links" ] [project.entry-points] -"jupyverse.components" = {auth_jupyterhub = "fps_auth_jupyterhub.main:AuthJupyterHubComponent"} +"jupyverse.modules" = {auth_jupyterhub = "fps_auth_jupyterhub.main:AuthJupyterHubModule"} [tool.hatch.version] path = "fps_auth_jupyterhub/__init__.py" diff --git a/plugins/contents/MANIFEST.in b/plugins/contents/MANIFEST.in deleted file mode 100644 index efa752ea..00000000 --- a/plugins/contents/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include *.md diff --git a/plugins/contents/fps_contents/main.py b/plugins/contents/fps_contents/main.py index 1584a732..03971b14 100644 --- a/plugins/contents/fps_contents/main.py +++ b/plugins/contents/fps_contents/main.py @@ -1,4 +1,4 @@ -from fastaio import Component +from fastaio import Module from jupyverse_api.app import App from jupyverse_api.auth import Auth @@ -7,10 +7,10 @@ from .routes import _Contents -class ContentsComponent(Component): +class ContentsModule(Module): async def prepare(self) -> None: - app = await self.get_resource(App) - auth = await self.get_resource(Auth) # type: ignore + app = await self.get(App) + auth = await self.get(Auth) # type: ignore contents = _Contents(app, auth) - self.add_resource(contents, types=Contents) + self.put(contents, types=Contents) diff --git a/plugins/contents/pyproject.toml b/plugins/contents/pyproject.toml index 5c80f363..20e2daed 100644 --- a/plugins/contents/pyproject.toml +++ b/plugins/contents/pyproject.toml @@ -35,8 +35,8 @@ ignore = [ ".*",] skip = [ "check-links",] [project.entry-points] -"fastaio.components" = {contents = "fps_contents.main:ContentsComponent"} -"jupyverse.components" = {contents = "fps_contents.main:ContentsComponent"} +"fastaio.modules" = {contents = "fps_contents.main:ContentsModule"} +"jupyverse.modules" = {contents = "fps_contents.main:ContentsModule"} [tool.hatch.version] path = "fps_contents/__init__.py" diff --git a/plugins/frontend/MANIFEST.in b/plugins/frontend/MANIFEST.in deleted file mode 100644 index efa752ea..00000000 --- a/plugins/frontend/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include *.md diff --git a/plugins/frontend/fps_frontend/main.py b/plugins/frontend/fps_frontend/main.py index 7518280a..570e74d8 100644 --- a/plugins/frontend/fps_frontend/main.py +++ b/plugins/frontend/fps_frontend/main.py @@ -1,12 +1,12 @@ -from fastaio import Component +from fastaio import Module from jupyverse_api.frontend import FrontendConfig -class FrontendComponent(Component): +class FrontendModule(Module): def __init__(self, name: str, **kwargs): super().__init__(name) self.frontend_config = FrontendConfig(**kwargs) async def prepare(self) -> None: - self.add_resource(self.frontend_config, types=FrontendConfig) + self.put(self.frontend_config, types=FrontendConfig) diff --git a/plugins/frontend/pyproject.toml b/plugins/frontend/pyproject.toml index b6785b50..bb39a464 100644 --- a/plugins/frontend/pyproject.toml +++ b/plugins/frontend/pyproject.toml @@ -33,8 +33,8 @@ ignore = [".*"] skip = ["check-links"] [project.entry-points] -"fastaio.components" = {frontend = "fps_frontend.main:FrontendComponent"} -"jupyverse.components" = {frontend = "fps_frontend.main:FrontendComponent"} +"fastaio.modules" = {frontend = "fps_frontend.main:FrontendModule"} +"jupyverse.modules" = {frontend = "fps_frontend.main:FrontendModule"} [tool.hatch.version] path = "fps_frontend/__init__.py" diff --git a/plugins/jupyterlab/MANIFEST.in b/plugins/jupyterlab/MANIFEST.in deleted file mode 100644 index efa752ea..00000000 --- a/plugins/jupyterlab/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include *.md diff --git a/plugins/jupyterlab/fps_jupyterlab/main.py b/plugins/jupyterlab/fps_jupyterlab/main.py index dbf3c39f..8e5804b5 100644 --- a/plugins/jupyterlab/fps_jupyterlab/main.py +++ b/plugins/jupyterlab/fps_jupyterlab/main.py @@ -1,4 +1,4 @@ -from fastaio import Component +from fastaio import Module from jupyverse_api.app import App from jupyverse_api.auth import Auth @@ -9,20 +9,18 @@ from .routes import _JupyterLab -class JupyterLabComponent(Component): +class JupyterLabModule(Module): def __init__(self, name: str, **kwargs): super().__init__(name) self.jupyterlab_config = JupyterLabConfig(**kwargs) async def prepare(self) -> None: - self.add_resource(self.jupyterlab_config, types=JupyterLabConfig) + self.put(self.jupyterlab_config, types=JupyterLabConfig) - app = await self.get_resource(App) - auth = await self.get_resource(Auth) - frontend_config = await self.get_resource(FrontendConfig) - lab = await self.get_resource(Lab) + app = await self.get(App) + auth = await self.get(Auth) + frontend_config = await self.get(FrontendConfig) + lab = await self.get(Lab) jupyterlab = _JupyterLab(app, self.jupyterlab_config, auth, frontend_config, lab) - self.add_resource(jupyterlab, types=JupyterLab) - - self.done() + self.put(jupyterlab, types=JupyterLab) diff --git a/plugins/jupyterlab/pyproject.toml b/plugins/jupyterlab/pyproject.toml index 8d4021ff..e8ed832a 100644 --- a/plugins/jupyterlab/pyproject.toml +++ b/plugins/jupyterlab/pyproject.toml @@ -33,8 +33,8 @@ ignore = [ ".*",] skip = [ "check-links",] [project.entry-points] -"fastaio.components" = {jupyterlab = "fps_jupyterlab.main:JupyterLabComponent"} -"jupyverse.components" = {jupyterlab = "fps_jupyterlab.main:JupyterLabComponent"} +"fastaio.modules" = {jupyterlab = "fps_jupyterlab.main:JupyterLabModule"} +"jupyverse.modules" = {jupyterlab = "fps_jupyterlab.main:JupyterLabModule"} [tool.hatch.version] path = "fps_jupyterlab/__init__.py" diff --git a/plugins/kernels/MANIFEST.in b/plugins/kernels/MANIFEST.in deleted file mode 100644 index efa752ea..00000000 --- a/plugins/kernels/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include *.md diff --git a/plugins/kernels/fps_kernels/main.py b/plugins/kernels/fps_kernels/main.py index 596586f5..7454c6fc 100644 --- a/plugins/kernels/fps_kernels/main.py +++ b/plugins/kernels/fps_kernels/main.py @@ -2,7 +2,7 @@ import structlog from anyio import create_task_group -from fastaio import Component +from fastaio import Module from jupyverse_api.app import App from jupyverse_api.auth import Auth @@ -16,26 +16,26 @@ log = structlog.get_logger() -class KernelsComponent(Component): +class KernelsModule(Module): def __init__(self, name: str, **kwargs): super().__init__(name) self.kernels_config = KernelsConfig(**kwargs) async def prepare(self) -> None: - self.add_resource(self.kernels_config, types=KernelsConfig) + self.put(self.kernels_config, types=KernelsConfig) - app = await self.get_resource(App) - auth = await self.get_resource(Auth) - frontend_config = await self.get_resource(FrontendConfig) - lifespan = await self.get_resource(Lifespan) + app = await self.get(App) + auth = await self.get(Auth) + frontend_config = await self.get(FrontendConfig) + lifespan = await self.get(Lifespan) yjs = ( - await self.get_resource(Yjs) + await self.get(Yjs) if self.kernels_config.require_yjs else None ) self.kernels = _Kernels(app, self.kernels_config, auth, frontend_config, yjs, lifespan) - self.add_resource(self.kernels, types=Kernels) + self.put(self.kernels, types=Kernels) async with create_task_group() as tg: tg.start_soon(self.kernels.start) diff --git a/plugins/kernels/pyproject.toml b/plugins/kernels/pyproject.toml index e561b295..48991b0a 100644 --- a/plugins/kernels/pyproject.toml +++ b/plugins/kernels/pyproject.toml @@ -39,8 +39,8 @@ ignore = [ ".*",] skip = [ "check-links",] [project.entry-points] -"fastaio.components" = {kernels = "fps_kernels.main:KernelsComponent"} -"jupyverse.components" = {kernels = "fps_kernels.main:KernelsComponent"} +"fastaio.modules" = {kernels = "fps_kernels.main:KernelsModule"} +"jupyverse.modules" = {kernels = "fps_kernels.main:KernelsModule"} [tool.hatch.version] path = "fps_kernels/__init__.py" diff --git a/plugins/lab/MANIFEST.in b/plugins/lab/MANIFEST.in deleted file mode 100644 index efa752ea..00000000 --- a/plugins/lab/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include *.md diff --git a/plugins/lab/fps_lab/main.py b/plugins/lab/fps_lab/main.py index f177ffaf..8c6a20df 100644 --- a/plugins/lab/fps_lab/main.py +++ b/plugins/lab/fps_lab/main.py @@ -1,4 +1,4 @@ -from fastaio import Component +from fastaio import Module from jupyverse_api.app import App from jupyverse_api.auth import Auth @@ -9,14 +9,12 @@ from .routes import _Lab -class LabComponent(Component): +class LabModule(Module): async def prepare(self) -> None: - app = await self.get_resource(App) - auth = await self.get_resource(Auth) - frontend_config = await self.get_resource(FrontendConfig) - jupyterlab_config = await self.get_resource(JupyterLabConfig, timeout=0.1) + app = await self.get(App) + auth = await self.get(Auth) + frontend_config = await self.get(FrontendConfig) + jupyterlab_config = await self.get(JupyterLabConfig, timeout=0.1) lab = _Lab(app, auth, frontend_config, jupyterlab_config) - self.add_resource(lab, types=Lab) - - self.done() + self.put(lab, types=Lab) diff --git a/plugins/lab/pyproject.toml b/plugins/lab/pyproject.toml index 5efcdb12..d0c5cdc1 100644 --- a/plugins/lab/pyproject.toml +++ b/plugins/lab/pyproject.toml @@ -35,8 +35,8 @@ ignore = [ ".*",] skip = [ "check-links",] [project.entry-points] -"fastaio.components" = {lab = "fps_lab.main:LabComponent"} -"jupyverse.components" = {lab = "fps_lab.main:LabComponent"} +"fastaio.modules" = {lab = "fps_lab.main:LabModule"} +"jupyverse.modules" = {lab = "fps_lab.main:LabModule"} [tool.hatch.version] path = "fps_lab/__init__.py" diff --git a/plugins/login/MANIFEST.in b/plugins/login/MANIFEST.in deleted file mode 100644 index ad0ce49c..00000000 --- a/plugins/login/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -recursive-include fps_login * -include *.md diff --git a/plugins/login/fps_login/main.py b/plugins/login/fps_login/main.py index 9d902f35..f3625c3c 100644 --- a/plugins/login/fps_login/main.py +++ b/plugins/login/fps_login/main.py @@ -1,4 +1,4 @@ -from fastaio import Component +from fastaio import Module from jupyverse_api.app import App from jupyverse_api.auth import AuthConfig @@ -7,12 +7,10 @@ from .routes import _Login -class LoginComponent(Component): +class LoginModule(Module): async def prepare(self) -> None: - app = await self.get_resource(App) - auth_config = await self.get_resource(AuthConfig) + app = await self.get(App) + auth_config = await self.get(AuthConfig) login = _Login(app, auth_config) - self.add_resource(login, types=Login) - - self.done() + self.put(login, types=Login) diff --git a/plugins/login/pyproject.toml b/plugins/login/pyproject.toml index cc1d0c9e..ea959ed3 100644 --- a/plugins/login/pyproject.toml +++ b/plugins/login/pyproject.toml @@ -32,8 +32,8 @@ ignore = [ ".*",] skip = [ "check-links",] [project.entry-points] -"fastaio.components" = {login = "fps_login.main:LoginComponent"} -"jupyverse.components" = {login = "fps_login.main:LoginComponent"} +"fastaio.modules" = {login = "fps_login.main:LoginModule"} +"jupyverse.modules" = {login = "fps_login.main:LoginModule"} [tool.hatch.version] path = "fps_login/__init__.py" diff --git a/plugins/nbconvert/MANIFEST.in b/plugins/nbconvert/MANIFEST.in deleted file mode 100644 index efa752ea..00000000 --- a/plugins/nbconvert/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include *.md diff --git a/plugins/nbconvert/fps_nbconvert/main.py b/plugins/nbconvert/fps_nbconvert/main.py index e49b439f..a18f568b 100644 --- a/plugins/nbconvert/fps_nbconvert/main.py +++ b/plugins/nbconvert/fps_nbconvert/main.py @@ -1,4 +1,4 @@ -from fastaio import Component +from fastaio import Module from jupyverse_api.app import App from jupyverse_api.auth import Auth @@ -7,10 +7,9 @@ from .routes import _Nbconvert -class NbconvertComponent(Component): +class NbconvertModule(Module): async def prepare(self) -> None: - app = await self.get_resource(App) - auth = await self.get_resource(Auth) + app = await self.get(App) + auth = await self.get(Auth) nbconvert = _Nbconvert(app, auth) - self.add_resource(nbconvert, types=Nbconvert) - self.done() + self.put(nbconvert, types=Nbconvert) diff --git a/plugins/nbconvert/pyproject.toml b/plugins/nbconvert/pyproject.toml index 2d3b9df5..1c765e51 100644 --- a/plugins/nbconvert/pyproject.toml +++ b/plugins/nbconvert/pyproject.toml @@ -33,8 +33,8 @@ ignore = [ ".*",] skip = [ "check-links",] [project.entry-points] -"fastaio.components" = {nbconvert = "fps_nbconvert.main:NbconvertComponent"} -"jupyverse.components" = {nbconvert = "fps_nbconvert.main:NbconvertComponent"} +"fastaio.modules" = {nbconvert = "fps_nbconvert.main:NbconvertModule"} +"jupyverse.modules" = {nbconvert = "fps_nbconvert.main:NbconvertModule"} [tool.hatch.version] path = "fps_nbconvert/__init__.py" diff --git a/plugins/noauth/MANIFEST.in b/plugins/noauth/MANIFEST.in deleted file mode 100644 index efa752ea..00000000 --- a/plugins/noauth/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include *.md diff --git a/plugins/noauth/fps_noauth/main.py b/plugins/noauth/fps_noauth/main.py index ba90c1b7..708fb1a0 100644 --- a/plugins/noauth/fps_noauth/main.py +++ b/plugins/noauth/fps_noauth/main.py @@ -1,12 +1,12 @@ -from fastaio import Component +from fastaio import Module from jupyverse_api.auth import Auth from .backends import _NoAuth -class NoAuthComponent(Component): +class NoAuthModule(Module): async def prepare(self) -> None: no_auth = _NoAuth() - self.add_resource(no_auth, types=Auth) + self.put(no_auth, types=Auth) self.done() diff --git a/plugins/noauth/pyproject.toml b/plugins/noauth/pyproject.toml index 3f680f2b..00d91521 100644 --- a/plugins/noauth/pyproject.toml +++ b/plugins/noauth/pyproject.toml @@ -27,8 +27,8 @@ text = "BSD 3-Clause License" Homepage = "https://jupyter.org" [project.entry-points] -"fastaio.components" = {auth = "fps_noauth.main:NoAuthComponent"} -"jupyverse.components" = {auth = "fps_noauth.main:NoAuthComponent"} +"fastaio.modules" = {auth = "fps_noauth.main:NoAuthModule"} +"jupyverse.modules" = {auth = "fps_noauth.main:NoAuthModule"} [tool.check-manifest] ignore = [ ".*",] diff --git a/plugins/notebook/MANIFEST.in b/plugins/notebook/MANIFEST.in deleted file mode 100644 index efa752ea..00000000 --- a/plugins/notebook/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include *.md diff --git a/plugins/notebook/fps_notebook/main.py b/plugins/notebook/fps_notebook/main.py index 1242c42e..3796360c 100644 --- a/plugins/notebook/fps_notebook/main.py +++ b/plugins/notebook/fps_notebook/main.py @@ -1,5 +1,5 @@ import structlog -from fastaio import Component +from fastaio import Module from jupyverse_api.app import App from jupyverse_api.auth import Auth @@ -12,14 +12,12 @@ logger = structlog.get_logger() -class NotebookComponent(Component): +class NotebookModule(Module): async def prepare(self) -> None: - app = await self.get_resource(App) - auth = await self.get_resource(Auth) - frontend_config = await self.get_resource(FrontendConfig) - lab = await self.get_resource(Lab) + app = await self.get(App) + auth = await self.get(Auth) + frontend_config = await self.get(FrontendConfig) + lab = await self.get(Lab) notebook = _Notebook(app, auth, frontend_config, lab) - self.add_resource(notebook, types=Notebook) - - self.done() + self.put(notebook, types=Notebook) diff --git a/plugins/notebook/pyproject.toml b/plugins/notebook/pyproject.toml index 866304e2..20d4d2fa 100644 --- a/plugins/notebook/pyproject.toml +++ b/plugins/notebook/pyproject.toml @@ -33,7 +33,7 @@ ignore = [ ".*",] skip = [ "check-links",] [project.entry-points] -"jupyverse.components" = {notebook = "fps_notebook.main:NotebookComponent"} +"jupyverse.modules" = {notebook = "fps_notebook.main:NotebookModule"} [tool.hatch.version] path = "fps_notebook/__init__.py" diff --git a/plugins/resource_usage/fps_resource_usage/main.py b/plugins/resource_usage/fps_resource_usage/main.py index 4894c57d..d2f0a475 100644 --- a/plugins/resource_usage/fps_resource_usage/main.py +++ b/plugins/resource_usage/fps_resource_usage/main.py @@ -1,4 +1,4 @@ -from fastaio import Component +from fastaio import Module from jupyverse_api.app import App from jupyverse_api.auth import Auth @@ -7,14 +7,14 @@ from .routes import _ResourceUsage -class ResourceUsageComponent(Component): +class ResourceUsageModule(Module): def __init__(self, name: str, **kwargs): super().__init__(name) self.resource_usage_config = ResourceUsageConfig(**kwargs) async def prepare(self) -> None: - app = await self.get_resource(App) - auth = await self.get_resource(Auth) + app = await self.get(App) + auth = await self.get(Auth) resource_usage = _ResourceUsage(app, auth, self.resource_usage_config) - self.add_resource(resource_usage, types=ResourceUsage) + self.put(resource_usage, types=ResourceUsage) diff --git a/plugins/resource_usage/pyproject.toml b/plugins/resource_usage/pyproject.toml index f0c9cb70..4476568b 100644 --- a/plugins/resource_usage/pyproject.toml +++ b/plugins/resource_usage/pyproject.toml @@ -35,8 +35,8 @@ ignore = [ ".*",] skip = [ "check-links",] [project.entry-points] -"fastaio.components" = {resource_usage = "fps_resource_usage.main:ResourceUsageComponent"} -"jupyverse.components" = {resource_usage = "fps_resource_usage.main:ResourceUsageComponent"} +"fastaio.modules" = {resource_usage = "fps_resource_usage.main:ResourceUsageModule"} +"jupyverse.modules" = {resource_usage = "fps_resource_usage.main:ResourceUsageModule"} [tool.hatch.version] path = "fps_resource_usage/__init__.py" diff --git a/plugins/terminals/MANIFEST.in b/plugins/terminals/MANIFEST.in deleted file mode 100644 index efa752ea..00000000 --- a/plugins/terminals/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include *.md diff --git a/plugins/terminals/fps_terminals/main.py b/plugins/terminals/fps_terminals/main.py index 4d1c5f41..ed4af4ba 100644 --- a/plugins/terminals/fps_terminals/main.py +++ b/plugins/terminals/fps_terminals/main.py @@ -2,7 +2,7 @@ from typing import Type from anyio import create_task_group -from fastaio import Component +from fastaio import Module from jupyverse_api.app import App from jupyverse_api.auth import Auth @@ -17,13 +17,13 @@ from .server import _TerminalServer -class TerminalsComponent(Component): +class TerminalsModule(Module): async def prepare(self) -> None: - app = await self.get_resource(App) - auth = await self.get_resource(Auth) + app = await self.get(App) + auth = await self.get(Auth) self.terminals = _Terminals(app, auth, _TerminalServer) - self.add_resource(self.terminals, types=Terminals) + self.put(self.terminals, types=Terminals) async with create_task_group() as tg: tg.start_soon(self.terminals.start) self.done() diff --git a/plugins/terminals/pyproject.toml b/plugins/terminals/pyproject.toml index 1ff21c20..1af02ccf 100644 --- a/plugins/terminals/pyproject.toml +++ b/plugins/terminals/pyproject.toml @@ -35,8 +35,8 @@ ignore = [ ".*",] skip = [ "check-links",] [project.entry-points] -"fastaio.components" = {terminals = "fps_terminals.main:TerminalsComponent"} -"jupyverse.components" = {terminals = "fps_terminals.main:TerminalsComponent"} +"fastaio.modules" = {terminals = "fps_terminals.main:TerminalsModule"} +"jupyverse.modules" = {terminals = "fps_terminals.main:TerminalsModule"} [tool.hatch.version] path = "fps_terminals/__init__.py" diff --git a/plugins/webdav/fps_webdav/main.py b/plugins/webdav/fps_webdav/main.py index 045f97f4..335ce6a1 100644 --- a/plugins/webdav/fps_webdav/main.py +++ b/plugins/webdav/fps_webdav/main.py @@ -1,4 +1,4 @@ -from fastaio import Component +from fastaio import Module from jupyverse_api.app import App @@ -6,13 +6,13 @@ from .routes import WebDAV -class WebDAVComponent(Component): +class WebDAVModule(Module): def __init__(self, name: str, **kwargs): super().__init__(name) self.webdav_config = WebDAVConfig(**kwargs) async def prepare(self) -> None: - app = await self.get_resource(App) + app = await self.get(App) webdav = WebDAV(app, self.webdav_config) - self.add_resource(webdav) + self.put(webdav) diff --git a/plugins/webdav/pyproject.toml b/plugins/webdav/pyproject.toml index a89494b2..5fd54222 100644 --- a/plugins/webdav/pyproject.toml +++ b/plugins/webdav/pyproject.toml @@ -39,8 +39,8 @@ ignore = [ ".*",] skip = [ "check-links",] [project.entry-points] -"fastaio.components" = {webdav = "fps_webdav.main:WebDAVComponent"} -"jupyverse.components" = {webdav = "fps_webdav.main:WebDAVComponent"} +"fastaio.modules" = {webdav = "fps_webdav.main:WebDAVModule"} +"jupyverse.modules" = {webdav = "fps_webdav.main:WebDAVModule"} [tool.hatch.version] path = "fps_webdav/__init__.py" diff --git a/plugins/webdav/tests/test_webdav.py b/plugins/webdav/tests/test_webdav.py index baed371e..48dbbc0b 100644 --- a/plugins/webdav/tests/test_webdav.py +++ b/plugins/webdav/tests/test_webdav.py @@ -5,14 +5,14 @@ import easywebdav # type: ignore import pytest from anyio import to_thread -from fastaio import get_root_component, merge_config +from fastaio import get_root_module, merge_config CONFIG = { "jupyverse": { - "type": "jupyverse_api.main:JupyverseComponent", - "components": { + "type": "jupyverse_api.main:JupyverseModule", + "modules": { "app": { - "type": "jupyverse_api.main:AppComponent", + "type": "jupyverse_api.main:AppModule", }, "webdav": { "type": "webdav", @@ -33,7 +33,7 @@ async def test_webdav(unused_tcp_port): "config": { "port": unused_tcp_port, }, - "components": { + "modules": { "webdav": { "config": { "account_mapping": [{"username": "foo", "password": "bar"}], @@ -43,7 +43,7 @@ async def test_webdav(unused_tcp_port): } } ) - async with get_root_component(config): + async with get_root_module(config): webdav = easywebdav.connect( "127.0.0.1", port=unused_tcp_port, path="webdav", username="foo", password="bar" ) diff --git a/plugins/yjs/MANIFEST.in b/plugins/yjs/MANIFEST.in deleted file mode 100644 index efa752ea..00000000 --- a/plugins/yjs/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include *.md diff --git a/plugins/yjs/fps_yjs/main.py b/plugins/yjs/fps_yjs/main.py index 21fcd5e1..5c85146c 100644 --- a/plugins/yjs/fps_yjs/main.py +++ b/plugins/yjs/fps_yjs/main.py @@ -1,7 +1,7 @@ from __future__ import annotations from anyio import create_task_group -from fastaio import Component +from fastaio import Module from jupyverse_api.app import App from jupyverse_api.auth import Auth @@ -12,21 +12,21 @@ from .routes import _Yjs -class YjsComponent(Component): +class YjsModule(Module): def __init__(self, name: str, **kwargs): super().__init__(name) self.yjs_config = YjsConfig(**kwargs) async def prepare(self) -> None: - self.add_resource(self.yjs_config, types=YjsConfig) + self.put(self.yjs_config, types=YjsConfig) - app = await self.get_resource(App) - auth = await self.get_resource(Auth) - self.contents = await self.get_resource(Contents) - lifespan = await self.get_resource(Lifespan) + app = await self.get(App) + auth = await self.get(Auth) + self.contents = await self.get(Contents) + lifespan = await self.get(Lifespan) self.yjs = _Yjs(app, auth, self.contents, lifespan) - self.add_resource(self.yjs, types=Yjs) + self.put(self.yjs, types=Yjs) async with create_task_group() as tg: tg.start_soon(self.yjs.start) diff --git a/plugins/yjs/pyproject.toml b/plugins/yjs/pyproject.toml index 8184d610..8b19cfb8 100644 --- a/plugins/yjs/pyproject.toml +++ b/plugins/yjs/pyproject.toml @@ -35,8 +35,8 @@ ignore = [ ".*",] skip = [ "check-links",] [project.entry-points] -"fastaio.components" = {yjs = "fps_yjs.main:YjsComponent"} -"jupyverse.components" = {yjs = "fps_yjs.main:YjsComponent"} +"fastaio.modules" = {yjs = "fps_yjs.main:YjsModule"} +"jupyverse.modules" = {yjs = "fps_yjs.main:YjsModule"} [project.entry-points.jupyverse_ydoc] blob = "fps_yjs.ydocs.yblob:YBlob" diff --git a/tests/test_app.py b/tests/test_app.py index 05facaad..41179082 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -1,5 +1,5 @@ import pytest -from fastaio import get_root_component +from fastaio import get_root_module from fastapi import APIRouter from httpx import AsyncClient @@ -22,7 +22,7 @@ async def test_mount_path(mount_path, unused_tcp_port): "config": { "port": unused_tcp_port, }, - "components": { + "modules": { "app": { "type": "app", "config": { @@ -33,8 +33,8 @@ async def test_mount_path(mount_path, unused_tcp_port): } } - async with AsyncClient() as http, get_root_component(config) as jupyverse_component: - app = await jupyverse_component.get_resource(App) + async with AsyncClient() as http, get_root_module(config) as jupyverse_module: + app = await jupyverse_module.get(App) router = APIRouter() @router.get("/") diff --git a/tests/test_auth.py b/tests/test_auth.py index a5a71672..8ec6bd09 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -1,5 +1,5 @@ import pytest -from fastaio import get_root_component, merge_config +from fastaio import get_root_module, merge_config from httpx import AsyncClient from httpx_ws import WebSocketUpgradeError, aconnect_ws from utils import authenticate_client @@ -9,7 +9,7 @@ CONFIG = { "jupyverse": { "type": "jupyverse", - "components": { + "modules": { "app": { "type": "app", }, @@ -45,7 +45,7 @@ @pytest.mark.anyio async def test_kernel_channels_unauthenticated(unused_tcp_port): config = merge_config(CONFIG, {"jupyverse": {"config": {"port": unused_tcp_port}}}) - async with get_root_component(config): + async with get_root_module(config): with pytest.raises(WebSocketUpgradeError): async with aconnect_ws( f"http://127.0.0.1:{unused_tcp_port}/api/kernels/kernel_id_0/channels?session_id=session_id_0", @@ -56,7 +56,7 @@ async def test_kernel_channels_unauthenticated(unused_tcp_port): @pytest.mark.anyio async def test_kernel_channels_authenticated(unused_tcp_port): config = merge_config(CONFIG, {"jupyverse": {"config": {"port": unused_tcp_port}}}) - async with get_root_component(config), AsyncClient() as http: + async with get_root_module(config), AsyncClient() as http: await authenticate_client(http, unused_tcp_port) async with aconnect_ws( f"http://127.0.0.1:{unused_tcp_port}/api/kernels/kernel_id_0/channels?session_id=session_id_0", @@ -73,7 +73,7 @@ async def test_root_auth(auth_mode, unused_tcp_port): { "jupyverse": { "config": {"port": unused_tcp_port}, - "components": { + "modules": { "auth": { "config": { "mode": auth_mode, @@ -83,7 +83,7 @@ async def test_root_auth(auth_mode, unused_tcp_port): } } ) - async with get_root_component(config), AsyncClient() as http: + async with get_root_module(config), AsyncClient() as http: response = await http.get(f"http://127.0.0.1:{unused_tcp_port}/") if auth_mode == "noauth": expected = 302 @@ -102,7 +102,7 @@ async def test_no_auth(auth_mode, unused_tcp_port): { "jupyverse": { "config": {"port": unused_tcp_port}, - "components": { + "modules": { "auth": { "config": { "mode": auth_mode, @@ -112,7 +112,7 @@ async def test_no_auth(auth_mode, unused_tcp_port): } } ) - async with get_root_component(config), AsyncClient() as http: + async with get_root_module(config), AsyncClient() as http: response = await http.get(f"http://127.0.0.1:{unused_tcp_port}/lab") assert response.status_code == 200 @@ -125,7 +125,7 @@ async def test_token_auth(auth_mode, unused_tcp_port): { "jupyverse": { "config": {"port": unused_tcp_port}, - "components": { + "modules": { "auth": { "config": { "mode": auth_mode, @@ -135,8 +135,8 @@ async def test_token_auth(auth_mode, unused_tcp_port): } } ) - async with get_root_component(config) as jupyverse, AsyncClient() as http: - auth_config = await jupyverse.get_resource(AuthConfig) + async with get_root_module(config) as jupyverse, AsyncClient() as http: + auth_config = await jupyverse.get(AuthConfig) # no token provided, should not work response = await http.get(f"http://127.0.0.1:{unused_tcp_port}/") @@ -161,7 +161,7 @@ async def test_permissions(auth_mode, permissions, unused_tcp_port): { "jupyverse": { "config": {"port": unused_tcp_port}, - "components": { + "modules": { "auth": { "config": { "mode": auth_mode, @@ -171,7 +171,7 @@ async def test_permissions(auth_mode, permissions, unused_tcp_port): } } ) - async with get_root_component(config), AsyncClient() as http: + async with get_root_module(config), AsyncClient() as http: await authenticate_client(http, unused_tcp_port, permissions=permissions) response = await http.get(f"http://127.0.0.1:{unused_tcp_port}/auth/user/me") if "admin" in permissions.keys(): diff --git a/tests/test_contents.py b/tests/test_contents.py index f88db0f6..86a0726e 100644 --- a/tests/test_contents.py +++ b/tests/test_contents.py @@ -2,14 +2,14 @@ from pathlib import Path import pytest -from fastaio import get_root_component, merge_config +from fastaio import get_root_module, merge_config from httpx import AsyncClient from utils import clear_content_values, create_content, sort_content_by_name CONFIG = { "jupyverse": { "type": "jupyverse", - "components": { + "modules": { "app": { "type": "app", }, @@ -83,7 +83,7 @@ async def test_tree(auth_mode, tmp_path, unused_tcp_port): { "jupyverse": { "config": {"port": unused_tcp_port}, - "components": { + "modules": { "auth": { "config": { "mode": auth_mode, @@ -93,7 +93,7 @@ async def test_tree(auth_mode, tmp_path, unused_tcp_port): } } ) - async with get_root_component(config), AsyncClient() as http: + async with get_root_module(config), AsyncClient() as http: response = await http.get( f"http://127.0.0.1:{unused_tcp_port}/api/contents", params={"content": 1} ) diff --git a/tests/test_execute.py b/tests/test_execute.py index 3921d3b1..dde252d8 100644 --- a/tests/test_execute.py +++ b/tests/test_execute.py @@ -4,7 +4,7 @@ import anyio import pytest -from fastaio import get_root_component, merge_config +from fastaio import get_root_module, merge_config from fps_yjs.ydocs import ydocs from fps_yjs.ywebsocket import WebsocketProvider from httpx import AsyncClient @@ -16,7 +16,7 @@ CONFIG = { "jupyverse": { "type": "jupyverse", - "components": { + "modules": { "app": { "type": "app", }, @@ -85,7 +85,7 @@ async def test_execute(auth_mode, unused_tcp_port): { "jupyverse": { "config": {"port": unused_tcp_port}, - "components": { + "modules": { "auth": { "config": { "mode": auth_mode, @@ -100,7 +100,7 @@ async def test_execute(auth_mode, unused_tcp_port): } } ) - async with get_root_component(config), AsyncClient() as http: + async with get_root_module(config), AsyncClient() as http: ws_url = url.replace("http", "ws", 1) name = "notebook1.ipynb" path = (Path("tests") / "data" / name).as_posix() diff --git a/tests/test_kernels.py b/tests/test_kernels.py index bae7e1ff..984a0964 100644 --- a/tests/test_kernels.py +++ b/tests/test_kernels.py @@ -5,7 +5,7 @@ import pytest from anyio import create_task_group -from fastaio import get_root_component, merge_config +from fastaio import get_root_module, merge_config from fps_kernels.kernel_server.server import KernelServer, kernels from httpx import AsyncClient from httpx_ws import aconnect_ws @@ -15,7 +15,7 @@ CONFIG = { "jupyverse": { "type": "jupyverse", - "components": { + "modules": { "app": { "type": "app", }, @@ -78,7 +78,7 @@ async def test_kernel_messages(auth_mode, capfd, unused_tcp_port): { "jupyverse": { "config": {"port": unused_tcp_port}, - "components": { + "modules": { "auth": { "config": { "mode": auth_mode, @@ -88,7 +88,7 @@ async def test_kernel_messages(auth_mode, capfd, unused_tcp_port): } } ) - async with get_root_component(config), AsyncClient(): + async with get_root_module(config), AsyncClient(): # block msg_type_0 msg["header"]["msg_id"] = str(int(msg["header"]["msg_id"]) + 1) kernel_server.block_messages("msg_type_0") diff --git a/tests/test_settings.py b/tests/test_settings.py index fc0d9929..1ed2f6c7 100644 --- a/tests/test_settings.py +++ b/tests/test_settings.py @@ -1,7 +1,7 @@ import json import pytest -from fastaio import get_root_component, merge_config +from fastaio import get_root_module, merge_config from httpx import AsyncClient test_theme = {"raw": '{// jupyverse test\n"theme": "JupyterLab Dark"}'} @@ -9,7 +9,7 @@ CONFIG = { "jupyverse": { "type": "jupyverse", - "components": { + "modules": { "app": { "type": "app", }, @@ -50,7 +50,7 @@ async def test_settings(auth_mode, unused_tcp_port): { "jupyverse": { "config": {"port": unused_tcp_port}, - "components": { + "modules": { "auth": { "config": { "mode": auth_mode, @@ -60,7 +60,7 @@ async def test_settings(auth_mode, unused_tcp_port): } } ) - async with get_root_component(config), AsyncClient() as http: + async with get_root_module(config), AsyncClient() as http: # get previous theme response = await http.get( f"http://127.0.0.1:{unused_tcp_port}/lab/api/settings/@jupyterlab/apputils-extension:themes"