Build a Tutorial Site#
This site is a Jupyter Book deployed to GitHub Pages. The setup below can be reused for another notebook-based tutorial collection.
Prerequisites#
A GitHub repository (this one:
DaminK/AnnData_Pytorch_Tutorials)Push access to the repository
Setup Steps#
1. Enable GitHub Pages#
Go to your repository on GitHub: DaminK/AnnData_Pytorch_Tutorials
Click on Settings (top right)
In the left sidebar, click on Pages
Under “Build and deployment”:
Source: Select GitHub Actions
This will allow the workflow in
.github/workflows/deploy.ymlto deploy to GitHub Pages
2. Workflow Permissions#
In the same Settings area, go to Actions > General (in the left sidebar)
Scroll down to “Workflow permissions”
Select Read and write permissions
Check Allow GitHub Actions to create and approve pull requests (optional but helpful)
Click Save
3. Trigger the Deployment#
The workflow will automatically trigger when you push to the main branch. You can also:
Go to Actions tab in your repository
Select the “Deploy Jupyter Book” workflow
Click Run workflow > Run workflow to manually trigger it
During the workflow:
Notebooks are copied into
docs/notebooks/so they are bundled into the siteJupyter Book executes notebooks (with caching) so outputs are published to GitHub Pages
4. Wait for Deployment#
The workflow takes a few minutes to complete
You can monitor progress in the Actions tab
Once complete, your site will be available at: https://damink.github.io/AnnData_Pytorch_Tutorials/
Updating the Tutorials#
To update the tutorials:
Make changes to the notebooks or documentation files
Commit and push to the
mainbranchThe GitHub Actions workflow will automatically rebuild and deploy the site
Local Development#
To build and preview the site locally:
python -m venv .venv
source .venv/bin/activate # On Windows use: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
pip install "jupyter-book<1.0"
# Copy notebooks into the docs tree so they are included in the build
rsync -a notebooks/ docs/notebooks/
# Build the book
cd docs
jupyter-book build .
# Open the built HTML in your browser
# The file is at: _build/html/index.html
Troubleshooting#
Build Fails#
Check the Actions tab for error messages
Ensure all dependencies are listed in
requirements.txtVerify the
_config.ymland_toc.ymlfiles are correctly formatted
Site Not Updating#
Check that the workflow completed successfully in the Actions tab
GitHub Pages may take a few minutes to update after deployment
Clear your browser cache
Notebooks Not Rendering#
Ensure notebooks are valid JSON (not corrupted)
Check that notebooks are listed in
_toc.ymlReview the build logs in the Actions tab
Configuration Files#
_config.yml: Main configuration for Jupyter Book_toc.yml: Table of contents structure.github/workflows/deploy.yml: GitHub Actions deployment workflow