Skip to content

feat: script → notebook converter (al_to_notebook) for narrative-docstring scripts#52

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/script-to-notebook
Jul 10, 2026
Merged

feat: script → notebook converter (al_to_notebook) for narrative-docstring scripts#52
Jammy2211 merged 1 commit into
mainfrom
feature/script-to-notebook

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

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 nor ipynb-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 in skills/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.py end-to-end: valid nbformat v4 (nbformat.validate clean), 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 published start_here.ipynb today), 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

…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>
@Jammy2211
Jammy2211 merged commit b4e73f7 into main Jul 10, 2026
1 check failed
@Jammy2211
Jammy2211 deleted the feature/script-to-notebook branch July 10, 2026 10:23
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.

feat: script → notebook converter (al_to_notebook) for narrative-docstring scripts

1 participant