You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pre_executed directory is not excluded from pre-commit's sphinx-build #543
Reproducible example, it uses v2.0.7 because of #542
# Initialize a new project
copier copy gh:lincc-frameworks/python-project-template -r v2.0.7 new_project
## Select simple and and answer other questions
cd new_project
python3 -mvenv ~/.virtualenvs/new_project && source ~/.virtualenvs/new_project/bin/activate
bash .initialize_new_project.sh
# Create a notebook which creates Hello.text file on run
python -m pip install jupytext
echo 'print("Hello, world!")' > hello_world.py
python -m jupytext --to ipynb --output docs/pre_executed/hello_world.ipynb hello_world.py
# Test that the does NOT exist
test -f Hello.text && exit 1
test -f docs/pre_executed/Hello.text && exit 1
# Commit and see that notebook has been run
git switch -c new-branch
git add docs/pre_executed/hello_world.ipynb
git commit -m "Hello"
# Fail appeared
test -f docs/pre_executed/Hello.text && exit 1 # FAILS
As I understand, the notebook rendering tool will try to run a notebook if it doesn't have any output cells already. So the notebooks we'd typically have that are really pre-executed will have output cells. Those notebooks may also contain the following metadata block:
"nbsphinx": {
"execute": "never"
},
If you execute the notebook outside the pre-commit, delete the canary file, then attempt to run the pre-commit, will the notebook still be run and file created?
Activity
delucchi-cmu commentedon Oct 8, 2025
As I understand, the notebook rendering tool will try to run a notebook if it doesn't have any output cells already. So the notebooks we'd typically have that are really pre-executed will have output cells. Those notebooks may also contain the following metadata block:
If you execute the notebook outside the pre-commit, delete the canary file, then attempt to run the pre-commit, will the notebook still be run and file created?
delucchi-cmu commentedon Jan 26, 2026
#549 will remove the
sphinx-buildstage entirely from pre-commit.