From 088beffc1713d4174266a0cb30a181aa788682ee Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 25 Feb 2026 05:44:14 +0530 Subject: [PATCH 1/4] Add "markdown" extra dependency --- dev-environment.yml | 2 +- pyproject.toml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dev-environment.yml b/dev-environment.yml index 9e260ab3..84a9d493 100644 --- a/dev-environment.yml +++ b/dev-environment.yml @@ -15,5 +15,5 @@ dependencies: - black - voici - pip: - - . + - ."[markdown]" - jupyterlite-xeus >=2.1.2 diff --git a/pyproject.toml b/pyproject.toml index c8ce3e3d..6219cc8a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,12 +17,14 @@ dependencies = [ "jupyter_server", "jupyterlab_server", "jupyterlite-core >=0.2,<0.8", - "jupytext", "nbformat", "sphinx>=4", ] [project.optional-dependencies] +markdown = ["jupytext"] + +[dependency-groups] dev = [ "hatch", ] From 99b721d754980ab8bdac1fed7397d7fac1f2fd44 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 25 Feb 2026 05:47:45 +0530 Subject: [PATCH 2/4] Guard `jupytext` import and raise helpful error --- jupyterlite_sphinx/jupyterlite_sphinx.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/jupyterlite_sphinx/jupyterlite_sphinx.py b/jupyterlite_sphinx/jupyterlite_sphinx.py index 76ec2b2c..69ee6397 100644 --- a/jupyterlite_sphinx/jupyterlite_sphinx.py +++ b/jupyterlite_sphinx/jupyterlite_sphinx.py @@ -28,9 +28,13 @@ new_code_cell, ) -import jupytext import nbformat +try: + import jupytext +except ImportError: + jupytext = None + try: import voici except ImportError: @@ -617,6 +621,11 @@ def run(self): notebook_is_stripped: bool = self.env.config.strip_tagged_cells if notebook_path.suffix.lower() == ".md": + if jupytext is None: + raise ImportError( + "jupyterlite-sphinx requires the jupytext package to process Markdown notebooks. " + 'Install it with: pip install "jupyterlite-sphinx[markdown]"' + ) if self._target_is_stale(notebook_path, target_path): nb = jupytext.read(str(notebook_path)) if notebook_is_stripped: From 6496cba2b94596aca4022c4488b337a1d7b52cb7 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 25 Feb 2026 05:55:07 +0530 Subject: [PATCH 3/4] Remove extra quotes from environment file --- dev-environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-environment.yml b/dev-environment.yml index 84a9d493..2c2a4099 100644 --- a/dev-environment.yml +++ b/dev-environment.yml @@ -15,5 +15,5 @@ dependencies: - black - voici - pip: - - ."[markdown]" + - .[markdown] - jupyterlite-xeus >=2.1.2 From f9f15860a034921e0c53fbac389536bed0059e0c Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 25 Feb 2026 06:43:17 +0530 Subject: [PATCH 4/4] Avoid restricting installation instructions to be specific to `pip`/PyPI Co-authored-by: Matt Fisher <3608264+mfisher87@users.noreply.github.com> --- jupyterlite_sphinx/jupyterlite_sphinx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyterlite_sphinx/jupyterlite_sphinx.py b/jupyterlite_sphinx/jupyterlite_sphinx.py index 69ee6397..c0bfa443 100644 --- a/jupyterlite_sphinx/jupyterlite_sphinx.py +++ b/jupyterlite_sphinx/jupyterlite_sphinx.py @@ -624,7 +624,7 @@ def run(self): if jupytext is None: raise ImportError( "jupyterlite-sphinx requires the jupytext package to process Markdown notebooks. " - 'Install it with: pip install "jupyterlite-sphinx[markdown]"' + 'Install "jupyterlite-sphinx[markdown]" with your package manager of choice.' ) if self._target_is_stale(notebook_path, target_path): nb = jupytext.read(str(notebook_path))