Un-flatten JupyterLite contents: preserve notebook paths and directory structure - #337
Merged
martinRenou merged 4 commits intoAug 11, 2026
Merged
Conversation
Member
Author
|
@mfisher87, I noticed that you opened #307. This is sort of related to the issue, since it should partially fix the flattening out of the
|
Member
|
I took the liberty to rebase and fix conflicts, hope you don't mind! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, when support for Markdown-based notebooks was added in #221, we added mechanisms to handle potential notebook name collisions and hoped that no one in the wild would have two notebooks of the same name across their docs directories and subdirectories. This is because we currently "flatten" all notebooks marked for inclusion on the JupyterLite site via directives into a single
/path/to/docs/lite/files/folder. I have started to think that it is a bad idea, since the contemporary Sphinx-Gallery does not do that as part of its JupyterLite integration and preserves the entire nested structure of the notebooks.This PR stops doing so. We can now have notebooks with the same filename, say,
my_notebook.ipynb, placed in two distinct folders, as the directory structure will be preserved. We can't have notebooks of the same filename under the same folder anyway, as that will be restricted by the file system :DI have removed the
_assert_no_conflicting_nb_namescheck and preserved relative notebook paths when converting/copying. Additionally,jupyterlite_contentsentries that are directories are now copied into the_contents/staging area rather than being passed directly as--contentsarguments tojupyter lite build. This will help preserve the directory name in the JupyterLite file system: previously, passing--contents custom_contentscaused JupyterLite to treat that directory as a content root, placing its files at the root of files/ rather than under files/custom_contents/. Routing them through_contents/, which is already passed as a single--contentsargument, ensures the directory name will be retained.