Skip to content

ENH: Add optional JupyterLite support prototype for documentation interactivity#13666

Open
aman-coder03 wants to merge 7 commits intomne-tools:mainfrom
aman-coder03:enh-jupyterlite-prototype
Open

ENH: Add optional JupyterLite support prototype for documentation interactivity#13666
aman-coder03 wants to merge 7 commits intomne-tools:mainfrom
aman-coder03:enh-jupyterlite-prototype

Conversation

@aman-coder03
Copy link
Contributor

Reference issue (if any)

Refs #13660.

What does this implement/fix?

This PR adds optional support for the jupyterlite_sphinx extension in the
documentation configuration (doc/conf.py) as an initial step toward enabling
interactive examples using JupyterLite.

The extension is only enabled when the environment variable
MNE_ENABLE_JUPYTERLITE=true is set and the dependency is installed. This keeps
the default documentation build and CI unchanged while allowing JupyterLite to
be tested locally or in future integrations.

The goal is to establish a safe starting point for experimenting with interactive
sphinx-gallery examples, in line with the documentation interactivity roadmap.

Additional information

This change does not alter any existing examples or documentation behavior by
default. It simply adds a configuration hook so that JupyterLite support can be
incrementally explored and expanded in follow-up PRs.

Happy to adjust the approach if there is a preferred way to integrate this.

@aman-coder03
Copy link
Contributor Author

@drammock can you please have a look at this?

@drammock
Copy link
Member

Sorry for the slow reply. I think this PR should modify 1 page in the docs to actually embed a jupyterlite interactive terminal so we can test it out on the CI-rendered docs page. Once we know it's working, we can discuss how to proceed (1 page at a time vs lots of pages at once; whether every tutorial gets it or only certain ones; whether the env var is the right way to turn it on/off; etc)

@aman-coder03
Copy link
Contributor Author

i think tutorials/simulation/10_array_objs.py is the best candidate as it uses only numpy and mne with no dataset downloads, creating everything from scratch. I will embed the JupyterLite terminal there and push an update

@drammock
Copy link
Member

https://app.circleci.com/pipelines/github/mne-tools/mne-python/30355/workflows/e610a870-46de-4847-bc09-be803fac0f72/jobs/79370?invite=true#step-142-14911_0

Traceback
=========

    Traceback (most recent call last):
      File "/home/circleci/python_env/lib/python3.12/site-packages/sphinx/events.py", line 441, in emit
        results.append(listener.handler(self._app, *args))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/circleci/python_env/lib/python3.12/site-packages/jupyterlite_sphinx/jupyterlite_sphinx.py", line 1094, in jupyterlite_build
        assert all(
               ^^^^
    AssertionError: Expected all commands arguments to be a str, got ['/home/circleci/python_env/bin/python', '-m', 'jupyter', 'lite', 'build', '--debug', '--config', {'LiteBuildConfig': {'apps': ['lab']}}, '--contents', '/home/circleci/project/doc/jupyterlite_contents', '--contents', '/home/circleci/project/doc/_contents', '--output-dir', '/home/circleci/project/doc/_build/html/lite', '--apps', 'notebooks', '--apps', 'edit', '--apps', 'lab', '--apps', 'repl', '--apps', 'tree', '--apps', 'consoles', '--lite-dir', '/home/circleci/project/doc']

looks like the problem is {'LiteBuildConfig': {'apps': ['lab']}} not being a string?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants