Skip to content

docs: remove the Finished./Finish. notebook-generation crutch - #39

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/remove-finish-docstring-hack
Jul 30, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/remove-finish-docstring-hack

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Removes the Finished. / Finish. notebook-generation crutch from HowToFit — 1 occurrence: 1 trailing block.

Artifacts: 1 notebook regenerated.

Why

These trailing docstring blocks were a crutch against notebook generation "cutting off weird" when a script's last cell was not a docstring. That belief is obsolete: deleting the block and running the real add_notebook_quotes → ipynb-py-convert chain gives a complete, unmangled final code cell, and PyAutoLabs/PyAutoHands#214 adds test_script_ending_in_code_keeps_a_complete_final_code_cell to pin it. The crutch rendered as a pointless final markdown cell in every generated notebook.

Shapes handled

A blanket regex would be wrong — five distinct shapes exist and each needs different handling. The sweep used Python's own tokenize to locate the exact string token each occurrence lives in, because a line-based scanner cannot tell a narrative docstring's bare delimiter from a function docstring that opens with text on the delimiter line, and this corpus contains both.

Verification

  • Every changed file compiles.
  • black --check clean.
  • Env declarations byte-identical before and after. Removing the word above an __Env__ section turns the canonical merged form into the standalone-fallback form; both are supported. Checked by running env_config.read_env_declaration on the old and new content of all 169 changed files across the series: 169 unchanged, 0 changed, 0 errors.
  • CRLF preserved. Several of these repos ship CRLF .py files; the first attempt normalised them and rewrote whole files (~6000 line churn). The sweep reads and writes with newline="", so the diff is deletions only.
  • No generated notebook contains a code cell with a literal # %% or ''', and no notebook has a Finish. markdown cell.

Merge order

PyAutoLabs/PyAutoHands#214 merges first — this repo invokes ../PyAutoHands/autohands/generate.py from the local checkout, so the regenerated notebooks here are only correct against that version.

Part of PyAutoLabs/PyAutoHands#211.

🤖 Generated with Claude Code

https://claude.ai/code/session_013XzXdQMU3KV2tyZaMNPvsM

1 occurrences: 1 trailing block.

These trailing docstring blocks were a crutch against notebook generation
"cutting off weird" when a script's last cell was not a docstring. That shape
converts correctly and is now pinned by a regression test in PyAutoHands
(PyAutoLabs/PyAutoHands#214), so the crutch is dead weight — it rendered as a
pointless final markdown cell in every generated notebook.

Refs PyAutoLabs/PyAutoHands#211

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013XzXdQMU3KV2tyZaMNPvsM
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Jul 30, 2026
@Jammy2211
Jammy2211 merged commit d976855 into main Jul 30, 2026
10 checks passed
@Jammy2211
Jammy2211 deleted the feature/remove-finish-docstring-hack branch July 30, 2026 10:28
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Oct 7, 2026
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