Create sphinx-autobuild.sh

This commit is contained in:
Tom van Woudenberg 2026-01-12 13:23:56 +01:00
parent 6f44de51c0
commit c51586746c

27
sphinx-autobuild.sh Normal file
View file

@ -0,0 +1,27 @@
# Deactivate any active conda environment
conda deactivate 2>/dev/null || true
# Clear conda environment variables
unset CONDA_DEFAULT_ENV CONDA_PROMPT_MODIFIER 2>/dev/null || true
# Create a Python virtual environment
python -m venv venv
# Activate the virtual environment
source venv/Scripts/activate
# Install required packages from requirements.txt and sphinx-autobuild
pip install -r requirements.txt sphinx-autobuild
# Initialize Jupyter Book configuration for the book directory
jupyter-book config sphinx book/
# Disable display of all git authors in Sphinx documentation
# by changing 'git_show_all_authors' from True to False in conf.py
sed -i 's/git_show_all_authors = True/git_show_all_authors = False/' book/conf.py
sed -i "s/external_toc_path = '_toc.yml'/external_toc_path = '_toc_with_local_paths.yml'/" book/conf.py
# Build and serve the Sphinx documentation with auto-reload
# Opens browser automatically and ignores build artifacts and Python files
sphinx-autobuild book book/_build/html --open-browser --ignore "book/_build/**" --pre-build "teachbooks build book/ --process-only"