feat: script → notebook converter (al_to_notebook) for narrative-docstring scripts#52
Merged
Merged
Conversation
…string scripts (#51) Stdlib-only autoassistant/to_notebook.py (nbformat-v4 JSON direct; adapts PyAutoBuild autobuild/build_util.py py_to_notebook + add_notebook_quotes semantics, cited as reference — no PyAutoBuild or ipynb-py-convert dependency for assistant/project users); al_to_notebook skill + README registration + .claude/skills symlink; unit tests pin the cell split incl. the back-to-back docstring case the reference pipeline mis-renders. Verified on autolens_workspace start_here.py: 25/26 cells identical to the pipeline, the 26th is the pipeline's own artifact (docstring rendered as a code cell with literal '# %%' markers) which this converter handles correctly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #51.
Summary
autoassistant/to_notebook.py— stdlib-only converter: top-level docstring blocks → markdown cells, code between → code cells, emitted directly as nbformat-v4 JSON (with cell ids). Adapts the PyAutoBuild reference (autobuild/build_util.py::py_to_notebook+add_notebook_quotes.py, cited in the module docstring) so assistant clones and science projects need neither PyAutoBuild noripynb-py-convert. CLI:python -m autoassistant.to_notebook <script.py> [out.ipynb].skills/al_to_notebook.md— user-invocable skill ("turn this into a notebook"): converts, quotes the absolute output path, and states the notebook is generated output (edit the .py, reconvert). Registered inskills/README.md+.claude/skills/symlink.autoassistant/tests/test_to_notebook.py— pins the cell split (incl. back-to-back docstrings) and valid nbformat-v4 output. Suite: 16 passed.Scripts Changed
None — assistant tooling + skill docs only (no workspace scripts/notebooks).
Validation
autolens_workspace/start_here.pyend-to-end: valid nbformat v4 (nbformat.validateclean), 26 cells; cross-checked against the actual PyAutoBuild pipeline run on the same input — 25/26 cells byte-identical; the single difference is a reference-pipeline artifact (back-to-back docstrings at start_here.py:297–299 become a code cell containing literal# %%/'''markers — present in the publishedstart_here.ipynbtoday), which this converter renders correctly as markdown. Filed separately as a PyAutoBuild bug prompt.--check-citations: 91 files, 388 citations, 0 missing.Readiness
Heart YELLOW on the standing 6-reason set only (human-acked repeatedly 2026-07-10); assistant-repo change, not on the library release train.
🤖 Generated with Claude Code