Skip to content

Tests: Add notebook format and metadata validation#145

Open
brycelelbach wants to merge 1 commit intomainfrom
test-notebook-format
Open

Tests: Add notebook format and metadata validation#145
brycelelbach wants to merge 1 commit intomainfrom
test-notebook-format

Conversation

@brycelelbach
Copy link
Collaborator

Summary

Adds a new script (brev/test-notebook-format.py) and CI workflows to validate Jupyter notebook format and metadata across all tutorials and the Accelerated Python User Guide.

What is checked

  1. Schema integrity — validates each notebook against the official Jupyter notebook JSON schema using nbformat.
  2. Metadata conformance — verifies that the top-level metadata, nbformat, and nbformat_minor fields match the expected standard values.
  3. Clean outputs — non-SOLUTION notebooks must have all cell outputs, execution counts, and execution timing metadata (from jupyterlab-execute-time) cleared.

The cuDF kernelspec is accepted as an alternative to the default ipykernel. Any other kernelspec (or missing kernelspec) is flagged as incorrect.

Usage

# Check all tutorials
python3 brev/test-notebook-format.py

# Check a specific tutorial
python3 brev/test-notebook-format.py accelerated-python

# Auto-fix all issues
python3 brev/test-notebook-format.py --fix

# Auto-fix a specific tutorial
python3 brev/test-notebook-format.py accelerated-python --fix

CI

  • .github/workflows/test-notebook-format.yml — runs on push and PR, checks all notebooks
  • .github/workflows/pr-comment-notebook-format.yml — posts a comment on the PR if the check fails

@github-actions
Copy link
Contributor

❌ Link Check Failed

Broken links were detected in this PR.

Please check the workflow run logs for details on which links are broken.

Common fixes:

  1. Typo in URL - Check for spelling mistakes in the link
  2. Outdated link - The page may have moved or been deleted
  3. Relative path issue - Ensure relative links use the correct path
  4. External site down - If the external site is temporarily down, you can add it to brev/.lycheeignore

To test links locally:

./brev/test-links.bash .

📚 Lychee documentation

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