GeezerVison is showing github.com — ♻️ `notebooks`: use Python sources by GeigerJ2 · Pull Request #225 · pythonworkflow/python-workflow-definition
Conversation
GeigerJ2
commented
Nov 20, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
@jan-janssen, in this PR, I’ve converted all example notebooks to Jupytext percent-format Python sources so review diffs stay readable and execution outputs stay out of version control.
I personally really dislike notebooks in version control because they pollute the diff, even more so now that everyone's using agents. Please let me know if you're OK with this change. We can also hop on a quick call if you want to discuss?
Overall:
- The
*_notebook.py files preserve the code and Markdown contents. The suffix is necessary to prevent engine-package import collisions (as otherwise the files would just be called, e.g., aiida.py).
- A shared Jupytext script generates the original
.ipynb filenames (e.g., aiida.ipynb, not aiida_notebook.ipynb), so notebook paths and published URLs stay unchanged.
- CI uses Jupytext to generate notebooks from the Python sources, executes every notebook with Papermill (unchanged), uploads the executed notebooks, then builds the site with Jupyter Book from those artifacts, including their outputs. I checked the built site locally from the rendered documentation artifact. The execution and documentation jobs pass. I served the built site locally with:
gh run download -R pythonworkflow/python-workflow-definition 44759261741 -n documentation -D /tmp/pwd-book && python -m http.server -d /tmp/pwd-book 8000
- Binder uses the same generator in
binder/postBuild to create ordinary interactive notebooks. I'm still trying to check the build, but, getting various errors (e.g., upload to container registry failed; may be some network issues). Maybe you will have more luck, via this Binder link from my fork.
- I also updated the Mesa package names for Binder’s Ubuntu 24.04 base image (commit:
06a36f8779b0d6be95d88e2207101b3c9d6eaa25). This fixes an existing Binder compatibility problem independently of the notebook conversion and can move into a separate, preparatory PR.
I chose Jupytext for the smallest compatible migration, keeping Papermill execution and Jupyter Book publishing (using Sphinx internally). I originally thought about Sphinx Gallery that we have used in other projects, but wanted the changes to the stack to remain minimal. This still uses the aiida-workgraph version of the notebook, while the AiiDA adapter rewrite stays separate in #222.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
✅ All modified and coverable lines are covered by tests.
📢 Thoughts on this report? Let us know!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Keep example sources in Jupytext percent format and generate notebooks
for Papermill execution and Binder. Publish the executed CI artifacts
through the existing Jupyter Book build.
Use `_notebook.py` source names so engine imports resolve to installed
packages. Generated notebook filenames and published URLs stay stable.
Workflow adapters remain unchanged from `main`.
`repo2docker` now builds on Ubuntu 24.04, where the old Mesa
transitional packages are gone (`libgl1-mesa-glx` removed,
`libegl1-mesa` renamed to `libegl1`). Every Binder launch fails
at the `apt-get install` step without this.
Comment on lines
74
to
+75
|
|
verdi presto --profile-name pwd
|
|
|
sudo apt-get install -y $(cat binder/apt.txt)
|
|
|
xargs -r -a binder/apt.txt sudo apt-get install -y
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some minor changes here due to shellcheck linting. We can revert them to disentangle, but they should improve the overall quality, so I'm not sure if it's really worth the churn.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This branch has not been deployed
No deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|