Skip to content

do not execute notebooks - #93

Merged
jcharkow merged 5 commits into
mainfrom
no_execute_nb
Aug 5, 2025
Merged

do not execute notebooks#93
jcharkow merged 5 commits into
mainfrom
no_execute_nb

Conversation

@jcharkow

@jcharkow jcharkow commented Aug 5, 2025

Copy link
Copy Markdown
Collaborator

See if RTD builds work if do not execute notebooks

Summary by CodeRabbit

  • Documentation
    • Updated documentation build settings to prevent automatic execution of Jupyter notebooks during the build process.
  • Chores
    • Added a new workflow to automatically execute and validate Jupyter notebooks on code changes and manual triggers.

@coderabbitai

coderabbitai Bot commented Aug 5, 2025

Copy link
Copy Markdown

Walkthrough

The Sphinx documentation configuration was updated to disable automatic execution of Jupyter notebooks during builds by changing the nbsphinx_execute option from "always" to "never". Additionally, a new GitHub Actions workflow was added to execute notebooks on pushes, pull requests, and manual triggers, ensuring notebooks run and outputs are updated outside the documentation build process.

Changes

Cohort / File(s) Change Summary
Sphinx nbsphinx Execution Config
docs/conf.py
Changed nbsphinx_execute setting from "always" to "never", disabling notebook execution during Sphinx documentation builds.
GitHub Actions Notebook Execution Workflow
.github/workflows/execute_notebooks.yml
Added a new workflow to execute specified Jupyter notebooks on pushes, pull requests, and manual triggers; clears outputs, runs notebooks with timeout, commits changes if any. The workflow references an undefined output variable for change detection and commit steps.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A rabbit hopped through docs today,
Tweaked a knob, then hopped away.
"No more notebooks run!" it cried,
As Sphinx and nbsphinx now abide.
But GitHub’s paws now take the stage,
Running notebooks off the page! 🐇📓✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch no_execute_nb

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
docs/conf.py (1)

319-321: Gate notebook execution via environment variable instead of hard-coding.

Hard-coding nbsphinx_execute = "never" stops all local builds from executing notebooks as well. A more flexible pattern is to disable execution only on RTD (or CI) and keep the default ("auto"/"always") for local docs so developers still catch notebook issues early.

-# Always skip execution (RTD test build)
-nbsphinx_execute = "never"
+# Skip execution on RTD/CI, run notebooks locally
+if os.environ.get("READTHEDOCS") == "True":
+    nbsphinx_execute = "never"
+else:
+    # Use "auto" to execute notebooks only if their output is missing/outdated
+    nbsphinx_execute = "auto"

This keeps local feedback loops fast while still meeting the PR objective of avoiding execution in the RTD builders.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2f19830 and 7ba0566.

📒 Files selected for processing (1)
  • docs/conf.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build
  • GitHub Check: test (windows-latest, 3.12)
  • GitHub Check: test (windows-latest, 3.12)

@github-actions

github-actions Bot commented Aug 5, 2025

Copy link
Copy Markdown
Contributor

📖 Documentation Preview

The documentation for this PR has been built and is available at:
🔗 View Preview

This preview will be updated automatically when you push new commits to this PR.


Preview built from commit: de1dc89

github-actions Bot added a commit that referenced this pull request Aug 5, 2025
@github-actions

github-actions Bot commented Aug 5, 2025

Copy link
Copy Markdown
Contributor

📖 Documentation Preview

The documentation for this PR has been built and is available at:
🔗 View Preview

This preview will be updated automatically when you push new commits to this PR.


Preview built from commit: 8759404

github-actions Bot added a commit that referenced this pull request Aug 5, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
.github/workflows/execute_notebooks.yml (2)

29-33: Bump actions/setup-python to the latest major

v5 is now the current major and brings cache-key fixes and Python 3.13 preview images. Staying on v4 risks deprecation warnings soon.

-      uses: actions/setup-python@v4
+      uses: actions/setup-python@v5

35-46: Make APT non-interactive and explicit

Without -y, apt install can hang if a prompt is ever shown. Using apt-get is also the conventional choice in CI.

-        sudo apt update
-        sudo apt install pandoc
+        sudo apt-get update -y
+        sudo apt-get install -y pandoc
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7ba0566 and bd40e6c.

📒 Files selected for processing (1)
  • .github/workflows/execute_notebooks.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/execute_notebooks.yml

30-30: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


81-81: property "verify-changed-files" is not defined in object type {}

(expression)


86-86: property "verify-changed-files" is not defined in object type {}

(expression)

🪛 YAMLlint (1.37.1)
.github/workflows/execute_notebooks.yml

[error] 21-21: trailing spaces

(trailing-spaces)


[warning] 23-23: wrong indentation: expected 6 but found 4

(indentation)


[error] 40-40: trailing spaces

(trailing-spaces)


[error] 61-61: trailing spaces

(trailing-spaces)


[error] 71-71: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build
  • GitHub Check: test (windows-latest, 3.12)
  • GitHub Check: test (windows-latest, 3.12)

Comment thread .github/workflows/execute_notebooks.yml Outdated
Comment thread .github/workflows/execute_notebooks.yml Outdated
Comment thread .github/workflows/execute_notebooks.yml Outdated
Comment on lines +81 to +88
if: steps.verify-changed-files.outputs.changed == 'true' && github.event_name != 'pull_request'
run: |
git push origin ${{ github.ref_name }}

- name: Summary
run: |
if [ "${{ steps.verify-changed-files.outputs.changed }}" == "true" ]; then
echo "✅ Notebooks executed successfully and changes committed"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Undefined verify-changed-files output

The if: expressions reference steps.verify-changed-files, but no step with that ID exists, so the expression resolves to null and the workflow will fail during JSON-pointer evaluation.

Either add the missing step (e.g. tj-actions/verify-changed-files) or drop the conditional:

-      if: steps.verify-changed-files.outputs.changed == 'true' && github.event_name != 'pull_request'
+      if: github.event_name != 'pull_request' && git diff --quiet HEAD || echo "changes"

Adjust the summary step similarly.

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 actionlint (1.7.7)

81-81: property "verify-changed-files" is not defined in object type {}

(expression)


86-86: property "verify-changed-files" is not defined in object type {}

(expression)

🤖 Prompt for AI Agents
In .github/workflows/execute_notebooks.yml around lines 81 to 88, the workflow
references outputs from a step with ID 'verify-changed-files' which does not
exist, causing the workflow to fail. To fix this, either add the missing step
that sets this output (such as using the 'tj-actions/verify-changed-files'
action with the ID 'verify-changed-files') before these lines, or remove the
conditional checks that reference 'steps.verify-changed-files.outputs.changed'
in both the push and summary steps to avoid using undefined outputs.

@github-actions

github-actions Bot commented Aug 5, 2025

Copy link
Copy Markdown
Contributor

📖 Documentation Preview

The documentation for this PR has been built and is available at:
🔗 View Preview

This preview will be updated automatically when you push new commits to this PR.


Preview built from commit: 2745ed6

github-actions Bot added a commit that referenced this pull request Aug 5, 2025
@github-actions

github-actions Bot commented Aug 5, 2025

Copy link
Copy Markdown
Contributor

📖 Documentation Preview

The documentation for this PR has been built and is available at:
🔗 View Preview

This preview will be updated automatically when you push new commits to this PR.


Preview built from commit: 9167b83

github-actions Bot added a commit that referenced this pull request Aug 5, 2025
@github-actions

github-actions Bot commented Aug 5, 2025

Copy link
Copy Markdown
Contributor

📖 Documentation Preview

The documentation for this PR has been built and is available at:
🔗 View Preview

This preview will be updated automatically when you push new commits to this PR.


Preview built from commit: eb49cbf

github-actions Bot added a commit that referenced this pull request Aug 5, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
.github/workflows/execute_notebooks.yml (1)

81-88: Undefined verify-changed-files reference will make the workflow fail

if: steps.verify-changed-files.outputs.changed … is still present, but no step with the ID verify-changed-files is defined, so the expression resolves to null and GitHub Actions aborts before this step even runs.
This exact problem was raised in the previous review and has not been addressed.

+      # Detect whether any notebook files changed after execution
+      - name: Verify changed files
+        id: verify-changed-files
+        uses: tj-actions/verify-changed-files@v18
+        with:
+          files: |
+            docs/**/*.ipynb

Then keep the existing Push changes / Summary if: expressions.

🧹 Nitpick comments (2)
.github/workflows/execute_notebooks.yml (2)

39-40: Make APT installs non-interactive

apt install can prompt for confirmation and hang a CI job. Pass -y (or use apt-get) to ensure unattended execution.

-          sudo apt update
-          sudo apt install pandoc
+          sudo apt-get update -y
+          sudo apt-get install -y pandoc

57-58: Only notebooks under docs/Data Formatting/ are discovered

If additional notebooks exist directly under docs/ (besides Getting Started), they won’t be executed. A broader search keeps the list maintenance-free.

-          find "docs/Data Formatting/" -name "*.ipynb" > notebooks_to_execute.txt
-          echo "docs/Getting Started.ipynb" >> notebooks_to_execute.txt
+          find docs -maxdepth 2 -name "*.ipynb" > notebooks_to_execute.txt
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd40e6c and 945a530.

📒 Files selected for processing (1)
  • .github/workflows/execute_notebooks.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/execute_notebooks.yml

31-31: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


82-82: property "verify-changed-files" is not defined in object type {}

(expression)


87-87: property "verify-changed-files" is not defined in object type {}

(expression)

🪛 YAMLlint (1.37.1)
.github/workflows/execute_notebooks.yml

[error] 22-22: trailing spaces

(trailing-spaces)


[error] 41-41: trailing spaces

(trailing-spaces)


[error] 62-62: trailing spaces

(trailing-spaces)


[error] 72-72: trailing spaces

(trailing-spaces)

🔇 Additional comments (1)
.github/workflows/execute_notebooks.yml (1)

30-34: Consider upgrading to actions/setup-python@v5

v4 is flagged by actionlint as too old for the current runner image. Updating avoids sporadic cache issues and future deprecation warnings.

-      - name: Set up Python
-        uses: actions/setup-python@v4
+      - name: Set up Python
+        uses: actions/setup-python@v5

Comment on lines +49 to +55
- name: Configure git
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"

- name: Find and execute notebooks
run: |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

No step commits the modified notebooks

You configure Git but never stage or commit the executed notebooks, so even with a correct if: guard nothing will be pushed.

       - name: Configure git
         run: |
           git config --local user.email "action@github.com"
           git config --local user.name "GitHub Action"

+      - name: Commit notebook changes
+        run: |
+          if ! git diff --quiet; then
+            git add docs/**/*.ipynb
+            git commit -m "ci: update executed notebook outputs [skip ci]"
+          fi

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In .github/workflows/execute_notebooks.yml around lines 49 to 55, after
configuring Git user details, add steps to stage the modified notebooks using
'git add' and commit them with an appropriate commit message. This ensures that
the executed notebooks are committed and can be pushed later in the workflow.

@jcharkow
jcharkow merged commit c9e0c07 into main Aug 5, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant