Skip to content

docs: integrate myst-nb notebook rendering infrastructure (#884)#885

Merged
egordm merged 3 commits into
release/v4.0.0from
docs/notebook-integration
May 15, 2026
Merged

docs: integrate myst-nb notebook rendering infrastructure (#884)#885
egordm merged 3 commits into
release/v4.0.0from
docs/notebook-integration

Conversation

@egordm
Copy link
Copy Markdown
Collaborator

@egordm egordm commented May 13, 2026

Summary

Integrates myst-nb into the Sphinx docs build so tutorial notebooks in examples/tutorials/ render as notebook pages with code cells and narrative prose.

This is Phase 1 of the documentation infrastructure plan from #884.

Changes

Docs build

  • Replace myst-parser with myst-nb (superset that adds notebook execution)
  • Add jupyter-cache and jupytext as docs dependencies
  • Configure nb_execution_mode="off" (execution enabled in follow-up [OpenSTEF 4.0] Optimize tutorial notebooks for CI execution #886)
  • Exclude .ipynb from Sphinx source tree (use .py via nb_custom_formats)
  • Fix rstjinja handler to skip non-RST sources (prevent Jinja errors on {} in notebooks)
  • Symlink docs/source/tutorialsexamples/tutorials

Notebooks

  • Create .py jupytext pair for backtesting tutorial
  • Tag SPDX cells with remove-cell to hide license boilerplate from rendered output

Tooling

  • Add poe notebooks-clear task (strip outputs from .ipynb)
  • Extend poe notebooks-check with output validation via tools/check_notebook_outputs.py

Configuration

  • Add E501/PTH lint ignores for tutorials (educational code, not production)
  • Exclude examples/tutorials/ from pyright (notebooks have cell-scoped execution)
  • Add .jupyter_cache/ to .gitignore
  • Add tutorial .py files to REUSE.toml

Documentation

  • Wire 3 tutorials into Examples toctree
  • Add "Working with tutorial notebooks" section to Contributing guide

Verification

  • poe all ✅ (1020 tests pass, lint clean, types clean, notebooks synced)
  • poe docs ✅ (build succeeds, tutorials render without SPDX leakage)
  • No SPDX text appears in rendered HTML
  • Examples page lists all 3 tutorials with proper navigation

Follow-up

Related

@egordm egordm requested a review from a team May 13, 2026 15:37
@github-actions github-actions Bot added the chore Improvements or additions to documentation label May 13, 2026
- Replace myst-parser with myst-nb (superset) for notebook execution
- Add jupyter-cache and jupytext as docs dependencies
- Configure nb_execution_mode='cache' with 120s timeout
- Exclude .ipynb from Sphinx source (use .py via nb_custom_formats)
- Create .py jupytext pair for backtesting tutorial
- Tag SPDX cells with 'remove-cell' to hide from rendered output
- Add symlink docs/source/tutorials -> examples/tutorials
- Add poe notebooks-clear task (strip outputs from .ipynb)
- Extend poe notebooks-check with output validation script
- Add tools/check_notebook_outputs.py for CI validation
- Wire 3 tutorials into Examples toctree
- Exclude backtesting notebook from execution (too slow, tracked in #884)
- Add E501/PTH lint ignores and pyright exclusion for tutorials
- Document notebook workflow in Contributing guide
- Add .jupyter_cache/ to .gitignore, tutorial .py to REUSE.toml

Closes #884 (Phase 1)

Signed-off-by: Egor Dmitriev <egor.dmitriev@alliander.com>
Signed-off-by: Egor Dmitriev <egor.dmitriev@alliander.com>
@egordm egordm force-pushed the docs/notebook-integration branch from e26a002 to d51431d Compare May 13, 2026 15:53
@egordm egordm changed the title docs: integrate myst-nb notebook rendering infrastructure docs: integrate myst-nb notebook rendering infrastructure (#884) May 13, 2026
Comment thread docs/source/contribute/document.rst
Comment thread .gitignore Outdated
egordm added 2 commits May 15, 2026 10:56
Remove the docs/source/tutorials symlink (breaks on Windows without
Developer Mode) and replace with a poe _docs_sync task that copies
examples/tutorials/ into docs/source/ before building.

The docs task now has deps = ['_docs_sync'] so the copy runs
automatically before sphinx-build or sphinx-autobuild.

Signed-off-by: Egor Dmitriev <egor.dmitriev@alliander.com>
Signed-off-by: Egor Dmitriev <egor.dmitriev@alliander.com>
Signed-off-by: Egor Dmitriev <egor.dmitriev@alliander.com>
@egordm egordm force-pushed the docs/notebook-integration branch from 5821ff4 to cd7734f Compare May 15, 2026 09:24
@sonarqubecloud
Copy link
Copy Markdown

@egordm egordm merged commit 86d61fa into release/v4.0.0 May 15, 2026
4 checks passed
@egordm egordm deleted the docs/notebook-integration branch May 15, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants