Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jupyterlite_contents paths not picked up if run from outside of app.srcdir #261

Open
LoicGrobol opened this issue Jan 25, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@LoicGrobol
Copy link

When the top build command is run outside of Sphinx' srcdir (which is the case when buliding from Jupyterbook for instance) the following happens:

  1. jupyterlite_contents path are expanded with glob using the cwd as root. This means that paths that don't exist after expansion are removed from the list.
  2. jupyter lite build is invoked using app.srcdir as cwd.

So say I have the following structure

repo
└── book
    ├── conf.py
    └── notebooks
        └── nb.ipynb

To build the book, I have to run Jupyterbook in repo and I want notebooks/ to be in jupyterlite_contents.

  • If I set jupyterlite_contents = ["book/notebooks"], glob in 1. will be able to find it since for glob, the root dir is repo, but when jupyter lite build runs in 2., since its cwd is book, it won't find book/notebooks and the build will fail.
  • If I set jupyterlite_contents = ["notebooks"] instead, glob in 1. won't find it, sot it will silently remove it from the list. The build will succeed but the notebook won't be picked up.

Either way, I can't get notebook in my build if it's not run from app.srcdir.

A simple fix would be to set glob's rootdir parameter to src.appdir. It would still allow adding paths outside of the appdir using ... I can send a PR as soon as I have you go, or as soon as we figure out another solution if this one doesn't work, as I am very interested in having this fixed :-)

@LoicGrobol LoicGrobol added the bug Something isn't working label Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant