From e75d501510d8a44e9d0188510df40a160ad8d55d Mon Sep 17 00:00:00 2001 From: martinRenou Date: Wed, 8 Nov 2023 14:16:48 +0100 Subject: [PATCH 1/2] Support both jupyterlite 0.1 and 0.2 --- jupyterlite_xeus_python/env_build_addon.py | 14 +++++++++----- setup.py | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/jupyterlite_xeus_python/env_build_addon.py b/jupyterlite_xeus_python/env_build_addon.py index 037350a..9cbc482 100644 --- a/jupyterlite_xeus_python/env_build_addon.py +++ b/jupyterlite_xeus_python/env_build_addon.py @@ -22,10 +22,7 @@ UTF8, FEDERATED_EXTENSIONS, ) -from jupyterlite_core.addons.federated_extensions import ( - FederatedExtensionAddon, - ENV_EXTENSIONS, -) +from jupyterlite_core.addons.federated_extensions import FederatedExtensionAddon from .build import XEUS_PYTHON_VERSION, build_and_pack_emscripten_env @@ -73,8 +70,15 @@ def __init__(self, *args, **kwargs): def post_build(self, manager): """yield a doit task to create the emscripten-32 env and grab anything we need from it""" + try: + # JupyterLite 0.1.x + from jupyterlite_core.addons.federated_extensions import ENV_EXTENSIONS as env_extensions + except ImportError: + # JupyterLite 0.2.x + env_extensions = self.labextensions_path + # Install the jupyterlite-xeus-python ourselves - for pkg_json in self.env_extensions(ENV_EXTENSIONS): + for pkg_json in self.env_extensions(env_extensions): pkg_data = json.loads(pkg_json.read_text(**UTF8)) if pkg_data.get("name") == JUPYTERLITE_XEUS_PYTHON: yield from self.safe_copy_extension(pkg_json) diff --git a/setup.py b/setup.py index fc31e41..8141efa 100644 --- a/setup.py +++ b/setup.py @@ -59,7 +59,7 @@ packages=setuptools.find_packages(exclude=["tests"]), install_requires=[ "traitlets", - "jupyterlite-core>=0.1,<0.2", + "jupyterlite-core>=0.1,<0.3", "requests", "empack>=3.1,<4", "typer", From c39538604f20c793e2f5f99d65b1165d796c8f3e Mon Sep 17 00:00:00 2001 From: martinRenou Date: Wed, 8 Nov 2023 14:17:54 +0100 Subject: [PATCH 2/2] Update jupyterlite in docs --- docs/build-environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build-environment.yml b/docs/build-environment.yml index 7b8c98b..8fff76f 100644 --- a/docs/build-environment.yml +++ b/docs/build-environment.yml @@ -13,7 +13,7 @@ dependencies: - pydata-sphinx-theme - yarn - jupyterlab >=3.5.3,<3.6 - - jupyterlite-core >=0.1.0,<0.2.0 + - jupyterlite-core >=0.1.0,<0.3.0 - jupyterlite-sphinx >=0.9.1 - empack >=3.1.0 - pip: