jupyterlite / jupyterlite-sphinx

Sphinx extension using JupyterLite to render Notebooks
https://jupyterlite-sphinx.readthedocs.io/en/latest
BSD 3-Clause "New" or "Revised" License
67 stars 20 forks source link

Copy executable docs listed in _toc.yml over to /files #48

Open psychemedia opened 2 years ago

psychemedia commented 2 years ago

The demo executable-book PR https://github.com/executablebooks/sphinx-book-theme/pull/558 adds a "Launch in Jupterlite" button to Jupyter Book.

At the moment, the user must manually copy over notebook files to the distribution.

Ideally,jupyterlite-sphinx should copy over executable documents (that can be legitimately launched in JupyterLite) that are listed in _toc.yml over to the distribution directory (eg _build/html/lite/files). There also needs to be a mechanism to copy over additional files referenced from the notebooks.

I'm a little wary that a blanket "copy over all the contents of a specified directory" is too heavyweight, and might copy over unpublished book files that are not listed in _toc.yml over to the JupyterLite file tree.

psychemedia commented 2 years ago

PR https://github.com/jupyterlite/jupyterlite-sphinx/commit/944ccf4ee977627dbf75b5ae1994c08718566c76 seems to support a jupyterlite_contents setting in conf.py that will copy path contents over to the distribution.

It might perhaps be handy to be able to ignore specified files in that directory too?

psychemedia commented 2 years ago

Contents can be copied over to files based on glob pattern matching in https://github.com/jupyterlite/jupyterlite-sphinx/pull/73/commits/6730bef7567ed8ace528c241999d04f6b7418f55 . Would it also make sense to see if the match pattern is actually a file path, eg to a _toc.yml type file, and use that as basis for copying over files?